diff --git a/app/assets/javascripts/discourse/views/modal/avatar_selector_view.js b/app/assets/javascripts/discourse/views/avatar-selector.js.es6 similarity index 70% rename from app/assets/javascripts/discourse/views/modal/avatar_selector_view.js rename to app/assets/javascripts/discourse/views/avatar-selector.js.es6 index 993dcce2c60..c87e91fcdfb 100644 --- a/app/assets/javascripts/discourse/views/modal/avatar_selector_view.js +++ b/app/assets/javascripts/discourse/views/avatar-selector.js.es6 @@ -1,12 +1,4 @@ -/** - This view handles the avatar selection interface - - @class AvatarSelectorView - @extends Discourse.ModalBodyView - @namespace Discourse - @module Discourse -**/ -Discourse.AvatarSelectorView = Discourse.ModalBodyView.extend({ +export default Discourse.ModalBodyView.extend({ templateName: 'modal/avatar_selector', classNames: ['avatar-selector'], title: I18n.t('user.change_avatar.title'), @@ -22,6 +14,5 @@ Discourse.AvatarSelectorView = Discourse.ModalBodyView.extend({ var value = self.get('controller.selected'); $('input:radio[name="avatar"]').val([value]); }); - }.observes('controller.selected'), - + }.observes('controller.selected') }); diff --git a/app/assets/javascripts/discourse/views/change-owner.js.es6 b/app/assets/javascripts/discourse/views/change-owner.js.es6 new file mode 100644 index 00000000000..afce839d670 --- /dev/null +++ b/app/assets/javascripts/discourse/views/change-owner.js.es6 @@ -0,0 +1,4 @@ +export default Discourse.ModalBodyView.extend({ + templateName: 'modal/change_owner', + title: I18n.t('topic.change_owner.title') +}); diff --git a/app/assets/javascripts/discourse/views/edit-topic-auto-close.js.es6 b/app/assets/javascripts/discourse/views/edit-topic-auto-close.js.es6 new file mode 100644 index 00000000000..57d7e55f666 --- /dev/null +++ b/app/assets/javascripts/discourse/views/edit-topic-auto-close.js.es6 @@ -0,0 +1,4 @@ +export default Discourse.ModalBodyView.extend({ + templateName: 'modal/auto_close', + title: I18n.t('topic.auto_close_title') +}); diff --git a/app/assets/javascripts/discourse/views/invite-private.js.es6 b/app/assets/javascripts/discourse/views/invite-private.js.es6 new file mode 100644 index 00000000000..0b827d29b79 --- /dev/null +++ b/app/assets/javascripts/discourse/views/invite-private.js.es6 @@ -0,0 +1,4 @@ +export default Discourse.ModalBodyView.extend({ + templateName: 'modal/invite_private', + title: I18n.t('topic.invite_private.title') +}); diff --git a/app/assets/javascripts/discourse/views/modal/invite_view.js b/app/assets/javascripts/discourse/views/invite.js.es6 similarity index 55% rename from app/assets/javascripts/discourse/views/modal/invite_view.js rename to app/assets/javascripts/discourse/views/invite.js.es6 index 8f2088fa5f7..6f8a2e8f194 100644 --- a/app/assets/javascripts/discourse/views/modal/invite_view.js +++ b/app/assets/javascripts/discourse/views/invite.js.es6 @@ -1,14 +1,5 @@ -/** - A modal view for inviting a user to Discourse - - @class InviteView - @extends Discourse.ModalBodyView - @namespace Discourse - @module Discourse -**/ -Discourse.InviteView = Discourse.ModalBodyView.extend({ +export default Discourse.ModalBodyView.extend({ templateName: 'modal/invite', - title: function() { if (this.get('controller.invitingToTopic')) { return I18n.t('topic.invite_reply.title'); @@ -17,5 +8,3 @@ Discourse.InviteView = Discourse.ModalBodyView.extend({ } }.property('controller.invitingToTopic') }); - - diff --git a/app/assets/javascripts/discourse/views/keyboard-shortcuts-help.js.es6 b/app/assets/javascripts/discourse/views/keyboard-shortcuts-help.js.es6 new file mode 100644 index 00000000000..33ed3615184 --- /dev/null +++ b/app/assets/javascripts/discourse/views/keyboard-shortcuts-help.js.es6 @@ -0,0 +1,4 @@ +export default Discourse.ModalBodyView.extend({ + templateName: 'modal/keyboard_shortcuts_help', + title: I18n.t('keyboard_shortcuts_help.title') +}); diff --git a/app/assets/javascripts/discourse/views/merge-topic.js.es6 b/app/assets/javascripts/discourse/views/merge-topic.js.es6 new file mode 100644 index 00000000000..b4394c57b7e --- /dev/null +++ b/app/assets/javascripts/discourse/views/merge-topic.js.es6 @@ -0,0 +1,4 @@ +export default Discourse.ModalBodyView.extend({ + templateName: 'modal/merge_topic', + title: I18n.t('topic.merge_topic.title') +}); diff --git a/app/assets/javascripts/discourse/views/modal/change_owner_view.js b/app/assets/javascripts/discourse/views/modal/change_owner_view.js deleted file mode 100644 index adfe3c17c0b..00000000000 --- a/app/assets/javascripts/discourse/views/modal/change_owner_view.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - A modal view for handling changing the owner of various posts - - @class ChangeOwnerView - @extends Discourse.ModalBodyView - @namespace Discourse - @module Discourse - **/ -Discourse.ChangeOwnerView = Discourse.ModalBodyView.extend({ - templateName: 'modal/change_owner', - title: I18n.t('topic.change_owner.title') -}); diff --git a/app/assets/javascripts/discourse/views/modal/edit_topic_auto_close_view.js b/app/assets/javascripts/discourse/views/modal/edit_topic_auto_close_view.js deleted file mode 100644 index 1aacbe14efc..00000000000 --- a/app/assets/javascripts/discourse/views/modal/edit_topic_auto_close_view.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - This view handles a modal to set, edit, and remove a topic's auto-close time. - - @class EditTopicAutoCloseView - @extends Discourse.ModalBodyView - @namespace Discourse - @module Discourse -**/ -Discourse.EditTopicAutoCloseView = Discourse.ModalBodyView.extend({ - templateName: 'modal/auto_close', - title: I18n.t('topic.auto_close_title') -}); diff --git a/app/assets/javascripts/discourse/views/modal/invite_private_view.js b/app/assets/javascripts/discourse/views/modal/invite_private_view.js deleted file mode 100644 index 290302744de..00000000000 --- a/app/assets/javascripts/discourse/views/modal/invite_private_view.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - A modal view for inviting a user to private message - - @class InvitePrivateView - @extends Discourse.ModalBodyView - @namespace Discourse - @module Discourse -**/ -Discourse.InvitePrivateView = Discourse.ModalBodyView.extend({ - templateName: 'modal/invite_private', - title: I18n.t('topic.invite_private.title') -}); diff --git a/app/assets/javascripts/discourse/views/modal/keyboard_shortcuts_help_view.js b/app/assets/javascripts/discourse/views/modal/keyboard_shortcuts_help_view.js deleted file mode 100644 index aa851325610..00000000000 --- a/app/assets/javascripts/discourse/views/modal/keyboard_shortcuts_help_view.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - A modal view for displaying Keyboard Shortcut Help - - @class KeyboardShortcutsHelpView - @extends Discourse.ModalBodyView - @namespace Discourse - @module Discourse -**/ -Discourse.KeyboardShortcutsHelpView = Discourse.ModalBodyView.extend({ - templateName: 'modal/keyboard_shortcuts_help', - title: I18n.t('keyboard_shortcuts_help.title') -}); diff --git a/app/assets/javascripts/discourse/views/modal/merge_topic_view.js b/app/assets/javascripts/discourse/views/modal/merge_topic_view.js deleted file mode 100644 index 24c3b1cb2ed..00000000000 --- a/app/assets/javascripts/discourse/views/modal/merge_topic_view.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - A modal view for handling moving of posts to an existing topic - - @class MergeTopicView - @extends Discourse.ModalBodyView - @namespace Discourse - @module Discourse -**/ -Discourse.MergeTopicView = Discourse.ModalBodyView.extend({ - templateName: 'modal/merge_topic', - title: I18n.t('topic.merge_topic.title') -}); diff --git a/app/assets/javascripts/discourse/views/modal/split_topic_view.js b/app/assets/javascripts/discourse/views/modal/split_topic_view.js deleted file mode 100644 index 296309a311f..00000000000 --- a/app/assets/javascripts/discourse/views/modal/split_topic_view.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - A modal view for handling moving of posts to a new topic - - @class SplitTopicView - @extends Discourse.ModalBodyView - @namespace Discourse - @module Discourse -**/ -Discourse.SplitTopicView = Discourse.ModalBodyView.extend(Discourse.SelectedPostsCount, { - templateName: 'modal/split_topic', - title: I18n.t('topic.split_topic.title') -}); - - diff --git a/app/assets/javascripts/discourse/views/split-topic.js.es6 b/app/assets/javascripts/discourse/views/split-topic.js.es6 new file mode 100644 index 00000000000..b4be70f88e7 --- /dev/null +++ b/app/assets/javascripts/discourse/views/split-topic.js.es6 @@ -0,0 +1,4 @@ +export default Discourse.ModalBodyView.extend(Discourse.SelectedPostsCount, { + templateName: 'modal/split_topic', + title: I18n.t('topic.split_topic.title') +}); diff --git a/app/assets/javascripts/discourse/views/modal/upload_selector_view.js b/app/assets/javascripts/discourse/views/upload-selector.js.es6 similarity index 88% rename from app/assets/javascripts/discourse/views/modal/upload_selector_view.js rename to app/assets/javascripts/discourse/views/upload-selector.js.es6 index f6736bd34b9..50b46b69605 100644 --- a/app/assets/javascripts/discourse/views/modal/upload_selector_view.js +++ b/app/assets/javascripts/discourse/views/upload-selector.js.es6 @@ -1,19 +1,10 @@ -/** - This view handles the upload interface - - @class UploadSelectorView - @extends Discourse.ModalBodyView - @namespace Discourse - @module Discourse -**/ - function uploadTranslate(key, options) { var opts = options || {}; if (Discourse.Utilities.allowsAttachments()) { key += "_with_attachments"; } return I18n.t("upload_selector." + key, opts); } -Discourse.UploadSelectorView = Discourse.ModalBodyView.extend({ +export default Discourse.ModalBodyView.extend({ templateName: 'modal/upload_selector', classNames: ['upload-selector'], @@ -36,10 +27,9 @@ Discourse.UploadSelectorView = Discourse.ModalBodyView.extend({ return I18n.t("upload_selector.hint" + (isSupported ? "_for_supported_browsers" : "")); }.property(), - didInsertElement: function() { - this._super(); + _selectOnInsert: function() { this.selectedChanged(); - }, + }.on('didInsertElement'), selectedChanged: function() { var self = this; diff --git a/app/assets/javascripts/discourse/views/user/user_posts_view.js b/app/assets/javascripts/discourse/views/user-posts.js.es6 similarity index 63% rename from app/assets/javascripts/discourse/views/user/user_posts_view.js rename to app/assets/javascripts/discourse/views/user-posts.js.es6 index 7d862a1032c..ebe35fe0253 100644 --- a/app/assets/javascripts/discourse/views/user/user_posts_view.js +++ b/app/assets/javascripts/discourse/views/user-posts.js.es6 @@ -1,13 +1,4 @@ -/** - This view handles rendering of a user's posts - - @class UserPostsView - @extends Discourse.View - @namespace Discourse - @uses Discourse.LoadMore - @module Discourse -**/ -Discourse.UserPostsView = Discourse.View.extend(Discourse.LoadMore, { +export default Ember.View.extend(Discourse.LoadMore, { loading: false, eyelineSelector: ".user-stream .item", classNames: ["user-stream"],