From a73b22b96fa432532cd6926ef7af72bb68726a62 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Fri, 18 Jul 2014 11:56:08 -0400 Subject: [PATCH] ES6: Modals converted --- .../javascripts/discourse/views/modal.js.es6 | 5 ++++ .../discourse/views/modal/modal_view.js | 15 ------------ .../views/modal/not_activated_view.js | 12 ---------- .../views/modal/option_boolean_view.js | 23 ------------------- .../views/{modal => }/modal_body_view.js | 0 .../discourse/views/not-activated.js.es6 | 4 ++++ .../discourse/views/option-boolean.js.es6 | 11 +++++++++ 7 files changed, 20 insertions(+), 50 deletions(-) create mode 100644 app/assets/javascripts/discourse/views/modal.js.es6 delete mode 100644 app/assets/javascripts/discourse/views/modal/modal_view.js delete mode 100644 app/assets/javascripts/discourse/views/modal/not_activated_view.js delete mode 100644 app/assets/javascripts/discourse/views/modal/option_boolean_view.js rename app/assets/javascripts/discourse/views/{modal => }/modal_body_view.js (100%) create mode 100644 app/assets/javascripts/discourse/views/not-activated.js.es6 create mode 100644 app/assets/javascripts/discourse/views/option-boolean.js.es6 diff --git a/app/assets/javascripts/discourse/views/modal.js.es6 b/app/assets/javascripts/discourse/views/modal.js.es6 new file mode 100644 index 00000000000..204a17e8c7b --- /dev/null +++ b/app/assets/javascripts/discourse/views/modal.js.es6 @@ -0,0 +1,5 @@ +export default Ember.View.extend({ + elementId: 'discourse-modal', + templateName: 'modal/modal', + classNameBindings: [':modal', ':hidden', 'controller.modalClass'] +}); diff --git a/app/assets/javascripts/discourse/views/modal/modal_view.js b/app/assets/javascripts/discourse/views/modal/modal_view.js deleted file mode 100644 index 6c6d2f7072b..00000000000 --- a/app/assets/javascripts/discourse/views/modal/modal_view.js +++ /dev/null @@ -1,15 +0,0 @@ -/** - A base class for helping us display modal content - - @class ModalView - @extends Discourse.View - @namespace Discourse - @module Discourse -**/ -Discourse.ModalView = Discourse.View.extend({ - elementId: 'discourse-modal', - templateName: 'modal/modal', - classNameBindings: [':modal', ':hidden', 'controller.modalClass'] -}); - - diff --git a/app/assets/javascripts/discourse/views/modal/not_activated_view.js b/app/assets/javascripts/discourse/views/modal/not_activated_view.js deleted file mode 100644 index 817fc1c125f..00000000000 --- a/app/assets/javascripts/discourse/views/modal/not_activated_view.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - A modal view for telling a user they're not activated - - @class NotActivatedView - @extends Discourse.ModalBodyView - @namespace Discourse - @module Discourse -**/ -Discourse.NotActivatedView = Discourse.ModalBodyView.extend({ - templateName: 'modal/not_activated', - title: I18n.t('log_in') -}); diff --git a/app/assets/javascripts/discourse/views/modal/option_boolean_view.js b/app/assets/javascripts/discourse/views/modal/option_boolean_view.js deleted file mode 100644 index 5536a204f4e..00000000000 --- a/app/assets/javascripts/discourse/views/modal/option_boolean_view.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - A modal view for displaying the options for a topic archetype - - @class OptionBooleanView - @extends Discourse.View - @namespace Discourse - @module Discourse -**/ -Discourse.OptionBooleanView = Discourse.GroupedView.extend({ - classNames: ['archetype-option'], - composerControllerBinding: 'Discourse.router.composerController', - templateName: "modal/option_boolean", - - checkedChanged: (function() { - var metaData; - metaData = this.get('parentView.metaData'); - metaData.set(this.get('content.key'), this.get('checked') ? 'true' : 'false'); - return this.get('controller.controllers.composer').saveDraft(); - }).observes('checked') - -}); - - diff --git a/app/assets/javascripts/discourse/views/modal/modal_body_view.js b/app/assets/javascripts/discourse/views/modal_body_view.js similarity index 100% rename from app/assets/javascripts/discourse/views/modal/modal_body_view.js rename to app/assets/javascripts/discourse/views/modal_body_view.js diff --git a/app/assets/javascripts/discourse/views/not-activated.js.es6 b/app/assets/javascripts/discourse/views/not-activated.js.es6 new file mode 100644 index 00000000000..30f4da1172e --- /dev/null +++ b/app/assets/javascripts/discourse/views/not-activated.js.es6 @@ -0,0 +1,4 @@ +export default Discourse.ModalBodyView.extend({ + templateName: 'modal/not_activated', + title: I18n.t('log_in') +}); diff --git a/app/assets/javascripts/discourse/views/option-boolean.js.es6 b/app/assets/javascripts/discourse/views/option-boolean.js.es6 new file mode 100644 index 00000000000..813677edcdf --- /dev/null +++ b/app/assets/javascripts/discourse/views/option-boolean.js.es6 @@ -0,0 +1,11 @@ +export default Discourse.GroupedView.extend({ + classNames: ['archetype-option'], + composerControllerBinding: 'Discourse.router.composerController', + templateName: "modal/option_boolean", + + _checkedChanged: function() { + var metaData = this.get('parentView.metaData'); + metaData.set(this.get('content.key'), this.get('checked') ? 'true' : 'false'); + this.get('controller.controllers.composer').saveDraft(); + }.observes('checked') +});