mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 21:57:36 +08:00
UX: Combine closed and archived icon.
This commit is contained in:
parent
82148fc200
commit
d39cfe9068
|
@ -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');
|
||||
|
||||
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');
|
||||
|
|
|
@ -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'});
|
||||
}
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue
Block a user