Commit c11fdb04 authored by danielgrippi's avatar danielgrippi

put 'Admin' back in #user_menu for admins. this fixes #2595 [ci skip]

parent 46cffe3b
......@@ -80,7 +80,11 @@
- if current_user
:javascript
app.user({
current_user: _.extend(#{current_user.person.as_api_response(:backbone).to_json}, {notifications_count : #{@notification_count}, unread_messages_count : #{@unread_message_count}})
current_user: _.extend(#{current_user.person.as_api_response(:backbone).to_json}, {
notifications_count : #{@notification_count},
unread_messages_count : #{@unread_message_count},
admin : #{current_user.admin?}
})
});
= yield(:head)
......
......@@ -87,6 +87,9 @@
<li><a href="/people/<%= current_user.id %>"><%= Diaspora.I18n.t("header.profile") %></a></li>
<li><a href="/contacts"><%= Diaspora.I18n.t("header.contacts") %></a></li>
<li><a href="/user/edit"><%= Diaspora.I18n.t("header.settings") %></a></li>
<% if(current_user.admin) { %>
<li><a href="/admins/user_search"><%= Diaspora.I18n.t("header.admin") %></a></li>
<% } %>
<li><a href="/users/sign_out"><%= Diaspora.I18n.t("header.log_out") %></a></li>
</ul>
......
......@@ -107,6 +107,7 @@ en:
profile: "Profile"
contacts: "Contacts"
settings: "Settings"
admin: "Admin"
log_out: "Log out"
notifications: "Notifications"
......
......@@ -38,7 +38,6 @@ app.views.Content = app.views.StreamObject.extend({
return "<a href='/people/" + personId + "' class='mention'>" + fullName + "</a>"
})
return text
}
function urlify(text) {
......
......@@ -37,6 +37,20 @@ describe("app.views.Header", function() {
expect(this.view.$("#message_inbox_badge .badge_count").hasClass('hidden')).toBe(true);
})
})
context("admin link", function(){
it("displays if the current user is an admin", function(){
window.current_user = _.extend(window.current_user, {admin : true})
this.view.render();
expect(this.view.$("#user_menu").html()).toContain("/admins");
})
it("does not display if the current user is not an admin", function(){
window.current_user = _.extend(window.current_user, {admin : false})
this.view.render();
expect(this.view.$("#user_menu").html()).not.toContain("/admins");
})
})
})
describe("#toggleDropdown", function() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment