From 389c50eb1e21f95d501f6e5656923c4422898065 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Mon, 5 May 2014 13:58:40 -0400 Subject: [PATCH] Revert "ES6: Half a dozen more controllers converted" This reverts commit bc2d87e5c1b35bd49e62db944d00cf960b16abd9. --- ...n-level.js.es6 => bulk_notification_level_controller.js} | 2 +- .../{change-owner.js.es6 => change_owner_controller.js} | 2 +- .../controllers/{composer.js.es6 => composer_controller.js} | 2 +- ...oser-messages.js.es6 => composer_messages_controller.js} | 4 ++-- .../{create-account.js.es6 => create_account_controller.js} | 2 +- app/assets/javascripts/discourse/lib/url.js | 2 -- .../controllers/create_account_controller_test.js | 6 +++--- 7 files changed, 9 insertions(+), 11 deletions(-) rename app/assets/javascripts/discourse/controllers/{bulk-notification-level.js.es6 => bulk_notification_level_controller.js} (93%) rename app/assets/javascripts/discourse/controllers/{change-owner.js.es6 => change_owner_controller.js} (92%) rename app/assets/javascripts/discourse/controllers/{composer.js.es6 => composer_controller.js} (99%) rename app/assets/javascripts/discourse/controllers/{composer-messages.js.es6 => composer_messages_controller.js} (96%) rename app/assets/javascripts/discourse/controllers/{create-account.js.es6 => create_account_controller.js} (99%) diff --git a/app/assets/javascripts/discourse/controllers/bulk-notification-level.js.es6 b/app/assets/javascripts/discourse/controllers/bulk_notification_level_controller.js similarity index 93% rename from app/assets/javascripts/discourse/controllers/bulk-notification-level.js.es6 rename to app/assets/javascripts/discourse/controllers/bulk_notification_level_controller.js index 87d698062..444165baf 100644 --- a/app/assets/javascripts/discourse/controllers/bulk-notification-level.js.es6 +++ b/app/assets/javascripts/discourse/controllers/bulk_notification_level_controller.js @@ -6,7 +6,7 @@ @namespace Discourse @module Discourse **/ -export default Em.Controller.extend({ +Discourse.BulkNotificationLevelController = Em.Controller.extend({ needs: ['topicBulkActions'], notificationLevelId: null, diff --git a/app/assets/javascripts/discourse/controllers/change-owner.js.es6 b/app/assets/javascripts/discourse/controllers/change_owner_controller.js similarity index 92% rename from app/assets/javascripts/discourse/controllers/change-owner.js.es6 rename to app/assets/javascripts/discourse/controllers/change_owner_controller.js index 46b042898..865a5c910 100644 --- a/app/assets/javascripts/discourse/controllers/change-owner.js.es6 +++ b/app/assets/javascripts/discourse/controllers/change_owner_controller.js @@ -7,7 +7,7 @@ @uses Discourse.ModalFunctionality @module Discourse **/ -export default Discourse.ObjectController.extend(Discourse.SelectedPostsCount, Discourse.ModalFunctionality, { +Discourse.ChangeOwnerController = Discourse.ObjectController.extend(Discourse.SelectedPostsCount, Discourse.ModalFunctionality, { needs: ['topic'], topicController: Em.computed.alias('controllers.topic'), diff --git a/app/assets/javascripts/discourse/controllers/composer.js.es6 b/app/assets/javascripts/discourse/controllers/composer_controller.js similarity index 99% rename from app/assets/javascripts/discourse/controllers/composer.js.es6 rename to app/assets/javascripts/discourse/controllers/composer_controller.js index 486b851eb..a64100810 100644 --- a/app/assets/javascripts/discourse/controllers/composer.js.es6 +++ b/app/assets/javascripts/discourse/controllers/composer_controller.js @@ -6,7 +6,7 @@ @namespace Discourse @module Discourse **/ -export default Discourse.Controller.extend({ +Discourse.ComposerController = Discourse.Controller.extend({ needs: ['modal', 'topic', 'composerMessages'], replyAsNewTopicDraft: Em.computed.equal('model.draftKey', Discourse.Composer.REPLY_AS_NEW_TOPIC_KEY), diff --git a/app/assets/javascripts/discourse/controllers/composer-messages.js.es6 b/app/assets/javascripts/discourse/controllers/composer_messages_controller.js similarity index 96% rename from app/assets/javascripts/discourse/controllers/composer-messages.js.es6 rename to app/assets/javascripts/discourse/controllers/composer_messages_controller.js index d23ba6066..3dea0b416 100644 --- a/app/assets/javascripts/discourse/controllers/composer-messages.js.es6 +++ b/app/assets/javascripts/discourse/controllers/composer_messages_controller.js @@ -6,7 +6,7 @@ @namespace Discourse @module Discourse **/ -export default Ember.ArrayController.extend({ +Discourse.ComposerMessagesController = Ember.ArrayController.extend({ needs: ['composer'], // Whether we've checked our messages @@ -98,4 +98,4 @@ export default Ember.ArrayController.extend({ }); } -}); +}); \ No newline at end of file diff --git a/app/assets/javascripts/discourse/controllers/create-account.js.es6 b/app/assets/javascripts/discourse/controllers/create_account_controller.js similarity index 99% rename from app/assets/javascripts/discourse/controllers/create-account.js.es6 rename to app/assets/javascripts/discourse/controllers/create_account_controller.js index dc76f058f..a04dc3c6c 100644 --- a/app/assets/javascripts/discourse/controllers/create-account.js.es6 +++ b/app/assets/javascripts/discourse/controllers/create_account_controller.js @@ -7,7 +7,7 @@ @uses Discourse.ModalFunctionality @module Discourse **/ -export default Discourse.Controller.extend(Discourse.ModalFunctionality, { +Discourse.CreateAccountController = Discourse.Controller.extend(Discourse.ModalFunctionality, { uniqueUsernameValidation: null, globalNicknameExists: false, complete: false, diff --git a/app/assets/javascripts/discourse/lib/url.js b/app/assets/javascripts/discourse/lib/url.js index 66cb168bb..0f096d2e5 100644 --- a/app/assets/javascripts/discourse/lib/url.js +++ b/app/assets/javascripts/discourse/lib/url.js @@ -52,8 +52,6 @@ Discourse.URL = Em.Object.createWithMixins({ **/ routeTo: function(path) { - if (Em.isEmpty(path)) { return; } - if(Discourse.get("requiresRefresh")){ document.location.href = path; return; diff --git a/test/javascripts/controllers/create_account_controller_test.js b/test/javascripts/controllers/create_account_controller_test.js index 45ca92ee8..8e6ced64c 100644 --- a/test/javascripts/controllers/create_account_controller_test.js +++ b/test/javascripts/controllers/create_account_controller_test.js @@ -1,8 +1,8 @@ -module("controller:create-account"); +module("Discourse.CreateAccountController"); test('basicUsernameValidation', function() { var testInvalidUsername = function(username, expectedReason) { - var controller = controllerFor('create-account'); + var controller = testController(Discourse.CreateAccountController, null); 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 = controllerFor('create-account'); + var controller = testController(Discourse.CreateAccountController, null); controller.set('accountUsername', 'porkchops'); controller.set('prefilledUsername', 'porkchops'); equal(controller.get('basicUsernameValidation.ok'), true, 'Prefilled username is valid');