From aaaaa008078b1c0a7822a8accfbb3bf6d7842524 Mon Sep 17 00:00:00 2001 From: decabeza Date: Fri, 5 Oct 2018 18:04:30 +0200 Subject: [PATCH] Adds styles to dashboard layouts, progress, show and partials --- app/views/dashboard/_document.html.erb | 10 ++- app/views/dashboard/_form.html.erb | 9 ++- app/views/dashboard/_goal.html.erb | 24 +++---- .../dashboard/_mailing_resource.html.erb | 28 +++----- app/views/dashboard/_next_goal.html.erb | 32 ++++----- app/views/dashboard/_poster_resource.html.erb | 28 +++----- app/views/dashboard/_proposed_action.html.erb | 31 ++++----- .../dashboard/_recommended_actions.html.erb | 6 +- app/views/dashboard/_resource.html.erb | 46 +++++-------- app/views/dashboard/_resources.html.erb | 10 +-- .../dashboard/actions/new_request.html.erb | 15 ++--- app/views/dashboard/progress.html.erb | 27 ++++---- app/views/dashboard/show.html.erb | 23 ++++--- app/views/layouts/dashboard.html.erb | 4 +- .../dashboard/_proposal_header.html.erb | 32 +++++---- .../dashboard/_proposal_totals.html.erb | 65 ++++++++++--------- .../layouts/proposals_dashboard.html.erb | 4 +- 17 files changed, 178 insertions(+), 216 deletions(-) diff --git a/app/views/dashboard/_document.html.erb b/app/views/dashboard/_document.html.erb index c5b688575..0b61002a2 100644 --- a/app/views/dashboard/_document.html.erb +++ b/app/views/dashboard/_document.html.erb @@ -1,10 +1,8 @@

- <%= link_to document.attachment.url, target: '_blank' do %> + <%= link_to document.attachment.url, target: "_blank" do %> <%= document.title %> - ( - <%= document.humanized_content_type %> -  |  - <%= number_to_human_size(document.attachment_file_size, precision: 2) %> - ) + (<%= document.humanized_content_type %> +  |  + <%= number_to_human_size(document.attachment_file_size, precision: 2) %>) <% end %>

diff --git a/app/views/dashboard/_form.html.erb b/app/views/dashboard/_form.html.erb index aabf9ad70..1d49372d6 100644 --- a/app/views/dashboard/_form.html.erb +++ b/app/views/dashboard/_form.html.erb @@ -1,8 +1,7 @@ <% if dashboard_action.request_to_administrators && !dashboard_action.requested_for?(proposal) %> - <%= form_for @dashboard_executed_action, - url: create_request_proposal_dashboard_action_url(proposal, dashboard_action) do |f| %> -
- <%= f.submit(class: 'button', value: t("dashboard.form.request")) %> -
+ <%= form_for @dashboard_executed_action, + url: create_request_proposal_dashboard_action_url(proposal, + dashboard_action) do |f| %> + <%= f.submit(class: "button", value: t("dashboard.form.request")) %> <% end %> <% end %> diff --git a/app/views/dashboard/_goal.html.erb b/app/views/dashboard/_goal.html.erb index 35315ac32..07a8f241f 100644 --- a/app/views/dashboard/_goal.html.erb +++ b/app/views/dashboard/_goal.html.erb @@ -1,27 +1,21 @@ -
-
- +
+
- <%= t("dashboard.goal.target_supports", count: number_with_precision(goal.required_supports, delimiter: '.', precision: 0)) %> + <%= t("dashboard.goal.target_supports", + count: number_with_precision(goal.required_supports, + delimiter: '.', precision: 0)) %>
-
 
-
- +
<%= goal.title %> -
-
-

<%= t("dashboard.goal.unlocked_resource") %>

+ <%= t("dashboard.goal.unlocked_resource") %>
<% if goal.day_offset.positive? %> -
+
<%= t("dashboard.goal.days", count: goal.day_offset) %> -
-
-

<%= t("dashboard.goal.ideal_time") %>

+ <%= t("dashboard.goal.ideal_time") %>
<% end %>
- diff --git a/app/views/dashboard/_mailing_resource.html.erb b/app/views/dashboard/_mailing_resource.html.erb index 84620cb3a..ef6e933f0 100644 --- a/app/views/dashboard/_mailing_resource.html.erb +++ b/app/views/dashboard/_mailing_resource.html.erb @@ -1,26 +1,16 @@ <% if can?(:manage_mailing, proposal) %> -
-
" - data-position="bottom" data-alignment="right"> -
-

- -

-

<%= t("dashboard.menu.mailing") %>

-

- <%= Setting['proposals.email_short_title'] %> -

-
+
+
+

