mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 07:43:43 +08:00
Add title to user header. Refactor statusIcon
a bit.
This commit is contained in:
parent
6ee2849df6
commit
dba57a4a25
20
app/assets/javascripts/discourse/helpers/user-status.js.es6
Normal file
20
app/assets/javascripts/discourse/helpers/user-status.js.es6
Normal file
|
@ -0,0 +1,20 @@
|
|||
import registerUnbound from 'discourse/helpers/register-unbound';
|
||||
|
||||
var safe = Handlebars.SafeString;
|
||||
|
||||
registerUnbound('user-status', function(user) {
|
||||
if (!user) { return; }
|
||||
|
||||
var name = Handlebars.Utils.escapeExpression(user.get('name'));
|
||||
|
||||
if(Discourse.User.currentProp("admin") || Discourse.User.currentProp("moderator")) {
|
||||
if(user.get('admin')) {
|
||||
var adminDesc = I18n.t('user.admin', {user: name});
|
||||
return new safe('<i class="fa fa-shield" title="' + adminDesc + '" alt="' + adminDesc + '"></i>');
|
||||
}
|
||||
}
|
||||
if(user.get('moderator')){
|
||||
var modDesc = I18n.t('user.moderator', {user: name});
|
||||
return new safe('<i class="fa fa-shield" title="' + modDesc + '" alt="' + modDesc + '"></i>');
|
||||
}
|
||||
});
|
|
@ -78,23 +78,6 @@ Discourse.User = Discourse.Model.extend({
|
|||
return 'background-image: url(' + background + ')';
|
||||
}.property('profile_background'),
|
||||
|
||||
statusIcon: function() {
|
||||
var name = Handlebars.Utils.escapeExpression(this.get('name')),
|
||||
desc;
|
||||
|
||||
if(Discourse.User.currentProp("admin") || Discourse.User.currentProp("moderator")) {
|
||||
if(this.get('admin')) {
|
||||
desc = I18n.t('user.admin', {user: name});
|
||||
return '<i class="fa fa-shield" title="' + desc + '" alt="' + desc + '"></i>';
|
||||
}
|
||||
}
|
||||
if(this.get('moderator')){
|
||||
desc = I18n.t('user.moderator', {user: name});
|
||||
return '<i class="fa fa-shield" title="' + desc + '" alt="' + desc + '"></i>';
|
||||
}
|
||||
return null;
|
||||
}.property('admin','moderator'),
|
||||
|
||||
/**
|
||||
Path to this user.
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<div class="names">
|
||||
<span>
|
||||
<h1 {{bind-attr class="staff new_user"}}>
|
||||
{{#link-to 'user' user}}{{username}}{{{user.statusIcon}}}{{/link-to}}
|
||||
{{#link-to 'user' user}}{{username}} {{user-status user}}{{/link-to}}
|
||||
</h1>
|
||||
|
||||
{{#if user.name}}
|
||||
|
|
|
@ -60,8 +60,11 @@
|
|||
</section>
|
||||
|
||||
<div class="primary-textual">
|
||||
<h1>{{username}} {{{statusIcon}}}</h1>
|
||||
<h1>{{username}} {{user-status model}}</h1>
|
||||
<h2>{{name}}</h2>
|
||||
{{#if title}}
|
||||
<h3>{{title}}</h3>
|
||||
{{/if}}
|
||||
<h3>
|
||||
{{#if location}}{{fa-icon "map-maker"}}{{location}}{{/if}}
|
||||
{{#if websiteName}}
|
||||
|
|
Loading…
Reference in New Issue
Block a user