UX: show short flag descriptions in the flag modal on mobile

This commit is contained in:
Neil Lalonde 2017-05-19 15:35:02 -04:00
parent 28f486cb7a
commit 0a8e16d049
5 changed files with 27 additions and 2 deletions

View File

@ -26,6 +26,11 @@ export default Ember.Component.extend({
showDescription: Em.computed.not('showMessageInput'), showDescription: Em.computed.not('showMessageInput'),
isNotifyUser: Em.computed.equal('flag.name_key', 'notify_user'), isNotifyUser: Em.computed.equal('flag.name_key', 'notify_user'),
@computed('flag.description', 'flag.short_description')
description(long_description, short_description) {
return this.site.mobileView ? short_description : long_description;
},
@computed('message.length') @computed('message.length')
customMessageLengthClasses(messageLength) { customMessageLengthClasses(messageLength) {
return (messageLength < Discourse.SiteSettings.min_private_message_post_length) ? "too-short" : "ok"; return (messageLength < Discourse.SiteSettings.min_private_message_post_length) ? "too-short" : "ok";

View File

@ -16,7 +16,7 @@
<label class='radio'> <label class='radio'>
<input type='radio' id="radio_{{unbound flag.name_key}}" {{action "changePostActionType" flag}} name='post_action_type_index'> <strong>{{formattedName}}</strong> <input type='radio' id="radio_{{unbound flag.name_key}}" {{action "changePostActionType" flag}} name='post_action_type_index'> <strong>{{formattedName}}</strong>
{{#if showDescription}} {{#if showDescription}}
<div class='description'>{{{flag.description}}}</div> <div class='description'>{{{description}}}</div>
{{/if}} {{/if}}
</label> </label>
{{#if showMessageInput}} {{#if showMessageInput}}

View File

@ -2,7 +2,7 @@ require_dependency 'configurable_urls'
class PostActionTypeSerializer < ApplicationSerializer class PostActionTypeSerializer < ApplicationSerializer
attributes :name_key, :name, :description, :long_form, :is_flag, :icon, :id, :is_custom_flag attributes :name_key, :name, :description, :short_description, :long_form, :is_flag, :icon, :id, :is_custom_flag
include ConfigurableUrls include ConfigurableUrls
@ -23,6 +23,10 @@ class PostActionTypeSerializer < ApplicationSerializer
i18n('description', {tos_url: tos_path}) i18n('description', {tos_url: tos_path})
end end
def short_description
i18n('short_description', {tos_url: tos_path})
end
protected protected
def i18n(field, vars=nil) def i18n(field, vars=nil)

View File

@ -639,40 +639,48 @@ en:
off_topic: off_topic:
title: 'Off-Topic' title: 'Off-Topic'
description: 'This post is not relevant to the current discussion as defined by the title and first post, and should probably be moved elsewhere.' description: 'This post is not relevant to the current discussion as defined by the title and first post, and should probably be moved elsewhere.'
short_description: 'Not relevant to the discussion'
long_form: 'flagged this as off-topic' long_form: 'flagged this as off-topic'
spam: spam:
title: 'Spam' title: 'Spam'
description: 'This post is an advertisement. It is not useful or relevant to the current topic, but promotional in nature.' description: 'This post is an advertisement. It is not useful or relevant to the current topic, but promotional in nature.'
short_description: 'This is an advertisement'
long_form: 'flagged this as spam' long_form: 'flagged this as spam'
email_title: '"%{title}" was flagged as spam' email_title: '"%{title}" was flagged as spam'
email_body: "%{link}\n\n%{message}" email_body: "%{link}\n\n%{message}"
inappropriate: inappropriate:
title: 'Inappropriate' title: 'Inappropriate'
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>.'
short_description: '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: 'Send @{{username}} a message' title: 'Send @{{username}} a message'
description: 'I want to talk to this person directly and privately about their post.' description: 'I want to talk to this person directly and privately about their post.'
short_description: 'I want to talk to this person directly and privately about their post.'
long_form: 'messaged user' long_form: 'messaged user'
email_title: 'Your post in "%{title}"' email_title: 'Your post in "%{title}"'
email_body: "%{link}\n\n%{message}" email_body: "%{link}\n\n%{message}"
notify_moderators: notify_moderators:
title: "Something Else" title: "Something Else"
description: 'This post requires staff attention for another reason not listed above.' description: 'This post requires staff attention for another reason not listed above.'
short_description: 'Requires staff attention for another reason'
long_form: 'flagged this for staff attention' long_form: 'flagged this for staff attention'
email_title: 'A post in "%{title}" requires staff attention' email_title: 'A post in "%{title}" requires staff attention'
email_body: "%{link}\n\n%{message}" email_body: "%{link}\n\n%{message}"
bookmark: bookmark:
title: 'Bookmark' title: 'Bookmark'
description: 'Bookmark this post' description: 'Bookmark this post'
short_description: 'Bookmark this post'
long_form: 'bookmarked this post' long_form: 'bookmarked this post'
like: like:
title: 'Like' title: 'Like'
description: 'Like this post' description: 'Like this post'
short_description: 'Like this post'
long_form: 'liked this' long_form: 'liked this'
vote: vote:
title: 'Vote' title: 'Vote'
description: 'Vote for this post' description: 'Vote for this post'
short_description: 'Vote for this post'
long_form: 'voted for this post' long_form: 'voted for this post'
user_activity: user_activity:

View File

@ -459,6 +459,7 @@ export default {
"name_key":"bookmark", "name_key":"bookmark",
"name":"Bookmark", "name":"Bookmark",
"description":"Bookmark this post", "description":"Bookmark this post",
"short_description":"Bookmark this post",
"long_form":"bookmarked this post", "long_form":"bookmarked this post",
"is_flag":false, "is_flag":false,
"icon":null, "icon":null,
@ -469,6 +470,7 @@ export default {
"name_key":"like", "name_key":"like",
"name":"Like", "name":"Like",
"description":"Like this post", "description":"Like this post",
"short_description":"Like this post",
"long_form":"liked this", "long_form":"liked this",
"is_flag":false, "is_flag":false,
"icon":"heart", "icon":"heart",
@ -479,6 +481,7 @@ export default {
"name_key":"off_topic", "name_key":"off_topic",
"name":"Off-Topic", "name":"Off-Topic",
"description":"This post is radically off-topic in the current topic, and should probably be moved. If this is a topic, perhaps it does not belong here.", "description":"This post is radically off-topic in the current topic, and should probably be moved. If this is a topic, perhaps it does not belong here.",
"short_description":"Not relevant to the discussion",
"long_form":"flagged this as off-topic", "long_form":"flagged this as off-topic",
"is_flag":true, "is_flag":true,
"icon":null, "icon":null,
@ -489,6 +492,7 @@ export default {
"name_key":"inappropriate", "name_key":"inappropriate",
"name":"Inappropriate", "name":"Inappropriate",
"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>.",
"short_description":'A violation of <a href="/guidelines">our community guidelines</a>',
"long_form":"flagged this as inappropriate", "long_form":"flagged this as inappropriate",
"is_flag":true, "is_flag":true,
"icon":null, "icon":null,
@ -499,6 +503,7 @@ export default {
"name_key":"vote", "name_key":"vote",
"name":"Vote", "name":"Vote",
"description":"Vote for this post", "description":"Vote for this post",
"short_description":'Vote for this post',
"long_form":"voted for this post", "long_form":"voted for this post",
"is_flag":false, "is_flag":false,
"icon":null, "icon":null,
@ -509,6 +514,7 @@ export default {
"name_key":"spam", "name_key":"spam",
"name":"Spam", "name":"Spam",
"description":"This post is an advertisement. It is not useful or relevant to the current topic, but promotional in nature.", "description":"This post is an advertisement. It is not useful or relevant to the current topic, but promotional in nature.",
"short_description":'This is an advertisement',
"long_form":"flagged this as spam", "long_form":"flagged this as spam",
"is_flag":true, "is_flag":true,
"icon":null, "icon":null,
@ -519,6 +525,7 @@ export default {
"name_key":"notify_user", "name_key":"notify_user",
"name":"Notify {{username}}", "name":"Notify {{username}}",
"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.",
"short_description":'I want to talk to this person directly and privately about their post.',
"long_form":"notified user", "long_form":"notified user",
"is_flag":true, "is_flag":true,
"icon":null, "icon":null,
@ -529,6 +536,7 @@ export default {
"name_key":"notify_moderators", "name_key":"notify_moderators",
"name":"Notify moderators", "name":"Notify moderators",
"description":"This post requires general moderator attention based on the <a href=\"/guidelines\">guidelines</a>, <a href=\"/tos\">TOS</a>, or for another reason not listed above.", "description":"This post requires general moderator attention based on the <a href=\"/guidelines\">guidelines</a>, <a href=\"/tos\">TOS</a>, or for another reason not listed above.",
"short_description":'Requires staff attention for another reason',
"long_form":"notified moderators", "long_form":"notified moderators",
"is_flag":true, "is_flag":true,
"icon":null, "icon":null,