Merge pull request #3509 from consul/menu-users

Users menu
This commit is contained in:
Alberto
2019-05-21 12:54:42 +02:00
committed by GitHub
13 changed files with 43 additions and 45 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

@@ -1,18 +0,0 @@
<% if current_user.administrator? %>
<li>
<%= link_to admin_stats_path, title: t("admin.menu.stats") do %>
<span class="icon-stats"></span>
<span class="show-for-small-only">
<%= t("admin.menu.stats") %>
</span>
<% end %>
</li>
<li>
<%= link_to admin_settings_path, title: t("admin.menu.settings") do %>
<span class="icon-settings"></span>
<span class="show-for-small-only">
<%= t("admin.menu.settings") %>
</span>
<% end %>
</li>
<% end %>

View File

@@ -19,12 +19,21 @@
<div class="top-bar-left">
<ul class="menu">
<li class="menu-text">
<h1>
<%= link_to namespaced_root_path do %>
<%= setting["org_name"] %>
<br><small><%= namespaced_header_title %></small>
<% end %>
</h1>
<% if namespace == "officing" %>
<h1>
<%= link_to "#" do %>
<%= setting["org_name"] %>
<br><small><%= namespaced_header_title %></small>
<% end %>
</h1>
<% else %>
<h1>
<%= link_to namespaced_root_path do %>
<%= setting["org_name"] %>
<br><small><%= namespaced_header_title %></small>
<% end %>
</h1>
<% end %>
</li>
</ul>
</div>
@@ -32,7 +41,6 @@
<div id="responsive_menu">
<div class="top-bar-right">
<ul class="dropdown menu" data-dropdown-menu>
<%= render "admin/shared/admin_shortcuts" %>
<%= render "shared/admin_login_items" %>
<%= render "layouts/notification_item" %>
<%= render "devise/menu/login_items" %>

View File

@@ -34,7 +34,6 @@
<div class="top-bar-right">
<ul class="menu" data-responsive-menu="medium-dropdown">
<%= render "admin/shared/admin_shortcuts", current_user: manager_logged_in %>
<%= render "shared/admin_login_items", current_user: manager_logged_in %>
<%= render "devise/menu/login_items", current_user: manager_logged_in %>
</ul>

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

@@ -229,7 +229,7 @@ en:
participation_title: Participation
privacy: Privacy Policy
header:
administration_menu: Admin
administration_menu: Menu
administration: Administration
available_locales: Available languages
collaborative_legislation: Collaborative legislation
@@ -242,7 +242,7 @@ en:
officing: Polling officers
help: Help
my_account_link: My account
my_activity_link: My activity
my_activity_link: My content
open: open
open_gov: Open government
proposals: Proposals
@@ -679,7 +679,7 @@ en:
info_about_receivers_html: "This message will be sent to <strong>%{count} people</strong> and it will be visible in %{proposal_page}.<br> Messages are not sent immediately, users will receive periodically an email with all proposal notifications."
proposal_page: "the proposal's page"
show:
back: "Go back to my activity"
back: "Go back to my content"
shared:
edit: "Edit"
save: "Save"

View File

@@ -229,7 +229,7 @@ es:
participation_title: Participación
privacy: Política de privacidad
header:
administration_menu: Admin
administration_menu: Menú
administration: Administración
available_locales: Idiomas disponibles
collaborative_legislation: Legislación colaborativa
@@ -242,7 +242,7 @@ es:
officing: Presidentes de mesa
help: Ayuda
my_account_link: Mi cuenta
my_activity_link: Mi actividad
my_activity_link: Mi contenido
open: abierto
open_gov: Gobierno %{open}
proposals: Propuestas
@@ -679,7 +679,7 @@ es:
info_about_receivers_html: "Este mensaje se enviará a <strong>%{count} usuarios</strong> y se publicará en %{proposal_page}.<br> El mensaje no se enviará inmediatamente, los usuarios recibirán periódicamente un email con todas las notificaciones de propuestas."
proposal_page: "la página de la propuesta"
show:
back: "Volver a mi actividad"
back: "Volver a mi contenido"
shared:
edit: "Editar"
save: "Guardar"

View File

@@ -1542,7 +1542,7 @@ feature "Admin budget investments" do
login_as(valuator.user.reload)
visit root_path
click_link "Admin"
click_link "Menu"
click_link "Valuation"
within "#budget_#{budget.id}" do

View File

@@ -12,7 +12,7 @@ feature "Management" do
click_link "Management"
expect(page).to have_content("My activity")
expect(page).to have_content("My content")
expect(page).to have_content("My account")
expect(page).to have_content("Sign out")
end
@@ -26,7 +26,7 @@ feature "Management" do
click_link "Management"
expect(page).not_to have_content("My activity")
expect(page).not_to have_content("My content")
expect(page).not_to have_content("My account")
expect(page).not_to have_content("Sign out")
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")

View File

@@ -9,7 +9,7 @@ feature "Proposal Notifications" do
login_as(author)
visit root_path
click_link "My activity"
click_link "My content"
click_link proposal.title
click_link "Access the community"
click_link "Send message to the community"

View File

@@ -75,7 +75,7 @@ feature "Users" do
visit account_path
expect(page).to have_link "My activity", href: user_path(u1)
expect(page).to have_link "My content", href: user_path(u1)
visit "/"
click_link "Sign out"
@@ -98,7 +98,7 @@ feature "Users" do
visit account_path
expect(page).to have_link "My activity", href: user_path(u2)
expect(page).to have_link "My content", href: user_path(u2)
end
end
end

View File

@@ -17,7 +17,7 @@ module Notifications
login_as(proposal.author)
visit root_path
click_link "My activity"
click_link "My content"
within("#proposal_#{proposal.id}") do
click_link proposal.title