mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-28 01:56:01 -05:00
ES6: Modals converted
This commit is contained in:
parent
c7330ed73f
commit
a73b22b96f
7 changed files with 20 additions and 50 deletions
5
app/assets/javascripts/discourse/views/modal.js.es6
Normal file
5
app/assets/javascripts/discourse/views/modal.js.es6
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
export default Ember.View.extend({
|
||||||
|
elementId: 'discourse-modal',
|
||||||
|
templateName: 'modal/modal',
|
||||||
|
classNameBindings: [':modal', ':hidden', 'controller.modalClass']
|
||||||
|
});
|
|
@ -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']
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
|
@ -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')
|
|
||||||
});
|
|
|
@ -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')
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
export default Discourse.ModalBodyView.extend({
|
||||||
|
templateName: 'modal/not_activated',
|
||||||
|
title: I18n.t('log_in')
|
||||||
|
});
|
11
app/assets/javascripts/discourse/views/option-boolean.js.es6
Normal file
11
app/assets/javascripts/discourse/views/option-boolean.js.es6
Normal file
|
@ -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')
|
||||||
|
});
|
Loading…
Reference in a new issue