<%= t("dashboard.menu.mailing") %>

+

+ <%= Setting['proposals.email_short_title'] %> +

-
-
- <%= link_to t("dashboard.resource.request_resource"), +
+ <%= link_to t("dashboard.resource.view_resource"), new_proposal_dashboard_mailing_path(proposal.to_param), - class: 'button primary' %> -
+ class: "button expanded" %>
<% end %> - diff --git a/app/views/dashboard/_next_goal.html.erb b/app/views/dashboard/_next_goal.html.erb index b28d295b8..d1db278cf 100644 --- a/app/views/dashboard/_next_goal.html.erb +++ b/app/views/dashboard/_next_goal.html.erb @@ -1,27 +1,27 @@ <% if next_goal.present? %> -
-

-
-
<%= t("dashboard.next_goal.title") %>
-
-
+
+

<%= t("dashboard.next_goal.title") %>

-
+
<%= render 'goal', goal: next_goal %> - + <% if course.count > 1 %> + + <% end %>
<% if course.count > 1 %> -
- <%= render partial: 'goal', collection: course %> +
+ <%= render partial: 'goal', collection: course %> - <% end %> diff --git a/app/views/dashboard/_poster_resource.html.erb b/app/views/dashboard/_poster_resource.html.erb index 035fc2143..eec5d6051 100644 --- a/app/views/dashboard/_poster_resource.html.erb +++ b/app/views/dashboard/_poster_resource.html.erb @@ -1,26 +1,16 @@ <% if can?(:manage_poster, proposal) %> -
-
" - data-position="bottom" data-alignment="right"> -
-

- -

-

<%= t("dashboard.menu.poster") %>

-

- <%= Setting['proposals.poster_short_title'] %> -

-
+
+
+

<%= t("dashboard.menu.poster") %>

+

+ <%= Setting['proposals.poster_short_title'] %> +

-
-
- <%= link_to t("dashboard.resource.request_resource"), +
+ <%= link_to t("dashboard.resource.view_resource"), new_proposal_dashboard_poster_path(proposal.to_param), - class: 'button primary' %> -
+ class: "button expanded" %>
<% end %> - diff --git a/app/views/dashboard/_proposed_action.html.erb b/app/views/dashboard/_proposed_action.html.erb index 22e9a02bf..e3f17c320 100644 --- a/app/views/dashboard/_proposed_action.html.erb +++ b/app/views/dashboard/_proposed_action.html.erb @@ -1,27 +1,28 @@ -
-
-
- <% if proposed_action.proposals.where(id: proposal.id).any? %> - - <% else %> - <%= link_to execute_proposal_dashboard_action_path(proposal, proposed_action), method: :post, id: "#{dom_id(proposed_action)}_execute" do %> -
-
- <% end %> +
+
+ <% if proposed_action.proposals.where(id: proposal.id).any? %> + + <% else %> + <%= link_to execute_proposal_dashboard_action_path(proposal, proposed_action), + id: "#{dom_id(proposed_action)}_execute", + method: :post, + class: "unchecked-link" do %> + <% end %> -
+ <% end %> -
+

<%= proposed_action.title %>

+ <% if proposed_action.proposals.where(id: proposal.id).any? %> -

<%=l(proposed_action.executed_actions.find_by(proposal: proposal).executed_at.to_date) %>

+

<%= l(proposed_action.executed_actions.find_by(proposal: proposal).executed_at.to_date) %>

<% else %> - <% unless proposed_action.short_description.blank? %> + <% if proposed_action.short_description.present? %>

<%= proposed_action.short_description %>

<% end %> <% proposed_action.links.each do |link| %> -

<%= link_to link.label, link.url, target: '_blank' %>

+

<%= link_to link.label, link.url, target: "_blank" %>

<% end %> <%= render partial: 'document', collection: proposed_action.documents %> diff --git a/app/views/dashboard/_recommended_actions.html.erb b/app/views/dashboard/_recommended_actions.html.erb index 858cca11d..62daeac8d 100644 --- a/app/views/dashboard/_recommended_actions.html.erb +++ b/app/views/dashboard/_recommended_actions.html.erb @@ -1,9 +1,5 @@ <% if proposed_actions.any? %> -

-
-
<%= t("dashboard.recommended_actions.title") %>
-
-
+

<%= t("dashboard.recommended_actions.title") %>

<%= render partial: 'proposed_action', collection: proposed_actions %> <% end %> diff --git a/app/views/dashboard/_resource.html.erb b/app/views/dashboard/_resource.html.erb index b5a5d4934..d9a66ac67 100644 --- a/app/views/dashboard/_resource.html.erb +++ b/app/views/dashboard/_resource.html.erb @@ -1,38 +1,23 @@ -
-
-
-

