Start converting modal views to components
This commit is contained in:
parent
0d295cc7b9
commit
aada925b21
|
@ -0,0 +1,29 @@
|
|||
export default Ember.Component.extend({
|
||||
classNames: ['modal-body'],
|
||||
|
||||
didInsertElement() {
|
||||
this._super();
|
||||
$('#modal-alert').hide();
|
||||
$('#discourse-modal').modal('show');
|
||||
Ember.run.scheduleOnce('afterRender', this, this._afterFirstRender);
|
||||
},
|
||||
|
||||
_afterFirstRender() {
|
||||
if (!this.site.mobileView && this.get('autoFocus') !== 'false') {
|
||||
this.$('input:first').focus();
|
||||
}
|
||||
|
||||
const maxHeight = this.get('maxHeight');
|
||||
if (maxHeight) {
|
||||
const maxHeightFloat = parseFloat(maxHeight) / 100.0;
|
||||
if (maxHeightFloat > 0) {
|
||||
const viewPortHeight = $(window).height();
|
||||
this.$().css("max-height", Math.floor(maxHeightFloat * viewPortHeight) + "px");
|
||||
}
|
||||
}
|
||||
|
||||
this.appEvents.trigger('modal:body-shown', {
|
||||
title: this.get('title')
|
||||
});
|
||||
}
|
||||
});
|
|
@ -1,6 +1,7 @@
|
|||
import { ajax } from 'discourse/lib/ajax';
|
||||
|
||||
export default Discourse.Route.extend({
|
||||
model: function() {
|
||||
model() {
|
||||
return ajax("/404-body", { dataType: 'html' });
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<form>
|
||||
<div class="modal-body">
|
||||
{{#d-modal-body title="topic.auto_close_title" autoFocus="false"}}
|
||||
{{auto-close-form autoCloseTime=model.auto_close_time
|
||||
autoCloseValid=auto_close_valid
|
||||
autoCloseBasedOnLastPost=model.details.auto_close_based_on_last_post
|
||||
|
@ -10,7 +10,7 @@
|
|||
{{willCloseI18n}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/d-modal-body}}
|
||||
<div class="modal-footer">
|
||||
{{d-button class="btn-primary" disabled=disable_submit label="topic.auto_close_save" action="saveAutoClose"}}
|
||||
<a {{action "closeModal"}}>{{i18n 'cancel'}}</a>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<div class="modal-body">
|
||||
{{#d-modal-body title="raw_email.title" maxHeight="80%"}}
|
||||
{{#if rawEmail}}
|
||||
{{textarea value=rawEmail class="raw-email-textarea"}}
|
||||
{{else}}
|
||||
{{i18n 'raw_email.not_available'}}
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/d-modal-body}}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<div class="modal-body">
|
||||
{{#d-modal-body title="tagging.rename_tag"}}
|
||||
<label>
|
||||
<p>{{i18n "tagging.rename_instructions"}}</p>
|
||||
{{input value=buffered.id maxlength=siteSettings.max_tag_length}}
|
||||
</label>
|
||||
</div>
|
||||
{{/d-modal-body}}
|
||||
|
||||
<div class="modal-footer">
|
||||
{{d-button class="btn-primary"
|
|
@ -1,4 +1,4 @@
|
|||
<div id='move-selected' class="modal-body">
|
||||
{{#d-modal-body id="move-selected" title="topic.split_topic.title"}}
|
||||
{{{i18n 'topic.split_topic.instructions' count=selectedPostsCount}}}
|
||||
|
||||
<form>
|
||||
|
@ -8,8 +8,7 @@
|
|||
<label>{{i18n 'categories.category'}}</label>
|
||||
{{category-chooser value=categoryId}}
|
||||
</form>
|
||||
|
||||
</div>
|
||||
{{/d-modal-body}}
|
||||
|
||||
<div class="modal-footer">
|
||||
{{#d-button class="btn-primary" disabled=buttonDisabled action="movePostsToNewTopic"}}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<form>
|
||||
<div class='modal-body'>
|
||||
{{#d-modal-body title="admin.customize.import_title"}}
|
||||
{{json-file-uploader value=customizationFile extension=".dcstyle.json"}}
|
||||
</div>
|
||||
{{/d-modal-body}}
|
||||
<div class="modal-footer">
|
||||
{{d-button class='btn-primary' action='createCustomization' type='submit' disabled=notReady icon="plus" label='admin.customize.import'}}
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
<div class='container'>
|
||||
{{{model}}}
|
||||
</div>
|
|
@ -1,7 +0,0 @@
|
|||
import ModalBodyView from "discourse/views/modal-body";
|
||||
|
||||
export default ModalBodyView.extend({
|
||||
templateName: "modal/edit-topic-auto-close",
|
||||
title: I18n.t("topic.auto_close_title"),
|
||||
focusInput: false
|
||||
});
|
|
@ -16,6 +16,10 @@ export default Ember.View.extend({
|
|||
Em.run.next(() => $('.modal-header a.close').click());
|
||||
}
|
||||
});
|
||||
|
||||
this.appEvents.on('modal:body-shown', data => {
|
||||
this.set('controller.title', I18n.t(data.title));
|
||||
});
|
||||
},
|
||||
|
||||
@on("willDestroyElement")
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
import ModalBodyView from "discourse/views/modal-body";
|
||||
|
||||
export default ModalBodyView.extend({
|
||||
templateName: 'modal/raw-email',
|
||||
title: I18n.t('raw_email.title'),
|
||||
|
||||
resizeModal: function(){
|
||||
const viewPortHeight = $(window).height();
|
||||
this.$(".modal-body").css("max-height", Math.floor(0.8 * viewPortHeight) + "px");
|
||||
}.on("didInsertElement")
|
||||
});
|
|
@ -1,5 +0,0 @@
|
|||
import ModalBodyView from 'discourse/views/modal-body';
|
||||
|
||||
export default ModalBodyView.extend({
|
||||
title: I18n.t("tagging.rename_tag")
|
||||
});
|
|
@ -1,7 +0,0 @@
|
|||
import SelectedPostsCount from 'discourse/mixins/selected-posts-count';
|
||||
import ModalBodyView from "discourse/views/modal-body";
|
||||
|
||||
export default ModalBodyView.extend(SelectedPostsCount, {
|
||||
templateName: 'modal/split-topic',
|
||||
title: I18n.t('topic.split_topic.title')
|
||||
});
|
|
@ -1,9 +0,0 @@
|
|||
import { bufferedRender } from 'discourse-common/lib/buffered-render';
|
||||
|
||||
export default Ember.View.extend(bufferedRender({
|
||||
classNameBindings: [':container'],
|
||||
|
||||
buildBuffer(buffer) {
|
||||
buffer.push(this.get('controller.model'));
|
||||
}
|
||||
}));
|
|
@ -1,6 +0,0 @@
|
|||
import ModalBodyView from "discourse/views/modal-body";
|
||||
|
||||
export default ModalBodyView.extend({
|
||||
templateName: 'modal/upload-customization',
|
||||
title: I18n.t('admin.customize.import_title')
|
||||
});
|
Loading…
Reference in New Issue