mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
UX: better flagging options
This commit is contained in:
parent
8104a07327
commit
bb1d0dea8a
@ -24,6 +24,7 @@ export default Ember.Controller.extend({
|
|||||||
|
|
||||||
showMessageInput: Em.computed.and('model.is_custom_flag', 'selected'),
|
showMessageInput: Em.computed.and('model.is_custom_flag', 'selected'),
|
||||||
showDescription: Em.computed.not('showMessageInput'),
|
showDescription: Em.computed.not('showMessageInput'),
|
||||||
|
isNotifyUser: Em.computed.equal('model.name_key', 'notify_user'),
|
||||||
|
|
||||||
customMessageLengthClasses: function() {
|
customMessageLengthClasses: function() {
|
||||||
return (this.get('message.length') < Discourse.SiteSettings.min_private_message_post_length) ? "too-short" : "ok";
|
return (this.get('message.length') < Discourse.SiteSettings.min_private_message_post_length) ? "too-short" : "ok";
|
||||||
@ -44,4 +45,3 @@ export default Ember.Controller.extend({
|
|||||||
}.property('message.length')
|
}.property('message.length')
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -14,8 +14,19 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||||||
|
|
||||||
flagsAvailable: function() {
|
flagsAvailable: function() {
|
||||||
if (!this.get('flagTopic')) {
|
if (!this.get('flagTopic')) {
|
||||||
return this.get('model.flagsAvailable');
|
// flagging post
|
||||||
|
let flagsAvailable = this.get('model.flagsAvailable');
|
||||||
|
|
||||||
|
// "message user" option should be at the top
|
||||||
|
const notifyUserIndex = flagsAvailable.indexOf(flagsAvailable.filterProperty('name_key', 'notify_user')[0]);
|
||||||
|
if (notifyUserIndex !== -1) {
|
||||||
|
const notifyUser = flagsAvailable[notifyUserIndex];
|
||||||
|
flagsAvailable.splice(notifyUserIndex, 1);
|
||||||
|
flagsAvailable.splice(0, 0, notifyUser);
|
||||||
|
}
|
||||||
|
return flagsAvailable;
|
||||||
} else {
|
} else {
|
||||||
|
// flagging topic
|
||||||
const self = this,
|
const self = this,
|
||||||
lookup = Em.Object.create();
|
lookup = Em.Object.create();
|
||||||
|
|
||||||
@ -35,6 +46,10 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||||||
}
|
}
|
||||||
}.property('post', 'flagTopic', 'model.actions_summary.@each.can_act'),
|
}.property('post', 'flagTopic', 'model.actions_summary.@each.can_act'),
|
||||||
|
|
||||||
|
staffFlagsAvailable: function() {
|
||||||
|
return (this.get('model.flagsAvailable').length > 1);
|
||||||
|
}.property('post', 'flagTopic', 'model.actions_summary.@each.can_act'),
|
||||||
|
|
||||||
submitEnabled: function() {
|
submitEnabled: function() {
|
||||||
const selected = this.get('selected');
|
const selected = this.get('selected');
|
||||||
if (!selected) return false;
|
if (!selected) return false;
|
||||||
|
@ -2,18 +2,33 @@
|
|||||||
|
|
||||||
<form>
|
<form>
|
||||||
{{#each f in flagsAvailable itemController="flag-action-type"}}
|
{{#each f in flagsAvailable itemController="flag-action-type"}}
|
||||||
<div class='controls'>
|
{{#if f.isNotifyUser}}
|
||||||
<label class='radio'>
|
<h3>{{f.formattedName}}</h3>
|
||||||
<input type='radio' id="radio_{{unbound f.model.name_key}}" {{action "changePostActionType" f}} name='post_action_type_index'> <strong>{{f.formattedName}}</strong>
|
<div class='controls'>
|
||||||
{{#if f.showDescription}}
|
<label class='radio'><input type='radio' id="radio_{{unbound f.model.name_key}}" {{action "changePostActionType" f}} name='post_action_type_index'> <div class='description'>{{{f.model.description}}}</div></label>
|
||||||
<div class='description'>{{{f.model.description}}}</div>
|
{{#if f.showMessageInput}}
|
||||||
|
{{textarea name="message" class="flag-message" placeholder=f.customPlaceholder value=f.message}}
|
||||||
|
<div {{bind-attr class=":custom-message-length f.customMessageLengthClasses"}}>{{f.customMessageLength}}</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</label>
|
</div>
|
||||||
{{#if f.showMessageInput}}
|
{{#if staffFlagsAvailable}}
|
||||||
{{textarea name="message" class="flag-message" placeholder=f.customPlaceholder value=f.message}}
|
<hr>
|
||||||
<div {{bind-attr class=":custom-message-length f.customMessageLengthClasses"}}>{{f.customMessageLength}}</div>
|
<h3>{{i18n 'flagging.notify_staff'}}</h3>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
{{else}}
|
||||||
|
<div class='controls'>
|
||||||
|
<label class='radio'>
|
||||||
|
<input type='radio' id="radio_{{unbound f.model.name_key}}" {{action "changePostActionType" f}} name='post_action_type_index'> <strong>{{f.formattedName}}</strong>
|
||||||
|
{{#if f.showDescription}}
|
||||||
|
<div class='description'>{{{f.model.description}}}</div>
|
||||||
|
{{/if}}
|
||||||
|
</label>
|
||||||
|
{{#if f.showMessageInput}}
|
||||||
|
{{textarea name="message" class="flag-message" placeholder=f.customPlaceholder value=f.message}}
|
||||||
|
<div {{bind-attr class=":custom-message-length f.customMessageLengthClasses"}}>{{f.customMessageLength}}</div>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{i18n 'flagging.cant'}}
|
{{i18n 'flagging.cant'}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
@ -1627,6 +1627,7 @@ en:
|
|||||||
submit_tooltip: "Submit the private flag"
|
submit_tooltip: "Submit the private flag"
|
||||||
take_action_tooltip: "Reach the flag threshold immediately, rather than waiting for more community flags"
|
take_action_tooltip: "Reach the flag threshold immediately, rather than waiting for more community flags"
|
||||||
cant: "Sorry, you can't flag this post at this time."
|
cant: "Sorry, you can't flag this post at this time."
|
||||||
|
notify_staff: 'Notify Staff'
|
||||||
formatted_name:
|
formatted_name:
|
||||||
off_topic: "It's Off-Topic"
|
off_topic: "It's Off-Topic"
|
||||||
inappropriate: "It's Inappropriate"
|
inappropriate: "It's Inappropriate"
|
||||||
|
@ -513,7 +513,7 @@ en:
|
|||||||
description: 'This post contains content that a reasonable person would consider offensive, abusive, or a violation of <a href="/guidelines">our community guidelines</a>.'
|
description: 'This post contains content that a reasonable person would consider offensive, abusive, or a violation of <a href="/guidelines">our community guidelines</a>.'
|
||||||
long_form: 'flagged this as inappropriate'
|
long_form: 'flagged this as inappropriate'
|
||||||
notify_user:
|
notify_user:
|
||||||
title: 'Message @{{username}}'
|
title: 'Contact @{{username}} via private message'
|
||||||
description: 'This post contains something I want to talk to this person directly and privately about. Does not cast a flag.'
|
description: 'This post contains something I want to talk to this person directly and privately about. Does not cast a flag.'
|
||||||
long_form: 'messaged user'
|
long_form: 'messaged user'
|
||||||
email_title: 'Your post in "%{title}"'
|
email_title: 'Your post in "%{title}"'
|
||||||
|
Loading…
Reference in New Issue
Block a user