ES6: Half a dozen more controllers converted
This commit is contained in:
parent
5191acfd9f
commit
4640b9d653
|
@ -6,7 +6,7 @@
|
|||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.BulkNotificationLevelController = Em.Controller.extend({
|
||||
export default Em.Controller.extend({
|
||||
needs: ['topicBulkActions'],
|
||||
|
||||
notificationLevelId: null,
|
|
@ -7,7 +7,7 @@
|
|||
@uses Discourse.ModalFunctionality
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.ChangeOwnerController = Discourse.ObjectController.extend(Discourse.SelectedPostsCount, Discourse.ModalFunctionality, {
|
||||
export default Discourse.ObjectController.extend(Discourse.SelectedPostsCount, Discourse.ModalFunctionality, {
|
||||
needs: ['topic'],
|
||||
|
||||
topicController: Em.computed.alias('controllers.topic'),
|
|
@ -6,7 +6,7 @@
|
|||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.ComposerMessagesController = Ember.ArrayController.extend({
|
||||
export default Ember.ArrayController.extend({
|
||||
needs: ['composer'],
|
||||
|
||||
// Whether we've checked our messages
|
||||
|
@ -98,4 +98,4 @@ Discourse.ComposerMessagesController = Ember.ArrayController.extend({
|
|||
});
|
||||
}
|
||||
|
||||
});
|
||||
});
|
|
@ -6,7 +6,7 @@
|
|||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.ComposerController = Discourse.Controller.extend({
|
||||
export default Discourse.Controller.extend({
|
||||
needs: ['modal', 'topic', 'composerMessages'],
|
||||
|
||||
replyAsNewTopicDraft: Em.computed.equal('model.draftKey', Discourse.Composer.REPLY_AS_NEW_TOPIC_KEY),
|
|
@ -7,7 +7,7 @@
|
|||
@uses Discourse.ModalFunctionality
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.CreateAccountController = Discourse.Controller.extend(Discourse.ModalFunctionality, {
|
||||
export default Discourse.Controller.extend(Discourse.ModalFunctionality, {
|
||||
uniqueUsernameValidation: null,
|
||||
globalNicknameExists: false,
|
||||
complete: false,
|
|
@ -52,6 +52,8 @@ Discourse.URL = Em.Object.createWithMixins({
|
|||
**/
|
||||
routeTo: function(path) {
|
||||
|
||||
if (Em.isEmpty(path)) { return; }
|
||||
|
||||
if(Discourse.get("requiresRefresh")){
|
||||
document.location.href = path;
|
||||
return;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
module("Discourse.CreateAccountController");
|
||||
module("controller:create-account");
|
||||
|
||||
test('basicUsernameValidation', function() {
|
||||
var testInvalidUsername = function(username, expectedReason) {
|
||||
var controller = testController(Discourse.CreateAccountController, null);
|
||||
var controller = controllerFor('create-account');
|
||||
controller.set('accountUsername', username);
|
||||
equal(controller.get('basicUsernameValidation.failed'), true, 'username should be invalid: ' + username);
|
||||
equal(controller.get('basicUsernameValidation.reason'), expectedReason, 'username validation reason: ' + username + ', ' + expectedReason);
|
||||
|
@ -12,7 +12,7 @@ test('basicUsernameValidation', function() {
|
|||
testInvalidUsername('x', I18n.t('user.username.too_short'));
|
||||
testInvalidUsername('1234567890123456', I18n.t('user.username.too_long'));
|
||||
|
||||
var controller = testController(Discourse.CreateAccountController, null);
|
||||
var controller = controllerFor('create-account');
|
||||
controller.set('accountUsername', 'porkchops');
|
||||
controller.set('prefilledUsername', 'porkchops');
|
||||
equal(controller.get('basicUsernameValidation.ok'), true, 'Prefilled username is valid');
|
||||
|
|
Loading…
Reference in New Issue