From 83634c992a46add42c833836c7224e1da8f64d35 Mon Sep 17 00:00:00 2001 From: decabeza Date: Thu, 11 Oct 2018 17:45:37 +0200 Subject: [PATCH] Improves styles for admin dashboard actions views --- .../admin/dashboard/actions/_form.html.erb | 81 ++++++++----------- .../admin/dashboard/actions/edit.html.erb | 17 ++-- .../admin/dashboard/actions/index.html.erb | 24 +++--- .../admin/dashboard/actions/new.html.erb | 17 ++-- 4 files changed, 61 insertions(+), 78 deletions(-) diff --git a/app/views/admin/dashboard/actions/_form.html.erb b/app/views/admin/dashboard/actions/_form.html.erb index 75cb982a0..478d3c169 100644 --- a/app/views/admin/dashboard/actions/_form.html.erb +++ b/app/views/admin/dashboard/actions/_form.html.erb @@ -1,88 +1,73 @@ <%= render 'shared/errors' %> -
+
+
+ <%= f.label :action_type %> + <% ::Dashboard::Action.action_types.keys.each do |action_type_value| %> + + <%= f.radio_button :action_type, action_type_value, label: false %> + <%= f.label "action_type_#{action_type_value}", t("admin.dashboard.actions.action_type.#{action_type_value}") %> + + <% end %> +
+ +
+ <%= f.check_box :request_to_administrators, label: ::Dashboard::Action.human_attribute_name(:request_to_administrators) %> +
+ +
+ <%= f.check_box :active, label: ::Dashboard::Action.human_attribute_name(:active) %> +
+
+ +
<%= f.label :title %> <%= f.text_field :title, label: false %> -
-
-
-
<%= f.label :short_description %> <%= f.text_field :short_description, label: false %> -
-
-
-
<%= f.cktext_area :description, ckeditor: { language: I18n.locale } %>
-
-
- <%= f.label :action_type %> - <% ::Dashboard::Action.action_types.keys.each do |action_type_value| %> - <%= f.radio_button :action_type, action_type_value, label: false %> - <%= f.label "action_type_#{action_type_value}", t("admin.dashboard.actions.action_type.#{action_type_value}") %> -
- <% end %> -
-
- -
- <%= f.check_box :request_to_administrators, label: ::Dashboard::Action.human_attribute_name(:request_to_administrators) %> -
- -
-
+
+
<%= f.label :day_offset %> - <%= f.number_field :day_offset, label: false, step: 1, min: 0 %>

<%= t("admin.dashboard.actions.form.day_offset_help_text") %>

+ <%= f.number_field :day_offset, label: false, step: 1, min: 0 %>
-
+
<%= f.label :required_supports %> - <%= f.number_field :required_supports, label: false, step: 1, min: 0 %>

<%= t("admin.dashboard.actions.form.required_supports_help_text") %>

+ <%= f.number_field :required_supports, label: false, step: 1, min: 0 %>
-
+
<%= f.label :order %> +

<%= t("admin.dashboard.actions.form.order_help_text") %>

<%= f.number_field :order, label: false, step: 1, min: 0 %>
-
- <%= f.check_box :active, label: ::Dashboard::Action.human_attribute_name(:active) %> -
- -
-
-
- <% if feature?(:allow_attached_documents) %>
+
<%= render 'documents/nested_documents', documentable: dashboard_action, f: f %> +
<% end %> -
-
-
- - -

-
-
- <%= f.submit(class: 'button expanded', value: t("admin.dashboard.actions.form.submit_button")) %> +
+
+ <%= f.submit(class: "button expanded", value: t("admin.dashboard.actions.form.submit_button")) %>
diff --git a/app/views/admin/dashboard/actions/edit.html.erb b/app/views/admin/dashboard/actions/edit.html.erb index f38dcff2e..d3361524c 100644 --- a/app/views/admin/dashboard/actions/edit.html.erb +++ b/app/views/admin/dashboard/actions/edit.html.erb @@ -1,11 +1,8 @@ -
-
- <%= back_link_to admin_dashboard_actions_path, t("admin.dashboard.actions.edit.back") %> - -

<%= t("admin.dashboard.actions.edit.editing") %>

- - <%= form_for dashboard_action, url: { action: 'update' } do |f| %> - <%= render 'form', f: f %> - <% end %> -
+
+ <%= back_link_to admin_dashboard_actions_path, t("admin.dashboard.actions.edit.back") %> +

<%= t("admin.dashboard.actions.edit.editing") %>

+ +<%= form_for dashboard_action, url: { action: 'update' } do |f| %> + <%= render 'form', f: f %> +<% end %> diff --git a/app/views/admin/dashboard/actions/index.html.erb b/app/views/admin/dashboard/actions/index.html.erb index 980e561a1..660fa7398 100644 --- a/app/views/admin/dashboard/actions/index.html.erb +++ b/app/views/admin/dashboard/actions/index.html.erb @@ -10,9 +10,11 @@ <%= t("admin.dashboard.actions.index.action_title") %> <%= t("admin.dashboard.actions.index.action_type") %> - <%= t("admin.dashboard.actions.index.required_supports") %> <%= t("admin.dashboard.actions.index.action_active") %> - + <%= t("admin.dashboard.actions.index.day_offset") %> + <%= t("admin.dashboard.actions.index.required_supports") %> + <%= t("admin.dashboard.actions.index.order") %> + <%= t("admin.actions.actions") %> @@ -27,16 +29,18 @@ <%= action.title %> <%= t("admin.dashboard.actions.action_type.#{action.action_type}") %> - <%= number_with_delimiter(action.required_supports, delimiter: '.') %> <%= active_human_readable(action.active) %> + <%= number_with_delimiter(action.day_offset, delimiter: '.') %> + <%= number_with_delimiter(action.required_supports, delimiter: '.') %> + <%= action.order %> - <%= link_to t("admin.dashboard.actions.index.edit"), - edit_admin_dashboard_action_path(action), - class: 'edit-banner button hollow' %> - <%= link_to t("admin.dashboard.actions.index.delete"), - admin_dashboard_action_path(action), - method: :delete, - class: 'button hollow alert', + <%= link_to t("admin.dashboard.actions.index.edit"), + edit_admin_dashboard_action_path(action), + class: "button hollow" %> + <%= link_to t("admin.dashboard.actions.index.delete"), + admin_dashboard_action_path(action), + method: :delete, + class: "button hollow alert", data: { confirm: t("admin.actions.confirm") } %> diff --git a/app/views/admin/dashboard/actions/new.html.erb b/app/views/admin/dashboard/actions/new.html.erb index 81b0098ea..adcb1a9a1 100644 --- a/app/views/admin/dashboard/actions/new.html.erb +++ b/app/views/admin/dashboard/actions/new.html.erb @@ -1,11 +1,8 @@ -
-
- <%= back_link_to admin_dashboard_actions_path, t("admin.dashboard.actions.new.back") %> - -

<%= t("admin.dashboard.actions.new.creating") %>

- - <%= form_for dashboard_action, url: { action: 'create' } do |f| %> - <%= render 'form', f: f %> - <% end %> -
+
+ <%= back_link_to admin_dashboard_actions_path, t("admin.dashboard.actions.new.back") %> +

<%= t("admin.dashboard.actions.new.creating") %>

+ +<%= form_for dashboard_action, url: { action: 'create' } do |f| %> + <%= render 'form', f: f %> +<% end %>