Adds styles to dashboard menu
This commit is contained in:
@@ -1,17 +1,10 @@
|
|||||||
module ProposalsDashboardHelper
|
module ProposalsDashboardHelper
|
||||||
def my_proposal_menu_class
|
def my_proposal_menu_active?
|
||||||
return 'is-active' if controller_name == 'dashboard' && action_name == 'index'
|
controller_name == 'dashboard' && action_name == 'show'
|
||||||
nil
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def progress_menu_class
|
def community_menu_active?
|
||||||
return 'is-active' if progress_menu_active?
|
controller_name == 'dashboard' && action_name == 'community'
|
||||||
nil
|
|
||||||
end
|
|
||||||
|
|
||||||
def community_menu_class
|
|
||||||
return 'is-active' if controller_name == 'dashboard' && action_name == 'community'
|
|
||||||
nil
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def progress_menu_active?
|
def progress_menu_active?
|
||||||
@@ -22,18 +15,6 @@ module ProposalsDashboardHelper
|
|||||||
can?(:manage_polls, proposal) || resources.any?
|
can?(:manage_polls, proposal) || resources.any?
|
||||||
end
|
end
|
||||||
|
|
||||||
def resources_menu(&block)
|
|
||||||
menu_group('resources-menu', resources_menu_active?, &block)
|
|
||||||
end
|
|
||||||
|
|
||||||
def polls_menu(&block)
|
|
||||||
menu_entry(polls_menu_active?, &block)
|
|
||||||
end
|
|
||||||
|
|
||||||
def poster_menu(&block)
|
|
||||||
menu_entry(poster_menu_active?, &block)
|
|
||||||
end
|
|
||||||
|
|
||||||
def resources_menu_active?
|
def resources_menu_active?
|
||||||
poster_menu_active? || polls_menu_active? || mailing_menu_active? || is_resource_request?
|
poster_menu_active? || polls_menu_active? || mailing_menu_active? || is_resource_request?
|
||||||
end
|
end
|
||||||
@@ -46,31 +27,10 @@ module ProposalsDashboardHelper
|
|||||||
controller_name == 'poster'
|
controller_name == 'poster'
|
||||||
end
|
end
|
||||||
|
|
||||||
def mailing_menu(&block)
|
|
||||||
menu_entry(mailing_menu_active?, &block)
|
|
||||||
end
|
|
||||||
|
|
||||||
def mailing_menu_active?
|
def mailing_menu_active?
|
||||||
controller_name == 'mailing'
|
controller_name == 'mailing'
|
||||||
end
|
end
|
||||||
|
|
||||||
def menu_group(id, active, &block)
|
|
||||||
html_class = nil
|
|
||||||
html_class = 'is-active' if active
|
|
||||||
|
|
||||||
content_tag(:ul, id: id, class: html_class) do
|
|
||||||
yield
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def menu_entry(active, &block)
|
|
||||||
content = capture(&block)
|
|
||||||
html_class = nil
|
|
||||||
html_class = 'is-active' if active
|
|
||||||
|
|
||||||
content_tag(:li, content, class: html_class)
|
|
||||||
end
|
|
||||||
|
|
||||||
def is_resource_request?
|
def is_resource_request?
|
||||||
controller_name == 'dashboard' && action_name == 'new_request' && dashboard_action&.resource?
|
controller_name == 'dashboard' && action_name == 'new_request' && dashboard_action&.resource?
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,74 +1,76 @@
|
|||||||
<ul id="proposal_dashboard_menu" data-multi-open="false">
|
<ul id="proposal_dashboard_menu" class="no-bullet">
|
||||||
<li class="section-title">
|
<li class="section-title <%= 'is-active' if my_proposal_menu_active? %>">
|
||||||
<%= link_to proposal_dashboard_path(proposal.to_param), class: my_proposal_menu_class do %>
|
<span class="icon-proposals"></span>
|
||||||
<i class="fi-lightbulb"></i>
|
<%= link_to proposal_dashboard_path(proposal.to_param) do %>
|
||||||
<strong><%= t("dashboard.menu.my_proposal") %></strong>
|
<strong><%= t("dashboard.menu.my_proposal") %></strong>
|
||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li class="section-title">
|
<li class="section-title <%= 'is-active' if progress_menu_active? %>">
|
||||||
<%= link_to progress_proposal_dashboard_path(proposal.to_param),
|
<span class="icon-stats"></span>
|
||||||
class: progress_menu_class do %>
|
<%= link_to progress_proposal_dashboard_path(proposal.to_param) do %>
|
||||||
<span class="fi-graph-trend"></span>
|
|
||||||
<strong><%= t("dashboard.menu.progress") %></strong>
|
<strong><%= t("dashboard.menu.progress") %></strong>
|
||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<% if resources_menu_visible?(proposal, resources) %>
|
<% if resources_menu_visible?(proposal, resources) %>
|
||||||
<li class="section-title">
|
<li class="section-title <%= 'is-active' if resources_menu_active? %>">
|
||||||
<a href="#" <%= 'class=is-active' if resources_menu_active? %>>
|
<span class="icon-zip"></span>
|
||||||
<span class="icon-file-text-o"></span>
|
<strong><%= t("dashboard.menu.resources") %></strong>
|
||||||
<strong><%= t("dashboard.menu.resources") %></strong>
|
<ul class="no-bullet resources">
|
||||||
</a>
|
|
||||||
|
|
||||||
<%= resources_menu do %>
|
|
||||||
<% if can?(:manage_polls, proposal) %>
|
<% if can?(:manage_polls, proposal) %>
|
||||||
<%= polls_menu do %>
|
<li>
|
||||||
<%= link_to proposal_dashboard_polls_path(proposal.to_param) do %>
|
<%= link_to proposal_dashboard_polls_path(proposal.to_param),
|
||||||
<span data-tooltip title="<%= Setting['proposals.poll_short_title'] || t("dashboard.menu.polls") %>">
|
class: "#{'submenu-active' if polls_menu_active?}" do %>
|
||||||
|
<span data-tooltip title="<%= Setting['proposals.poll_short_title'] ||
|
||||||
|
t("dashboard.menu.polls") %>">
|
||||||
<%= t("dashboard.menu.polls") %>
|
<%= t("dashboard.menu.polls") %>
|
||||||
</span>
|
</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if can?(:manage_mailing, proposal) %>
|
<% if can?(:manage_mailing, proposal) %>
|
||||||
<%= mailing_menu do %>
|
<li>
|
||||||
<%= link_to new_proposal_dashboard_mailing_path(proposal.to_param) do %>
|
<%= link_to new_proposal_dashboard_mailing_path(proposal.to_param),
|
||||||
<span data-tooltip title="<%= Setting['proposals.email_short_title'] || t("dashboard.menu.mailing") %>">
|
class: "#{'submenu-active' if mailing_menu_active?}" do %>
|
||||||
|
<span data-tooltip title="<%= Setting['proposals.email_short_title'] ||
|
||||||
|
t("dashboard.menu.mailing") %>">
|
||||||
<%= t("dashboard.menu.mailing") %>
|
<%= t("dashboard.menu.mailing") %>
|
||||||
</span>
|
</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if can?(:manage_poster, proposal) %>
|
<% if can?(:manage_poster, proposal) %>
|
||||||
<%= poster_menu do %>
|
<li>
|
||||||
<%= link_to new_proposal_dashboard_poster_path(proposal.to_param) do %>
|
<%= link_to new_proposal_dashboard_poster_path(proposal.to_param),
|
||||||
<span data-tooltip title="<%= Setting['proposals.poster_short_title'] || t("dashboard.menu.poster") %>">
|
class: "#{'submenu-active' if poster_menu_active?}" do %>
|
||||||
|
<span data-tooltip title="<%= Setting['proposals.poster_short_title'] ||
|
||||||
|
t("dashboard.menu.poster") %>">
|
||||||
<%= t("dashboard.menu.poster") %>
|
<%= t("dashboard.menu.poster") %>
|
||||||
</span>
|
</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% resources.each do |resource| %>
|
<% resources.each do |resource| %>
|
||||||
<li <%= 'class=is-active' if is_request_active(resource.id) %>>
|
<li>
|
||||||
<%= link_to new_request_proposal_dashboard_action_path(proposal, resource) do %>
|
<%= link_to new_request_proposal_dashboard_action_path(proposal, resource),
|
||||||
|
class: "#{'submenu-active' if is_request_active(resource.id)}" do %>
|
||||||
<span data-tooltip title="<%= resource.short_description %>">
|
<span data-tooltip title="<%= resource.short_description %>">
|
||||||
<%= resource.title %>
|
<%= resource.title %>
|
||||||
</span>
|
</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<li class="section-title">
|
<li class="section-title <%= 'is-active' if community_menu_active? %>">
|
||||||
<%= link_to community_proposal_dashboard_path(proposal.to_param),
|
<span class="icon-organizations"></span>
|
||||||
class: community_menu_class do %>
|
<%= link_to community_proposal_dashboard_path(proposal.to_param) do %>
|
||||||
<span class="fi-torsos-all"></span>
|
|
||||||
<strong><%= t("dashboard.menu.community") %></strong>
|
<strong><%= t("dashboard.menu.community") %></strong>
|
||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
Reference in New Issue
Block a user