- <% if resource.executed_for?(proposal) %> - - <% elsif resource.active_for?(proposal) %> - - <% else %> - - <% end %> -

-

<%= resource.title %>

-

- <%= resource.short_description %> -

-
+
+
+

<%= resource.title %>

+

+ <%= resource.short_description %> +

-
+
<% if resource.executed_for?(proposal) %> -
- <%= link_to t("dashboard.resource.view_resource"), - new_request_proposal_dashboard_action_path(proposal, resource), - class: 'button success' %> -
+ <%= link_to t("dashboard.resource.view_resource"), + new_request_proposal_dashboard_action_path(proposal, resource), + class: "button" %> <% elsif resource.requested_for?(proposal) %> <%= t("dashboard.resource.resource_requested") %> <% elsif resource.active_for?(proposal) %> -
- <%= link_to t("dashboard.resource.request_resource"), - new_request_proposal_dashboard_action_path(proposal, resource), - class: 'button primary' %> -
+ <%= link_to t("dashboard.resource.request_resource"), + new_request_proposal_dashboard_action_path(proposal, resource), + class: "button" %> <% else %> <%== resoure_availability_label(resource) %> @@ -41,4 +26,3 @@
- diff --git a/app/views/dashboard/_resources.html.erb b/app/views/dashboard/_resources.html.erb index b66e6315c..a2cbf1baf 100644 --- a/app/views/dashboard/_resources.html.erb +++ b/app/views/dashboard/_resources.html.erb @@ -1,11 +1,7 @@ -
-

-
-
<%= t("dashboard.resources.available_resources") %>
-
-
+
+

<%= t("dashboard.resources.available_resources") %>

-
+
<%= render 'poll_resource' %> <%= render 'mailing_resource' %> <%= render 'poster_resource' %> diff --git a/app/views/dashboard/actions/new_request.html.erb b/app/views/dashboard/actions/new_request.html.erb index 8d552891e..582f74a80 100644 --- a/app/views/dashboard/actions/new_request.html.erb +++ b/app/views/dashboard/actions/new_request.html.erb @@ -1,26 +1,25 @@ <% content_for :action_title, dashboard_action.title %> -
+
<%== dashboard_action.description %> <%= render 'dashboard/form' %>
+ <%= render 'documents/documents', documents: dashboard_action.documents %> + <% if dashboard_action.links.any? %> -
- diff --git a/app/views/dashboard/progress.html.erb b/app/views/dashboard/progress.html.erb index a7bd047eb..03f1cd5c6 100644 --- a/app/views/dashboard/progress.html.erb +++ b/app/views/dashboard/progress.html.erb @@ -1,24 +1,22 @@ <% if proposal.published? %> <% content_for :action_title, t("dashboard.progress.title") %> -
+
-
- <%= link_to t("dashboard.progress.group_by_date"), - progress_proposal_dashboard_path(proposal), - class: "button #{daily_selected_class}" %> - <%= link_to t("dashboard.progress.group_by_week"), - progress_proposal_dashboard_path(proposal, group_by: 'week'), - class: "button #{weekly_selected_class}" %> - <%= link_to t("dashboard.progress.group_by_month"), - progress_proposal_dashboard_path(proposal, group_by: 'month'), - class: "button #{monthly_selected_class}" %> -
+ <%= link_to t("dashboard.progress.group_by_date"), + progress_proposal_dashboard_path(proposal), + class: "button medium #{daily_selected_class}" %> + <%= link_to t("dashboard.progress.group_by_week"), + progress_proposal_dashboard_path(proposal, group_by: 'week'), + class: "button medium #{weekly_selected_class}" %> + <%= link_to t("dashboard.progress.group_by_month"), + progress_proposal_dashboard_path(proposal, group_by: 'month'), + class: "button medium #{monthly_selected_class}" %>
-
" data-proposal-success="<%= Setting["votes_for_proposal_success"] %>" data-proposal-resources-url="<%= proposal_dashboard_resources_path(proposal, format: :json) %>" - class="c3 proposal-graph" - style="max-height: 320px; position: relative;">
+ class="c3 proposal-graph">
<%= javascript_include_tag 'dashboard_graphs', 'data-turbolinks-track' => true %> diff --git a/app/views/dashboard/show.html.erb b/app/views/dashboard/show.html.erb index c6bef64a4..ce71dc6ad 100644 --- a/app/views/dashboard/show.html.erb +++ b/app/views/dashboard/show.html.erb @@ -1,25 +1,30 @@ <% content_for :action_title, t("dashboard.index.title") %> -<% if current_editable?(proposal) %> - <%= link_to t("dashboard.index.edit_proposal_link"), edit_proposal_path(proposal), target: '_blank', class: 'button hollow' %> +<% if current_editable?(proposal) %> + <%= link_to t("dashboard.index.edit_proposal_link"), + edit_proposal_path(proposal), + target: "_blank", + class: "button hollow" %> <% end %> <% if can_destroy_image?(proposal) %> - <%= link_to t("images.remove_image"), + <%= link_to t("images.remove_image"), image_path(proposal.image, from: request.url), method: :delete, - class: 'button hollow alert', + class: "button hollow alert", data: { confirm: t("images.actions.destroy.confirm") } %> <% end %> <% unless proposal.retired? %> - <%= link_to t("dashboard.index.retire"), + <%= link_to t("dashboard.index.retire"), retire_form_proposal_path(proposal), - class: 'button hollow alert', - target: '_blank' %> + class: "button hollow alert", + target: "_blank" %> <% end %> <% if can?(:publish, proposal) %> - <%= link_to t("dashboard.index.publish"), publish_proposal_dashboard_path(proposal), class: 'button success', method: :patch %> + <%= link_to t("dashboard.index.publish"), + publish_proposal_dashboard_path(proposal), + class: "button success", + method: :patch %> <% end %> - diff --git a/app/views/layouts/dashboard.html.erb b/app/views/layouts/dashboard.html.erb index 83669be9a..46281c797 100644 --- a/app/views/layouts/dashboard.html.erb +++ b/app/views/layouts/dashboard.html.erb @@ -45,7 +45,9 @@
- +
diff --git a/app/views/layouts/dashboard/_proposal_header.html.erb b/app/views/layouts/dashboard/_proposal_header.html.erb index bdaff8da9..58a2693ab 100644 --- a/app/views/layouts/dashboard/_proposal_header.html.erb +++ b/app/views/layouts/dashboard/_proposal_header.html.erb @@ -1,17 +1,21 @@ -
-

