ES6: Many modal views

This commit is contained in:
Robin Ward 2014-07-17 13:43:08 -04:00
parent 3265360ff7
commit 61fd64c99d
16 changed files with 31 additions and 120 deletions

View File

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

View File

@ -0,0 +1,4 @@
export default Discourse.ModalBodyView.extend({
templateName: 'modal/change_owner',
title: I18n.t('topic.change_owner.title')
});

View File

@ -0,0 +1,4 @@
export default Discourse.ModalBodyView.extend({
templateName: 'modal/auto_close',
title: I18n.t('topic.auto_close_title')
});

View File

@ -0,0 +1,4 @@
export default Discourse.ModalBodyView.extend({
templateName: 'modal/invite_private',
title: I18n.t('topic.invite_private.title')
});

View File

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

View File

@ -0,0 +1,4 @@
export default Discourse.ModalBodyView.extend({
templateName: 'modal/keyboard_shortcuts_help',
title: I18n.t('keyboard_shortcuts_help.title')
});

View File

@ -0,0 +1,4 @@
export default Discourse.ModalBodyView.extend({
templateName: 'modal/merge_topic',
title: I18n.t('topic.merge_topic.title')
});

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,4 @@
export default Discourse.ModalBodyView.extend(Discourse.SelectedPostsCount, {
templateName: 'modal/split_topic',
title: I18n.t('topic.split_topic.title')
});

View File

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

View File

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