Merge pull request #3712 from tgxworld/combine_double_lock_icon

UX: Combine closed and archived icon.
This commit is contained in:
Sam 2015-08-31 12:14:27 +10:00
commit 14a15491a4
3 changed files with 22 additions and 11 deletions

View File

@ -28,21 +28,30 @@ export default Ember.Component.extend(StringBuffer, {
renderString(buffer) {
const self = this;
const renderIconIf = function(conditionProp, name, key, actionable) {
if (!self.get(conditionProp)) { return; }
const title = Handlebars.Utils.escapeExpression(I18n.t("topic_statuses." + key + ".help")),
const renderIcon = function(name, key, actionable) {
const title = Handlebars.Utils.escapeExpression(I18n.t(`topic_statuses.${key}.help`)),
startTag = actionable ? "a href" : "span",
endTag = actionable ? "a" : "span",
iconArgs = key === 'unpinned' ? { 'class': 'unpinned' } : null,
icon = iconHTML(name, iconArgs);
buffer.push("<" + startTag + " title='" + title + "' class='topic-status'>" + icon + "</" + endTag + ">");
buffer.push(`<${startTag} title='${title}' class='topic-status'>${icon}</${endTag}>`);
};
const renderIconIf = function(conditionProp, name, key, actionable) {
if (!self.get(conditionProp)) { return; }
renderIcon(name, key, actionable);
};
renderIconIf('topic.is_warning', 'envelope', 'warning');
renderIconIf('topic.closed', 'lock', 'locked');
renderIconIf('topic.archived', 'lock', 'archived');
if (this.get('topic.closed') && this.get('topic.archived')) {
renderIcon('lock', 'locked_and_archived');
} else {
renderIconIf('topic.closed', 'lock', 'locked');
renderIconIf('topic.archived', 'lock', 'archived');
}
renderIconIf('topic.pinned', 'thumb-tack', 'pinned', this.get("canAct") );
renderIconIf('topic.unpinned', 'thumb-tack', 'unpinned', this.get("canAct"));
renderIconIf('topic.invisible', 'eye-slash', 'invisible');

View File

@ -26,11 +26,11 @@ export default Ember.Object.extend({
results.push({extraClasses: extraClasses, icon: 'bookmark', key: 'bookmarked', href: url});
}
if(topic.get('closed')){
if (topic.get('closed') && topic.get('archived')) {
results.push({icon: 'lock', key: 'locked_and_archived'});
} else if(topic.get('closed')){
results.push({icon: 'lock', key: 'locked'});
}
if(topic.get('archived')){
} else if(topic.get('archived')){
results.push({icon: 'lock', key: 'archived'});
}

View File

@ -1593,6 +1593,8 @@ en:
help: "This topic is closed; it no longer accepts new replies"
archived:
help: "This topic is archived; it no longer accepts new replies"
locked_and_archived:
help: "This topic is closed and archived; it no longer accepts new replies"
unpinned:
title: "Unpinned"
help: "This topic is unpinned for you; it will display in regular order"