mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Merge pull request #1937 from verg/user_dropdown
Add User Avatar Dropdown
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
Discourse.UserDropdownController = Ember.ArrayController.extend(Discourse.HasCurrentUser, {
|
||||
showAdminLinks: Em.computed.alias("currentUser.staff"),
|
||||
|
||||
actions: {
|
||||
logout: function() {
|
||||
Discourse.logout();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -89,9 +89,16 @@
|
||||
<a href='/admin/flags/active' title='{{i18n notifications.total_flagged}}' class='badge-notification flagged-posts'>{{currentUser.site_flagged_posts_count}}</a>
|
||||
{{/if}}
|
||||
</li>
|
||||
<li class='current-user'>
|
||||
<li class='current-user dropdown'>
|
||||
{{#if currentUser}}
|
||||
{{#titledLinkTo 'userActivity.index' currentUser titleKey="current_user" class="icon"}}{{boundAvatar currentUser imageSize="medium" }}{{/titledLinkTo}}
|
||||
<a class='icon'
|
||||
data-dropdown="user-dropdown"
|
||||
data-render="renderUserDropdown"
|
||||
href="#"
|
||||
title='{{i18n user.avatar.title}}'
|
||||
id="current-user">
|
||||
{{boundAvatar currentUser imageSize="medium" }}
|
||||
</a>
|
||||
{{else}}
|
||||
<div class="icon not-logged-in-avatar" {{action showLogin}}><i class='fa fa-user' title='{{i18n not_logged_in_user}}'></i></div>
|
||||
{{/if}}
|
||||
@@ -106,6 +113,8 @@
|
||||
{{render siteMap}}
|
||||
{{/if}}
|
||||
|
||||
{{ render userDropdown }}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<section class='d-dropdown' id='user-dropdown'>
|
||||
<ul class='user-dropdown-links'>
|
||||
<li>{{#link-to 'userActivity' currentUser class="user-activity-link" }}{{i18n activity}}{{/link-to}}</li>
|
||||
{{#if showAdminLinks}}
|
||||
<li>{{#link-to 'adminUser' currentUser.username }}{{i18n admin_title}}{{/link-to}}</li>
|
||||
{{/if}}
|
||||
<li>{{#link-to 'userPrivateMessages.index' currentUser}}{{i18n user.private_messages}}{{/link-to}}</li>
|
||||
<li>{{#link-to 'preferences' currentUser}}{{i18n user.preferences}}{{/link-to}}</li>
|
||||
<li><button {{action "logout"}} class='btn btn-danger right logout'><i class='fa fa-sign-out'></i>{{i18n user.log_out}}</button></li>
|
||||
</ul>
|
||||
</section>
|
||||
@@ -237,4 +237,16 @@
|
||||
background-color: transparent;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
&#user-dropdown {
|
||||
width: 154px;
|
||||
}
|
||||
|
||||
.btn {
|
||||
padding: 2px 8px;
|
||||
margin-bottom: 2px;
|
||||
.fa {
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,4 +240,14 @@
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
&#user-dropdown {
|
||||
width: 154px;
|
||||
}
|
||||
|
||||
.btn {
|
||||
padding: 2px 8px;
|
||||
.fa {
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user