diff --git a/app/assets/stylesheets/proposal.scss b/app/assets/stylesheets/proposal.scss index 63f90694c..73c156ec7 100644 --- a/app/assets/stylesheets/proposal.scss +++ b/app/assets/stylesheets/proposal.scss @@ -18,7 +18,92 @@ } .proposal-dashboard { - margin-top: -1.5rem; + .dashboard-sidebar { + border-right: 1pt solid lightgray; + + @include breakpoint(medium) { + min-height: rem-calc(1100); + } + + ul { + list-style-type: none; + margin-bottom: 0; + margin-left: 0; + padding: 0; + + [class^="icon-"] { + color: #595959; + display: inline-block; + font-size: rem-calc(24); + line-height: $line-height; + padding: $line-height / 2 $line-height / 4; + padding-left: 0; + vertical-align: middle; + } + + } + + li { + margin: 0; + outline: 0; + + ul { + margin-left: $line-height / 1.5; + border-left: 1px solid #b6b6b6; + padding-left: $line-height / 2; + } + + &.is-active a { + span { + color: #00538b; + font-weight: bold; + border-bottom: 2px solid #00538b; + padding-bottom: 2px; + } + } + } + + li a { + color: #595959; + display: block; + line-height: rem-calc(48); + padding-left: rem-calc(12); + vertical-align: top; + + &:hover { + text-decoration: none; + } + } + + li a.is-active { + color: #00538b; + + [class^="icon-"] { + color: #00538b; + } + } + + .submenu { + border-bottom: 0; + margin-left: $line-height; + + li:first-child { + padding-top: $line-height / 2; + } + + li:last-child { + padding-bottom: $line-height / 2; + } + + a { + font-weight: normal; + } + + .is-active { + border-bottom: 0; + } + } + } .columns { padding: 0; @@ -43,13 +128,6 @@ } } - .left-menu { - border-right: 1pt solid lightgray; - border-bottom: 1pt solid lightgray; - padding: 1rem 1.5rem 1rem 1.5rem; - background-color: #fbfbfb; - } - .body { padding: 1rem 1.5rem 1rem 1.5rem; } diff --git a/app/helpers/proposals_dashboard_helper.rb b/app/helpers/proposals_dashboard_helper.rb index 4ebbfa078..40a3e365f 100644 --- a/app/helpers/proposals_dashboard_helper.rb +++ b/app/helpers/proposals_dashboard_helper.rb @@ -1,2 +1,74 @@ module ProposalsDashboardHelper + def resources_menu_visible?(proposal, resources) + can?(:manage_polls, proposal) && resources.any? + end + + def progress_menu(&block) + menu_group('progress-menu', progress_menu_active?, &block) + end + + def progress_menu_active? + actions_menu_active? || stats_menu_active? + end + + def actions_menu(&block) + menu_entry(actions_menu_active?, &block) + end + + def actions_menu_active? + (controller_name == 'proposals_dashboard' && action_name == 'index') || is_proposed_action_request? + end + + def stats_menu(&block) + menu_entry(stats_menu_active?, &block) + end + + def stats_menu_active? + controller_name == 'proposals_dashboard' && action_name == 'stats' + 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 resources_menu_active? + polls_menu_active? || is_resource_request? + end + + def polls_menu_active? + controller_name == 'polls' + 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? + controller_name == 'proposals_dashboard' && action_name == 'new_request' && proposal_dashboard_action&.resource? + end + + def is_proposed_action_request? + controller_name == 'proposals_dashboard' && action_name == 'new_request' && proposal_dashboard_action&.proposed_action? + end + + def is_request_active(id) + controller_name == 'proposals_dashboard' && action_name == 'new_request' && proposal_dashboard_action&.id == id + end end diff --git a/app/views/layouts/proposals_dashboard.html.erb b/app/views/layouts/proposals_dashboard.html.erb index 6aab90096..9f8e732e4 100644 --- a/app/views/layouts/proposals_dashboard.html.erb +++ b/app/views/layouts/proposals_dashboard.html.erb @@ -23,53 +23,45 @@ <%= setting['per_page_code_head'].try(:html_safe) %> - + <%= setting['per_page_code_body'].try(:html_safe) %>

<%= setting['org_name'] %>

-
- <%= render partial: 'layouts/header', locals: {with_subnavigation: false} %> +
+
+
- - - <%= render partial: 'layouts/flash' %> - -
-
-
<%= t '.title' %>
-
-
-
- <%= render partial: 'proposals_dashboard/menu' %> -
-
- <%= yield %> +
+
+ <%= render partial: 'proposals_dashboard/menu' %> +
-
+
+ <%= render partial: 'layouts/header', locals: {with_subnavigation: false} %> + +
+
+ +
+ +
+ +
+
+ <%= render partial: 'proposals_dashboard/menu' %> +
+
+
+
+ <%= render partial: 'layouts/flash' %> + <%= yield %> +
+
+
+
- diff --git a/app/views/proposals_dashboard/_menu.html.erb b/app/views/proposals_dashboard/_menu.html.erb index e9314b007..4421ac70f 100644 --- a/app/views/proposals_dashboard/_menu.html.erb +++ b/app/views/proposals_dashboard/_menu.html.erb @@ -1,106 +1,104 @@ +
    +
  • + + + <%= t('.general') %> + -<% if current_editable?(proposal) || can?(:publish, proposal) %> -
    -
    -
    <%= t '.general' %>
    -
    +
      + <% if current_editable?(proposal) %> +
    • + <%= link_to edit_proposal_path(proposal), target: '_blank' do %> + <%= t('.edit_proposal_link') %> + <% end %> +
    • + <% end %> - <% if current_editable?(proposal) %> -
      -
      -
      - <%= link_to t('.edit_proposal_link'), edit_proposal_path(proposal), target: '_blank' %> -
      -
      - <% end %> - -
      -
      -
      - <%= link_to t('.send_notification'), - new_proposal_notification_path(proposal_id: proposal.id), - target: '_blank' %> -
      -
      - - <% if can_destroy_image?(proposal) %> -
      -
      -
      - <%= link_to t('images.remove_image'), - image_path(proposal.image, from: request.url), - method: :delete, - data: { confirm: t('images.actions.destroy.confirm') } %> -
      -
      - <% end %> - - <% unless proposal.retired? %> -
      -
      -
      - <%= link_to t('.retire'), - retire_form_proposal_path(proposal), - target: '_blank' %> -
      -
      - <% end %> - - <% if can?(:publish, proposal) %> -
      -
      -
      - <%= link_to t('.publish'), publish_proposal_dashboard_index_path(proposal), method: :patch %> -
      -
      - <% end %> -<% end %> - -
      -
      -
      <%= t('.progress') %>
      -
      - -
      -
      -
      - <%= link_to t('.graphic'), stats_proposal_dashboard_index_path(proposal.to_param) %> -
      -
      - -
      -
      -
      - <%= link_to t('.actions'), proposal_dashboard_index_path(proposal.to_param) %> -
      -
      - -
      -
      -
      <%= t '.resources' %>
      -
      - -<% if can?(:manage_polls, proposal) %> -
      -
      -
      - <%= link_to t('.polls'), proposal_dashboard_polls_path(proposal.to_param) %> -
      -
      -<% end %> - -<% resources.each do |resource| %> -
      -
      -
      - - <% if resource.request_to_administrators? %> - <%= link_to resource.title, - new_request_proposal_dashboard_path(proposal, resource) %> - <% else %> - <%= link_to resource.title, resource.link, target: '_blank' %> +
    • + <%= link_to new_proposal_notification_path(proposal_id: proposal.id), + target: '_blank' do %> + <%= t('.send_notification') %> <% end %> - -
    • -
      -<% end %> + + + <% if can_destroy_image?(proposal) %> +
    • + <%= link_to image_path(proposal.image, from: request.url), + method: :delete, + data: { confirm: t('images.actions.destroy.confirm') } do %> + <%= t('images.remove_image') %> + <% end %> +
    • + <% end %> + + <% unless proposal.retired? %> +
    • + <%= link_to retire_form_proposal_path(proposal), + target: '_blank' do %> + <%= t('.retire') %> + <% end %> +
    • + <% end %> + + <% if can?(:publish, proposal) %> +
    • + <%= link_to publish_proposal_dashboard_index_path(proposal), method: :patch do %> + <%= t('.publish') %> + <% end %> +
    • + <% end %> +
    +
  • + +
  • + > + + <%= t('.progress') %> + + + <%= progress_menu do %> + <%= stats_menu do %> + <%= link_to stats_proposal_dashboard_index_path(proposal.to_param) do %> + <%= t('.graphic') %> + <% end %> + <% end %> + + <%= actions_menu do %> + <%= link_to proposal_dashboard_index_path(proposal.to_param) do %> + <%= t('.actions') %> + <% end %> + <% end %> + <% end %> +
  • + + <% if resources_menu_visible?(proposal, resources) %> +
  • + > + + <%= t('.resources') %> + + + <%= resources_menu do %> + <% if can?(:manage_polls, proposal) %> + <%= polls_menu do %> + <%= link_to proposal_dashboard_polls_path(proposal.to_param) do %> + <%= t('.polls') %> + <% end %> + <% end %> + <% end %> + + <% resources.each do |resource| %> +
  • > + <% if resource.request_to_administrators? %> + <%= link_to new_request_proposal_dashboard_path(proposal, resource) do %> + <%= resource.title %> + <% end %> + <% else %> + <%= link_to resource.title, resource.link, target: '_blank' %> + <% end %> +
  • + <% end %> + <% end %> + + <% end %> +