From 39fa6ec2deae074cd77ceda0e4dc8d1120eebbcc Mon Sep 17 00:00:00 2001 From: Bertocq Date: Tue, 4 Jul 2017 23:46:14 +0200 Subject: [PATCH 1/3] Increase admin investment feature to cover selected checkbox --- spec/features/admin/budget_investments_spec.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/features/admin/budget_investments_spec.rb b/spec/features/admin/budget_investments_spec.rb index 375a09770..57dedcb54 100644 --- a/spec/features/admin/budget_investments_spec.rb +++ b/spec/features/admin/budget_investments_spec.rb @@ -312,7 +312,7 @@ feature 'Admin budget investments' do context "Edit" do scenario "Change title, incompatible, description or heading" do - budget_investment = create(:budget_investment) + budget_investment = create(:budget_investment, :selected) create(:budget_heading, group: budget_investment.group, name: "Barbate") visit admin_budget_budget_investment_path(budget_investment.budget, budget_investment) @@ -322,6 +322,7 @@ feature 'Admin budget investments' do fill_in 'budget_investment_description', with: 'Carrots' select "#{budget_investment.group.name}: Barbate", from: 'budget_investment[heading_id]' check "budget_investment_incompatible" + check "budget_investment_selected" click_button 'Update' @@ -329,6 +330,7 @@ feature 'Admin budget investments' do expect(page).to have_content 'Carrots' expect(page).to have_content 'Barbate' expect(page).to have_content 'Incompatible' + expect(page).to have_content 'Selected' end scenario "Add administrator" do From e35817f240e4e7eed90f256af6a81259e6f9e6ff Mon Sep 17 00:00:00 2001 From: Bertocq Date: Tue, 4 Jul 2017 23:48:18 +0200 Subject: [PATCH 2/3] Add selected checkbox on admin investment form --- .../admin/budget_investments_controller.rb | 3 ++- app/views/admin/budget_investments/edit.html.erb | 13 ++++++++++--- config/locales/admin.en.yml | 4 +++- config/locales/admin.es.yml | 4 +++- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/app/controllers/admin/budget_investments_controller.rb b/app/controllers/admin/budget_investments_controller.rb index 8a7f33c3c..dd10930fb 100644 --- a/app/controllers/admin/budget_investments_controller.rb +++ b/app/controllers/admin/budget_investments_controller.rb @@ -51,7 +51,8 @@ class Admin::BudgetInvestmentsController < Admin::BaseController def budget_investment_params params.require(:budget_investment) - .permit(:title, :description, :external_url, :heading_id, :administrator_id, :valuation_tag_list, :incompatible, valuator_ids: []) + .permit(:title, :description, :external_url, :heading_id, :administrator_id, :valuation_tag_list, :incompatible, + :selected, valuator_ids: []) end def load_budget diff --git a/app/views/admin/budget_investments/edit.html.erb b/app/views/admin/budget_investments/edit.html.erb index 0e9b6afc9..1e21ee706 100644 --- a/app/views/admin/budget_investments/edit.html.erb +++ b/app/views/admin/budget_investments/edit.html.erb @@ -61,15 +61,22 @@ -

<%= t("admin.budget_investments.edit.compatibility") %>

-
-
+
+
+

<%= t("admin.budget_investments.edit.compatibility") %>

<%= f.label :incompatible do %> <%= f.check_box :incompatible, title: t('admin.budget_investments.edit.compatibility'), label: false %> <%= t("admin.budget_investments.edit.mark_as_incompatible") %> <% end %>
+
+

<%= t("admin.budget_investments.edit.selection") %>

