From e690c1ff14bac21e50fbc56ffbe20b1abacf92b1 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Wed, 4 Jun 2014 12:17:51 -0400 Subject: [PATCH] ES6: Start on some views --- .../discourse-action-history.js.es6} | 9 +++------ .../discourse/components/topic-status.js.es6 | 3 --- .../javascripts/discourse/views/application_view.js | 13 ------------- .../{badges_show_view.js => badges-show.js.es6} | 4 ++-- .../{group_index_view.js => group-index.js.es6} | 6 ++---- 5 files changed, 7 insertions(+), 28 deletions(-) rename app/assets/javascripts/discourse/{views/actions_history_view.js => components/discourse-action-history.js.es6} (93%) delete mode 100644 app/assets/javascripts/discourse/views/application_view.js rename app/assets/javascripts/discourse/views/{badges_show_view.js => badges-show.js.es6} (58%) rename app/assets/javascripts/discourse/views/{group_index_view.js => group-index.js.es6} (52%) diff --git a/app/assets/javascripts/discourse/views/actions_history_view.js b/app/assets/javascripts/discourse/components/discourse-action-history.js.es6 similarity index 93% rename from app/assets/javascripts/discourse/views/actions_history_view.js rename to app/assets/javascripts/discourse/components/discourse-action-history.js.es6 index 06ec4b6ac..002df8d67 100644 --- a/app/assets/javascripts/discourse/views/actions_history_view.js +++ b/app/assets/javascripts/discourse/components/discourse-action-history.js.es6 @@ -1,13 +1,13 @@ /** - This view handles rendering of what actions have been taken on a post. It uses + This component handles rendering of what actions have been taken on a post. It uses buffer rendering for performance rather than a template. @class ActionsHistoryComponent - @extends Discourse.View + @extends Em.Component @namespace Discourse @module Discourse **/ -Discourse.ActionsHistoryComponent = Em.Component.extend({ +export default Em.Component.extend({ tagName: 'section', classNameBindings: [':post-actions', 'hidden'], actionsHistory: Em.computed.alias('post.actionsHistory'), @@ -101,6 +101,3 @@ Discourse.ActionsHistoryComponent = Em.Component.extend({ return false; } }); - - -Discourse.View.registerHelper('discourse-action-history', Discourse.ActionsHistoryComponent); \ No newline at end of file diff --git a/app/assets/javascripts/discourse/components/topic-status.js.es6 b/app/assets/javascripts/discourse/components/topic-status.js.es6 index af6779b47..fdc858587 100644 --- a/app/assets/javascripts/discourse/components/topic-status.js.es6 +++ b/app/assets/javascripts/discourse/components/topic-status.js.es6 @@ -58,6 +58,3 @@ export default Ember.Component.extend({ renderIconIf('topic.invisible', 'eye-slash', 'invisible'); } }); - - -Discourse.View.registerHelper('topicStatus', Discourse.TopicStatusComponent); diff --git a/app/assets/javascripts/discourse/views/application_view.js b/app/assets/javascripts/discourse/views/application_view.js deleted file mode 100644 index 6b18deb0e..000000000 --- a/app/assets/javascripts/discourse/views/application_view.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - This view handles rendering of the core application template - - @class ApplicationView - @extends Discourse.View - @namespace Discourse - @module Discourse -**/ -Discourse.ApplicationView = Discourse.View.extend({ - templateName: 'application' -}); - - diff --git a/app/assets/javascripts/discourse/views/badges_show_view.js b/app/assets/javascripts/discourse/views/badges-show.js.es6 similarity index 58% rename from app/assets/javascripts/discourse/views/badges_show_view.js rename to app/assets/javascripts/discourse/views/badges-show.js.es6 index 7534e62bb..ff84b7147 100644 --- a/app/assets/javascripts/discourse/views/badges_show_view.js +++ b/app/assets/javascripts/discourse/views/badges-show.js.es6 @@ -6,6 +6,6 @@ @namespace Discourse @module Discourse **/ -Discourse.BadgesShowView = Discourse.View.extend(Discourse.LoadMore, { - eyelineSelector: '.badge-user' +export default Discourse.View.extend(Discourse.LoadMore, { + eyelineSelector: '.badge-user', }); diff --git a/app/assets/javascripts/discourse/views/group_index_view.js b/app/assets/javascripts/discourse/views/group-index.js.es6 similarity index 52% rename from app/assets/javascripts/discourse/views/group_index_view.js rename to app/assets/javascripts/discourse/views/group-index.js.es6 index 71082bb15..5f26a832b 100644 --- a/app/assets/javascripts/discourse/views/group_index_view.js +++ b/app/assets/javascripts/discourse/views/group-index.js.es6 @@ -6,8 +6,6 @@ @namespace Discourse @module Discourse **/ -Discourse.GroupIndexView = Discourse.View.extend(Discourse.ScrollTop, Discourse.LoadMore, { - eyelineSelector: '.user-stream .item' - +export default Discourse.View.extend(Discourse.ScrollTop, Discourse.LoadMore, { + eyelineSelector: '.user-stream .item', }); -