Move officing link inside header dropdown menu

Also include the condition to hide this link on officing namespace.
This commit is contained in:
decabeza
2019-05-16 11:09:14 +02:00
parent 6cfb2e896d
commit cbbe188d6a
3 changed files with 15 additions and 6 deletions

View File

@@ -52,8 +52,15 @@ module UsersHelper
current_user && current_user.manager?
end
def current_poll_officer?
current_user && current_user.poll_officer?
end
def show_admin_menu?(user = nil)
current_administrator? || current_moderator? || current_valuator? || current_manager? || (user && user.administrator?)
unless namespace == "officing"
current_administrator? || current_moderator? || current_valuator? || current_manager? ||
(user && user.administrator?) || current_poll_officer?
end
end
def interests_title_text(user)

View File

@@ -26,11 +26,12 @@
<%= link_to t("layouts.header.management"), management_sign_in_path %>
</li>
<% end %>
<% if current_user.poll_officer? && Poll.current.any? %>
<li>
<%= link_to t("layouts.header.officing"), officing_root_path %>
</li>
<% end %>
</ul>
</li>
<% end %>
<% if current_user && current_user.poll_officer? %>
<li>
<%= link_to t("layouts.header.officing"), officing_root_path %>
</li>
<% end %>

View File

@@ -118,6 +118,7 @@ feature "Poll Officing" do
expect(page).to have_current_path(officing_root_path)
expect(page).to have_css("#officing_menu")
expect(page).not_to have_link("Polling officers")
expect(page).not_to have_css("#valuation_menu")
expect(page).not_to have_css("#admin_menu")
expect(page).not_to have_css("#moderation_menu")