<%= link_to proposal.title, proposal, target: '_blank' %>

- <% if proposal.retired? %> -
<%= t('.retired') %>
- <% elsif proposal.published? %> -
<%= t('.published') %>
- <% else %> -
<%= t('.draft') %>
- <% end %> -
+

+ <%= link_to proposal.title, proposal, target: "_blank" %> +

-<% if content_for?(:action_title) %> -
-
<%= yield(:action_title) %>
-
+<% if proposal.retired? %> +
+ <%= t("layouts.dashboard.proposal_header.retired") %> +
+<% elsif proposal.published? %> +
+ <%= t("layouts.dashboard.proposal_header.published") %> +
+<% else %> +
+ <%= t("layouts.dashboard.proposal_header.draft") %>
<% end %> + +<% if content_for?(:action_title) %> +

<%= yield(:action_title) %>

+<% end %> diff --git a/app/views/layouts/dashboard/_proposal_totals.html.erb b/app/views/layouts/dashboard/_proposal_totals.html.erb index 53c9619a0..3c110b474 100644 --- a/app/views/layouts/dashboard/_proposal_totals.html.erb +++ b/app/views/layouts/dashboard/_proposal_totals.html.erb @@ -1,50 +1,55 @@ -
-
-
-
-
<%= number_with_delimiter(proposal.votes_for.size, delimiter: '.') %>
-
<%= t('.supports') %>
-
- +
+
+
<%= Dashboard::Action.active.resources.active_for(proposal).count %> / <%= Dashboard::Action.active.resources.count %>
-
<%= t('.active_resources') %>
+ <%= t("layouts.dashboard.proposal_totals.active_resources") %>
+
+
<%= number_with_delimiter(community_members_count, delimiter: '.') %>
-
<%= t('.community') %>
-
+ <%= t("layouts.dashboard.proposal_totals.community") %> +
-
-
+ +
+
- <%= t('.support_count', count: number_with_delimiter(next_goal_supports, delimiter: '.')) %> + <%= number_with_delimiter(proposal.votes_for.size, delimiter: '.') %> + / + <%= t("layouts.dashboard.proposal_totals.support_count", count: number_with_delimiter(next_goal_supports, delimiter: '.')) %>
- -
<%= t('.current_goal') %>
+ <%= t("layouts.dashboard.proposal_totals.current_goal") %>
+
-
-
- <%= next_goal_progress %>% +
+
+
+
+ <%= next_goal_progress %>% +
+
" aria-valuemax="100"> +
+
-
" aria-valuemax="100"> -
-
-
-
diff --git a/app/views/layouts/proposals_dashboard.html.erb b/app/views/layouts/proposals_dashboard.html.erb index 8f3ad7c94..a05331234 100644 --- a/app/views/layouts/proposals_dashboard.html.erb +++ b/app/views/layouts/proposals_dashboard.html.erb @@ -45,7 +45,9 @@
- +