+ <%= f.label :selected do %> + <%= f.check_box :selected, title: t('admin.budget_investments.edit.selection'), label: false %> + <%= t("admin.budget_investments.edit.mark_as_selected") %> + <% end %> +
diff --git a/config/locales/admin.en.yml b/config/locales/admin.en.yml index 999689492..864222da1 100755 --- a/config/locales/admin.en.yml +++ b/config/locales/admin.en.yml @@ -166,7 +166,9 @@ en: edit: classification: Clasification compatibility: Compatibility - mark_as_incompatible: Mark this investement project as incompatible + mark_as_incompatible: Mark as incompatible + selection: Selection + mark_as_selected: Mark as selected assigned_valuators: Valuators select_heading: Select heading submit_button: Update diff --git a/config/locales/admin.es.yml b/config/locales/admin.es.yml index c77a95062..ca103f661 100644 --- a/config/locales/admin.es.yml +++ b/config/locales/admin.es.yml @@ -166,7 +166,9 @@ es: edit: classification: Clasificación compatibility: Compatibilidad - mark_as_incompatible: Marcar esta propuesta de inversión como incompatible + mark_as_incompatible: Marcar como incompatible + selected: Selección + mark_as_selected: Marcar como seleccionado assigned_valuators: Evaluadores select_heading: Seleccionar partida submit_button: Actualizar From 343da2d58e5122c6cbd3fea4771f86465359dcf7 Mon Sep 17 00:00:00 2001 From: Bertocq Date: Tue, 4 Jul 2017 23:48:39 +0200 Subject: [PATCH 3/3] Improve admin investment view with selection/compatibility/winner flags on top --- .../_written_by_author.html.erb | 58 +++++++++++++------ .../admin/budget_investments/show.html.erb | 5 -- config/locales/admin.en.yml | 8 +++ config/locales/admin.es.yml | 10 +++- 4 files changed, 57 insertions(+), 24 deletions(-) diff --git a/app/views/admin/budget_investments/_written_by_author.html.erb b/app/views/admin/budget_investments/_written_by_author.html.erb index 2ecfa2068..a913aff00 100644 --- a/app/views/admin/budget_investments/_written_by_author.html.erb +++ b/app/views/admin/budget_investments/_written_by_author.html.erb @@ -6,27 +6,49 @@

<%= @investment.title %>

-
-

: <%= @investment.group.name %>"> - <%= t("admin.budget_investments.show.heading") %>: - <%= @investment.heading.name %> -

+
+
+

: <%= @investment.group.name %>"> + <%= t("admin.budget_investments.show.heading") %>: + <%= @investment.heading.name %> +

+
+ +
+

+ <%= t("admin.budget_investments.show.by") %>: + <%= link_to @investment.author.name, admin_hidden_user_path(@investment.author) %> +

+
+ +
+

+ <%= t("admin.budget_investments.show.sent") %>: + <%= l @investment.created_at, format: :datetime %> +

+
-
-

- <%= t("admin.budget_investments.show.by") %>: - <%= link_to @investment.author.name, admin_hidden_user_path(@investment.author) %> -

+
+
+

+ <%= t("admin.budget_investments.show.compatibility.title") %>: + <%= t("admin.budget_investments.show.compatibility.#{@investment.incompatible?}") %> +

+
+
+

+ <%= t("admin.budget_investments.show.selection.title") %>: + <%= t("admin.budget_investments.show.selection.#{@investment.selected?}") %> +

+
+
+

+ <%= t("admin.budget_investments.show.winner.title") %>: + <%= t("admin.budget_investments.show.winner.#{@investment.winner?}") %> +

+
- -
-

- <%= t("admin.budget_investments.show.sent") %>: - <%= l @investment.created_at, format: :datetime %> -

-
-
<% if @investment.external_url.present? %> diff --git a/app/views/admin/budget_investments/show.html.erb b/app/views/admin/budget_investments/show.html.erb index 95fc6c76a..f220c0955 100644 --- a/app/views/admin/budget_investments/show.html.erb +++ b/app/views/admin/budget_investments/show.html.erb @@ -56,8 +56,3 @@

<%= link_to t("admin.budget_investments.show.new_milestone"), new_admin_budget_budget_investment_budget_investment_milestone_path(@budget, @investment) %>

- -

<%= t("admin.budget_investments.show.compatibility.title") %>

-

- <%= t("admin.budget_investments.show.compatibility.#{@investment.incompatible?}") %> -

diff --git a/config/locales/admin.en.yml b/config/locales/admin.en.yml index 864222da1..a2089bbb1 100755 --- a/config/locales/admin.en.yml +++ b/config/locales/admin.en.yml @@ -163,6 +163,14 @@ en: title: Compatibility "true": Incompatible "false": Compatible + selection: + title: Selection + "true": Selected + "false": Not selected + winner: + title: Winner + "true": "Yes" + "false": "No" edit: classification: Clasification compatibility: Compatibility diff --git a/config/locales/admin.es.yml b/config/locales/admin.es.yml index ca103f661..604df1048 100644 --- a/config/locales/admin.es.yml +++ b/config/locales/admin.es.yml @@ -163,11 +163,19 @@ es: title: Compatibilidad "true": Incompatible "false": Compatible + selection: + title: Selección + "true": Seleccionado + "false": No seleccionado + winner: + title: Ganador + "true": "Si" + "false": "No" edit: classification: Clasificación compatibility: Compatibilidad mark_as_incompatible: Marcar como incompatible - selected: Selección + selection: Selección mark_as_selected: Marcar como seleccionado assigned_valuators: Evaluadores select_heading: Seleccionar partida