Add modal dialog for editing rules.
Currently non-functional, work in progress
This commit is contained in:
parent
d8e5494d4c
commit
e067f8611d
|
@ -1,14 +1,17 @@
|
||||||
import FilterRule from 'discourse/plugins/discourse-chat/admin/models/filter-rule'
|
import FilterRule from 'discourse/plugins/discourse-chat/admin/models/filter-rule'
|
||||||
import { ajax } from 'discourse/lib/ajax';
|
import { ajax } from 'discourse/lib/ajax';
|
||||||
import computed from "ember-addons/ember-computed-decorators";
|
import computed from "ember-addons/ember-computed-decorators";
|
||||||
|
import showModal from 'discourse/lib/show-modal';
|
||||||
|
|
||||||
|
|
||||||
export default Ember.Controller.extend({
|
export default Ember.Controller.extend({
|
||||||
filters: [
|
|
||||||
{ id: 'watch', name: I18n.t('chat.filter.watch'), icon: 'exclamation-circle' },
|
|
||||||
{ id: 'follow', name: I18n.t('chat.filter.follow'), icon: 'circle'},
|
|
||||||
{ id: 'mute', name: I18n.t('chat.filter.mute'), icon: 'times-circle' }
|
|
||||||
],
|
|
||||||
|
|
||||||
editing: FilterRule.create({}),
|
|
||||||
|
actions:{
|
||||||
|
edit(rule){
|
||||||
|
console.log(rule.hasDirtyAttributes);
|
||||||
|
showModal('admin-plugins-chat-edit-rule', { model: rule, admin: true });
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
|
@ -0,0 +1,15 @@
|
||||||
|
import FilterRule from 'discourse/plugins/discourse-chat/admin/models/filter-rule'
|
||||||
|
import { ajax } from 'discourse/lib/ajax';
|
||||||
|
|
||||||
|
export default Ember.Controller.extend({
|
||||||
|
|
||||||
|
model: FilterRule.create({}),
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
cancel: function(){
|
||||||
|
this.set('model', null);
|
||||||
|
this.set('workingCopy', null);
|
||||||
|
this.send('closeModal');
|
||||||
|
},
|
||||||
|
}
|
||||||
|
});
|
|
@ -3,6 +3,12 @@ import Category from 'discourse/models/category';
|
||||||
import computed from "ember-addons/ember-computed-decorators";
|
import computed from "ember-addons/ember-computed-decorators";
|
||||||
|
|
||||||
export default RestModel.extend({
|
export default RestModel.extend({
|
||||||
|
available_filters: [
|
||||||
|
{ id: 'watch', name: I18n.t('chat.filter.watch'), icon: 'exclamation-circle' },
|
||||||
|
{ id: 'follow', name: I18n.t('chat.filter.follow'), icon: 'circle'},
|
||||||
|
{ id: 'mute', name: I18n.t('chat.filter.mute'), icon: 'times-circle' }
|
||||||
|
],
|
||||||
|
|
||||||
category_id: null,
|
category_id: null,
|
||||||
provider: '',
|
provider: '',
|
||||||
channel: '',
|
channel: '',
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
{{#d-modal-body title="chat.edit_rule_modal_title"}}
|
||||||
|
|
||||||
|
|
||||||
|
<form class="form-horizontal">
|
||||||
|
<div>
|
||||||
|
<label for="category">{{i18n "chat.category"}}</label>
|
||||||
|
{{category-chooser
|
||||||
|
name="category"
|
||||||
|
value=model.categoryId
|
||||||
|
rootNoneLabel="slack.choose.all_categories"
|
||||||
|
rootNone=true}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{#if siteSettings.tagging_enabled}}
|
||||||
|
<div>
|
||||||
|
<label for="tags">{{i18n "chat.tags"}}</label>
|
||||||
|
{{tag-chooser name="tags" tags=model.tags placeholderKey="slack.choose.tags"}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label for="channel">{{i18n "chat.channel"}}</label>
|
||||||
|
{{text-field
|
||||||
|
name="channel"
|
||||||
|
value=model.channel
|
||||||
|
placeholderKey="slack.choose.channel"
|
||||||
|
class="channel"}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label for="filter">{{i18n "chat.filter"}}</label>
|
||||||
|
{{combo-box name="filter" content=model.available_filters value=model.filter}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
{{/d-modal-body}}
|
||||||
|
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button class='btn btn-primary' {{action "save"}} disabled={{submitDisabled}}>{{i18n 'chat.save'}}</button>
|
||||||
|
<a {{action "cancel"}}>{{i18n 'chat.cancel'}}</a>
|
||||||
|
</div>
|
|
@ -10,6 +10,7 @@ en:
|
||||||
delete: "Delete"
|
delete: "Delete"
|
||||||
test_notification: "Test Notification"
|
test_notification: "Test Notification"
|
||||||
reset_settings: "Reset Settings"
|
reset_settings: "Reset Settings"
|
||||||
|
edit_rule_modal_title: "Edit Rule"
|
||||||
integration:
|
integration:
|
||||||
telegram:
|
telegram:
|
||||||
title: "Telegram"
|
title: "Telegram"
|
||||||
|
|
Loading…
Reference in New Issue