ES6: Half a dozen more controllers converted

This commit is contained in:
Robin Ward 2014-05-04 14:30:17 -04:00
parent b98324a937
commit bc2d87e5c1
7 changed files with 11 additions and 9 deletions

View File

@ -6,7 +6,7 @@
@namespace Discourse
@module Discourse
**/
Discourse.BulkNotificationLevelController = Em.Controller.extend({
export default Em.Controller.extend({
needs: ['topicBulkActions'],
notificationLevelId: null,

View File

@ -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'),

View File

@ -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({
});
}
});
});

View File

@ -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),

View File

@ -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,

View File

@ -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;

View File

@ -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');