mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-24 08:09:13 -05:00
FIX: Topic Status Icons had weird margins after font awesome update
This commit is contained in:
parent
4540a51a8f
commit
eba662b988
4 changed files with 22 additions and 35 deletions
|
@ -8,14 +8,14 @@
|
||||||
**/
|
**/
|
||||||
Discourse.Archetype = Discourse.Model.extend({
|
Discourse.Archetype = Discourse.Model.extend({
|
||||||
|
|
||||||
hasOptions: function() {
|
hasOptions: Em.computed.gt('options.length', 0),
|
||||||
if (!this.get('options')) return false;
|
|
||||||
return this.get('options').length > 0;
|
|
||||||
}.property('options.@each'),
|
|
||||||
|
|
||||||
isDefault: function() {
|
site: function() {
|
||||||
return this.get('id') === Discourse.Site.instance().get('default_archetype');
|
return Discourse.Site.instance();
|
||||||
}.property('id')
|
}.property(),
|
||||||
|
|
||||||
|
isDefault: Discourse.computed.propertyEqual('id', 'site.default_archetype'),
|
||||||
|
notDefault: Em.computed.not('isDefault')
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,8 @@ Discourse.Topic = Discourse.Model.extend({
|
||||||
return Discourse.TopicDetails.create({topic: this});
|
return Discourse.TopicDetails.create({topic: this});
|
||||||
}.property(),
|
}.property(),
|
||||||
|
|
||||||
|
invisible: Em.computed.not('visible'),
|
||||||
|
|
||||||
canConvertToRegular: function() {
|
canConvertToRegular: function() {
|
||||||
var a = this.get('archetype');
|
var a = this.get('archetype');
|
||||||
return a !== 'regular' && a !== 'private_message';
|
return a !== 'regular' && a !== 'private_message';
|
||||||
|
@ -130,9 +132,7 @@ Discourse.Topic = Discourse.Model.extend({
|
||||||
return Discourse.Site.instance().get('archetypes').findProperty('id', this.get('archetype'));
|
return Discourse.Site.instance().get('archetypes').findProperty('id', this.get('archetype'));
|
||||||
}.property('archetype'),
|
}.property('archetype'),
|
||||||
|
|
||||||
isPrivateMessage: (function() {
|
isPrivateMessage: Em.computed.equal('archetype', 'private_message'),
|
||||||
return this.get('archetype') === 'private_message';
|
|
||||||
}).property('archetype'),
|
|
||||||
|
|
||||||
toggleStatus: function(property) {
|
toggleStatus: function(property) {
|
||||||
this.toggleProperty(property);
|
this.toggleProperty(property);
|
||||||
|
|
|
@ -9,38 +9,25 @@
|
||||||
Discourse.TopicStatusView = Discourse.View.extend({
|
Discourse.TopicStatusView = Discourse.View.extend({
|
||||||
classNames: ['topic-statuses'],
|
classNames: ['topic-statuses'],
|
||||||
|
|
||||||
hasDisplayableStatus: function() {
|
hasDisplayableStatus: Em.computed.or('topic.closed', 'topic.pinned', 'topic.invisible', 'topic.archetypeObject.notDefault'),
|
||||||
if (this.get('topic.closed')) return true;
|
|
||||||
if (this.get('topic.pinned')) return true;
|
|
||||||
if (!this.get('topic.archetype.isDefault')) return true;
|
|
||||||
if (!this.get('topic.visible')) return true;
|
|
||||||
return false;
|
|
||||||
}.property('topic.closed', 'topic.pinned', 'topic.visible'),
|
|
||||||
|
|
||||||
shouldRerender: Discourse.View.renderIfChanged('topic.closed', 'topic.pinned', 'topic.visible'),
|
shouldRerender: Discourse.View.renderIfChanged('topic.closed', 'topic.pinned', 'topic.visible'),
|
||||||
|
|
||||||
renderIcon: function(buffer, name, key) {
|
|
||||||
var title = I18n.t("topic_statuses." + key + ".help");
|
|
||||||
return buffer.push("<span title='" + title + "' class='topic-status'><i class='icon icon-" + name + "'></i></span>");
|
|
||||||
},
|
|
||||||
|
|
||||||
render: function(buffer) {
|
render: function(buffer) {
|
||||||
if (!this.get('hasDisplayableStatus')) { return; }
|
if (!this.get('hasDisplayableStatus')) { return; }
|
||||||
|
|
||||||
|
var topicStatusView = this;
|
||||||
|
var renderIconIf = function(conditionProp, name, key) {
|
||||||
|
if (!topicStatusView.get(conditionProp)) { return; }
|
||||||
|
var title = I18n.t("topic_statuses." + key + ".help");
|
||||||
|
buffer.push("<span title='" + title + "' class='topic-status'><i class='icon icon-" + name + "'></i></span>");
|
||||||
|
};
|
||||||
|
|
||||||
// Allow a plugin to add a custom icon to a topic
|
// Allow a plugin to add a custom icon to a topic
|
||||||
this.trigger('addCustomIcon', buffer);
|
this.trigger('addCustomIcon', buffer);
|
||||||
|
|
||||||
if (this.get('topic.closed')) {
|
renderIconIf('topic.closed', 'lock', 'locked');
|
||||||
this.renderIcon(buffer, 'lock', 'locked');
|
renderIconIf('topic.pinned', 'pushpin', 'pinned');
|
||||||
}
|
renderIconIf('topic.invisible', 'eye-close', 'invisible');
|
||||||
|
|
||||||
if (this.get('topic.pinned')) {
|
|
||||||
this.renderIcon(buffer, 'pushpin', 'pinned');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.get('topic.visible')) {
|
|
||||||
this.renderIcon(buffer, 'eye-close', 'invisible');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
}
|
}
|
||||||
> .icon {
|
> .icon {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-top: 8px;
|
margin-top: 2px;
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue