Skip to content

Commit

Permalink
Add change password link to user util menu
Browse files Browse the repository at this point in the history
  • Loading branch information
mjgiarlo committed Jun 10, 2017
1 parent d973e0f commit 11f0d1d
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
30 changes: 30 additions & 0 deletions app/views/_user_util_links.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<ul id="user_utility_links" class="nav navbar-nav navbar-right">
<%= render 'shared/locale_picker' if available_translations.size > 1 %>
<% if user_signed_in? %>
<li>
<%= render 'hyrax/users/notify_number' %>
</li>
<li class="dropdown">
<%= link_to hyrax.dashboard_profile_path(current_user), role: 'button', data: { toggle: 'dropdown' }, aria: { haspopup: true, expanded: false} do %>
<span class="sr-only"><%= t("hyrax.toolbar.profile.sr_action") %></span>
<span class="hidden-xs">&nbsp;<%= current_user.name %></span>
<span class="sr-only"> <%= t("hyrax.toolbar.profile.sr_target") %></span>
<span class="fa fa-user"></span>
<span class="caret"></span>
<% end %>
<ul class="dropdown-menu dropdown-menu-right" role="menu">
<li><%= link_to t("hyrax.toolbar.dashboard.menu"), hyrax.dashboard_path %></li>

<li class="divider"></li>
<li><%= link_to t("hyku.toolbar.profile.edit_registration"), main_app.edit_user_registration_path %></li>
<li><%= link_to t("hyrax.toolbar.profile.logout"), main_app.destroy_user_session_path %></li>
</ul>
</li><!-- /.btn-group -->
<% else %>
<li>
<%= link_to main_app.new_user_session_path do %>
<span class="glyphicon glyphicon-log-in" aria-hidden="true"></span > <%= t("hyrax.toolbar.profile.login") %>
<% end %>
</li>
<% end %>
</ul>
11 changes: 11 additions & 0 deletions spec/views/_user_util_links.html.erb_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
RSpec.describe '/_user_util_links.html.erb', type: :view do
let(:user) { create(:user) }
before do
allow(view).to receive(:user_signed_in?).and_return(true)
allow(view).to receive(:current_user).and_return(user)
render
end
it 'links to edit registration path' do
expect(rendered).to have_link 'Change password', href: edit_user_registration_path
end
end

0 comments on commit 11f0d1d

Please sign in to comment.