Tidy up admin user interface
This commit is contained in:
parent
0547543a1d
commit
444e380ca1
|
@ -1,49 +1,84 @@
|
||||||
{{#d-modal-body title="chat_integration.edit_rule_modal.title"}}
|
{{#d-modal-body id="chat_integration_edit_rule_modal" title="chat_integration.edit_rule_modal.title"}}
|
||||||
|
<div>
|
||||||
|
<form>
|
||||||
|
<table>
|
||||||
|
|
||||||
|
<tr class="input">
|
||||||
|
<td class="label"><label for='provider'>{{i18n "chat_integration.edit_rule_modal.provider"}}</label></td>
|
||||||
|
<td>
|
||||||
|
{{i18n (concat 'chat_integration.provider.' model.provider '.title')}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="instructions">
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<form class="form-horizontal">
|
<tr class="input">
|
||||||
<div>
|
<td class="label"><label for='channel'>{{i18n "chat_integration.edit_rule_modal.channel"}}</label></td>
|
||||||
{{i18n 'chat_integration.edit_rule_modal.provider'}}: {{i18n (concat 'chat_integration.provider.' model.provider '.title')}}
|
<td>
|
||||||
</div>
|
{{text-field
|
||||||
<div>
|
name="channel"
|
||||||
<label for="category">{{i18n "chat_integration.edit_rule_modal.category"}}</label>
|
value=model.channel
|
||||||
{{category-chooser
|
autofocus="autofocus"
|
||||||
name="category"
|
id="channel-field"}}
|
||||||
value=model.category_id
|
</td>
|
||||||
rootNoneLabel="slack.choose.all_categories"
|
</tr>
|
||||||
rootNone=true
|
<tr class="instructions">
|
||||||
allowUncategorized="true"
|
<td></td>
|
||||||
}}
|
<td><label>{{i18n (concat 'chat_integration.provider.' model.provider '.channel_instructions')}}</label></td>
|
||||||
</div>
|
</tr>
|
||||||
|
|
||||||
{{#if siteSettings.tagging_enabled}}
|
<tr class="input">
|
||||||
<div>
|
<td class="label"><label for='filter'>{{i18n "chat_integration.edit_rule_modal.filter"}}</label></td>
|
||||||
<label for="tags">{{i18n "chat_integration.edit_rule_modal.tags"}}</label>
|
<td>
|
||||||
{{tag-chooser name="tags" tags=model.tags placeholderKey="chat_integration.edit_rule_modal.placeholders.tags"}}
|
{{combo-box name="filter" content=model.available_filters value=model.filter}}
|
||||||
</div>
|
</td>
|
||||||
{{/if}}
|
</tr>
|
||||||
|
<tr class="instructions">
|
||||||
|
<td></td>
|
||||||
|
<td><label>{{i18n 'chat_integration.edit_rule_modal.instructions.filter'}}</label></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<div>
|
<tr class="input">
|
||||||
<label for="channel">{{i18n "chat_integration.edit_rule_modal.channel"}}</label>
|
<td class="label"><label for='category'>{{i18n "chat_integration.edit_rule_modal.category"}}</label></td>
|
||||||
{{text-field
|
<td>
|
||||||
name="channel"
|
{{category-chooser
|
||||||
value=model.channel
|
name="category"
|
||||||
placeholderKey="chat_integration.edit_rule_modal.placeholders.channel"
|
value=model.category_id
|
||||||
class="channel"}}
|
rootNoneLabel="chat_integration.all_categories"
|
||||||
</div>
|
rootNone=true
|
||||||
|
overrideWidths=false
|
||||||
|
}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="instructions">
|
||||||
|
<td></td>
|
||||||
|
<td><label>{{i18n 'chat_integration.edit_rule_modal.instructions.category'}}</label></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<div>
|
{{#if siteSettings.tagging_enabled}}
|
||||||
<label for="filter">{{i18n "chat_integration.edit_rule_modal.filter"}}</label>
|
<tr class="input">
|
||||||
{{combo-box name="filter" content=model.available_filters value=model.filter}}
|
<td class="label"><label for='tags'>{{i18n "chat_integration.edit_rule_modal.tags"}}</label></td>
|
||||||
</div>
|
<td>
|
||||||
|
{{tag-chooser placeholderKey="chat_integration.all_tags" name="tags" tags=model.tags}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="instructions">
|
||||||
|
<td></td>
|
||||||
|
<td><label>{{i18n 'chat_integration.edit_rule_modal.instructions.tags'}}</label></td>
|
||||||
|
</tr>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
</form>
|
</table>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
{{/d-modal-body}}
|
{{/d-modal-body}}
|
||||||
|
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
{{d-button class='btn-primary' action="save" title="chat_integration.edit_rule_modal.save" label="chat_integration.edit_rule_modal.save"}}
|
{{d-button class='btn-primary btn-large' action="save" title="chat_integration.edit_rule_modal.save" label="chat_integration.edit_rule_modal.save"}}
|
||||||
|
|
||||||
{{d-button action="cancel" title="chat_integration.edit_rule_modal.cancel" label="chat_integration.edit_rule_modal.cancel"}}
|
{{d-button class="btn-large" action="cancel" title="chat_integration.edit_rule_modal.cancel" label="chat_integration.edit_rule_modal.cancel"}}
|
||||||
|
|
||||||
</div>
|
</div>
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
{{#each model.rules as |rule|}}
|
{{#each model.rules as |rule|}}
|
||||||
|
|
||||||
<tr class="">
|
<tr>
|
||||||
<td>{{rule.channel}}</td>
|
<td>{{rule.channel}}</td>
|
||||||
<td>{{rule.filterName}}</td>
|
<td>{{rule.filterName}}</td>
|
||||||
|
|
||||||
|
@ -32,7 +32,13 @@
|
||||||
|
|
||||||
|
|
||||||
{{#if siteSettings.tagging_enabled}}
|
{{#if siteSettings.tagging_enabled}}
|
||||||
<td>{{rule.tags}}</td>
|
<td>
|
||||||
|
{{#if rule.tags}}
|
||||||
|
{{rule.tags}}
|
||||||
|
{{else}}
|
||||||
|
{{i18n "chat_integration.all_tags"}}
|
||||||
|
{{/if}}
|
||||||
|
</td>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,7 +51,7 @@
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<div>
|
<div class="table-footer">
|
||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
{{d-button action="create" actionParam=model.provider icon="plus" title="chat_integration.create_rule" label="chat_integration.create_rule"}}
|
{{d-button action="create" actionParam=model.provider icon="plus" title="chat_integration.create_rule" label="chat_integration.create_rule"}}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
#admin-plugin-chat{
|
||||||
|
|
||||||
|
table{
|
||||||
|
td:last-child{
|
||||||
|
white-space:nowrap;
|
||||||
|
}
|
||||||
|
td:not(:last-child){
|
||||||
|
width: 25%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
div.table-footer{
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#chat_integration_edit_rule_modal{
|
||||||
|
table{
|
||||||
|
width:100%;
|
||||||
|
|
||||||
|
tr.input td{
|
||||||
|
padding-top: 10px;
|
||||||
|
|
||||||
|
&.label{
|
||||||
|
width: 100px;
|
||||||
|
label{
|
||||||
|
margin-bottom: 0px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tr.instructions label{
|
||||||
|
color: dark-light-choose(scale-color($primary, $lightness: 50%), scale-color($secondary, $lightness: 50%));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
input{
|
||||||
|
width: 200px;
|
||||||
|
margin-bottom: 0px;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
.tag-chooser{
|
||||||
|
ul.select2-choices{
|
||||||
|
border: none;
|
||||||
|
background:none;
|
||||||
|
}
|
||||||
|
margin-bottom: 0px;
|
||||||
|
margin-top: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -4,19 +4,20 @@ en:
|
||||||
menu_title: "Chat Integrations"
|
menu_title: "Chat Integrations"
|
||||||
settings: "Settings"
|
settings: "Settings"
|
||||||
no_providers: "You need to enable some providers in the plugin settings"
|
no_providers: "You need to enable some providers in the plugin settings"
|
||||||
all_categories: "All Categories"
|
all_categories: "(all categories)"
|
||||||
|
all_tags: "(all tags)"
|
||||||
create_rule: "Create Rule"
|
create_rule: "Create Rule"
|
||||||
|
filter:
|
||||||
|
mute: 'Mute'
|
||||||
|
follow: 'First post only'
|
||||||
|
watch: 'All posts and replies'
|
||||||
rule_table:
|
rule_table:
|
||||||
channel: "Channel"
|
channel: "Channel"
|
||||||
filter: "Filter"
|
filter: "Filter"
|
||||||
category: "Category"
|
category: "Category"
|
||||||
tags: "Tags"
|
tags: "Tags"
|
||||||
edit: "Edit"
|
edit_rule: "Edit"
|
||||||
delete: "Delete"
|
delete_rule: "Delete"
|
||||||
filter:
|
|
||||||
watch: "Watch"
|
|
||||||
follow: "Follow"
|
|
||||||
mute: "Mute"
|
|
||||||
edit_rule_modal:
|
edit_rule_modal:
|
||||||
title: "Edit Rule"
|
title: "Edit Rule"
|
||||||
save: "Save Rule"
|
save: "Save Rule"
|
||||||
|
@ -26,11 +27,23 @@ en:
|
||||||
tags: "Tags"
|
tags: "Tags"
|
||||||
channel: "Channel"
|
channel: "Channel"
|
||||||
filter: "Filter"
|
filter: "Filter"
|
||||||
placeholders:
|
instructions:
|
||||||
tags: "Choose tags"
|
filter: "Notification level. Mute overrides other matching rules."
|
||||||
channel: "#channel, @user or Channel ID"
|
category: "This rule will only apply to topics in the specified category."
|
||||||
|
tags: "If specified, this rule will only apply to topics which have at least one of these tags."
|
||||||
|
|
||||||
provider:
|
provider:
|
||||||
telegram:
|
|
||||||
title: "Telegram"
|
#######################################
|
||||||
|
########### SLACK STRINGS #############
|
||||||
|
#######################################
|
||||||
slack:
|
slack:
|
||||||
title: "Slack"
|
title: "Slack"
|
||||||
|
channel_instructions: "e.g. #channel, @username."
|
||||||
|
|
||||||
|
#######################################
|
||||||
|
########## TELEGRAM STRINGS ###########
|
||||||
|
#######################################
|
||||||
|
telegram:
|
||||||
|
title: "Telegram"
|
||||||
|
channel_instructions: "Enter a chat_id. You will need to add the bot to the chat first."
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
# Similar to an ActiveRecord class, but uses PluginStore for storage instead. Adapted from discourse-data-explorer
|
# Similar to an ActiveRecord class, but uses PluginStore for storage instead. Adapted from discourse-data-explorer
|
||||||
# Using this means we can use a standard serializer for sending JSON to the client, and also have convenient save/update/delete methods
|
# Using this means we can use a standard serializer for sending JSON to the client, and also have convenient save/update/delete methods
|
||||||
# Since this is now being used in two plugins, maybe it should be built into core somehow
|
# Since this is now being used in two plugins, maybe it should be built into core somehow
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
|
|
||||||
enabled_site_setting :chat_integration_enabled
|
enabled_site_setting :chat_integration_enabled
|
||||||
|
|
||||||
|
register_asset "stylesheets/chat-integration-admin.scss"
|
||||||
|
|
||||||
# Site setting validators must be loaded before initialize
|
# Site setting validators must be loaded before initialize
|
||||||
require_relative "lib/validators/chat_integration_slack_enabled_setting_validator"
|
require_relative "lib/validators/chat_integration_slack_enabled_setting_validator"
|
||||||
|
|
||||||
|
@ -82,6 +84,9 @@ after_initialize do
|
||||||
raise Discourse::NotFound
|
raise Discourse::NotFound
|
||||||
end
|
end
|
||||||
|
|
||||||
|
filter_order = ["watch", "follow", "mute"]
|
||||||
|
rules = rules.sort_by{ |r| [r.channel, filter_order.index(r.filter), r.category_id] }
|
||||||
|
|
||||||
render_serialized rules, DiscourseChat::RuleSerializer, root: 'rules'
|
render_serialized rules, DiscourseChat::RuleSerializer, root: 'rules'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue