Merge pull request #1724 from consul/feature/add_investment_selected_checbox
Add investment selected checbox & improve view
This commit is contained in:
@@ -51,7 +51,8 @@ class Admin::BudgetInvestmentsController < Admin::BaseController
|
|||||||
|
|
||||||
def budget_investment_params
|
def budget_investment_params
|
||||||
params.require(:budget_investment)
|
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
|
end
|
||||||
|
|
||||||
def load_budget
|
def load_budget
|
||||||
|
|||||||
@@ -6,27 +6,49 @@
|
|||||||
<h1 class="inline-block"><%= @investment.title %></h1>
|
<h1 class="inline-block"><%= @investment.title %></h1>
|
||||||
|
|
||||||
<div class="row small-collapse spending-proposal-info">
|
<div class="row small-collapse spending-proposal-info">
|
||||||
<div class="small-12 medium-4 column">
|
<div class="row">
|
||||||
<p title="<%= t("admin.budget_investments.show.group") %>: <%= @investment.group.name %>">
|
<div class="small-12 medium-4 column">
|
||||||
<strong><%= t("admin.budget_investments.show.heading") %>:</strong>
|
<p title="<%= t("admin.budget_investments.show.group") %>: <%= @investment.group.name %>">
|
||||||
<%= @investment.heading.name %>
|
<strong><%= t("admin.budget_investments.show.heading") %>:</strong>
|
||||||
</p>
|
<%= @investment.heading.name %>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="small-12 medium-4 column">
|
||||||
|
<p>
|
||||||
|
<strong><%= t("admin.budget_investments.show.by") %>:</strong>
|
||||||
|
<%= link_to @investment.author.name, admin_hidden_user_path(@investment.author) %>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="small-12 medium-4 column">
|
||||||
|
<p>
|
||||||
|
<strong><%= t("admin.budget_investments.show.sent") %>:</strong>
|
||||||
|
<%= l @investment.created_at, format: :datetime %>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="small-12 medium-4 column">
|
<div class="row">
|
||||||
<p>
|
<div class="small-12 medium-4 column">
|
||||||
<strong><%= t("admin.budget_investments.show.by") %>:</strong>
|
<p>
|
||||||
<%= link_to @investment.author.name, admin_hidden_user_path(@investment.author) %>
|
<strong><%= t("admin.budget_investments.show.compatibility.title") %>:</strong>
|
||||||
</p>
|
<%= t("admin.budget_investments.show.compatibility.#{@investment.incompatible?}") %>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="small-12 medium-4 column">
|
||||||
|
<p>
|
||||||
|
<strong><%= t("admin.budget_investments.show.selection.title") %>:</strong>
|
||||||
|
<%= t("admin.budget_investments.show.selection.#{@investment.selected?}") %>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="small-12 medium-4 column">
|
||||||
|
<p>
|
||||||
|
<strong><%= t("admin.budget_investments.show.winner.title") %>:</strong>
|
||||||
|
<%= t("admin.budget_investments.show.winner.#{@investment.winner?}") %>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="small-12 medium-4 column">
|
|
||||||
<p>
|
|
||||||
<strong><%= t("admin.budget_investments.show.sent") %>:</strong>
|
|
||||||
<%= l @investment.created_at, format: :datetime %>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% if @investment.external_url.present? %>
|
<% if @investment.external_url.present? %>
|
||||||
|
|||||||
@@ -61,15 +61,22 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2 id="incompatible"><%= t("admin.budget_investments.edit.compatibility") %></h2>
|
|
||||||
|
|
||||||
<div class="row">
|
<div class="row margin-top">
|
||||||
<div class="small-12 medium-8 column">
|
<div class="small-12 medium-3 column">
|
||||||
|
<h2 id="incompatible"><%= t("admin.budget_investments.edit.compatibility") %></h2>
|
||||||
<%= f.label :incompatible do %>
|
<%= f.label :incompatible do %>
|
||||||
<%= f.check_box :incompatible, title: t('admin.budget_investments.edit.compatibility'), label: false %>
|
<%= f.check_box :incompatible, title: t('admin.budget_investments.edit.compatibility'), label: false %>
|
||||||
<span class="checkbox"><%= t("admin.budget_investments.edit.mark_as_incompatible") %></span>
|
<span class="checkbox"><%= t("admin.budget_investments.edit.mark_as_incompatible") %></span>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="small-12 medium-3 column float-left">
|
||||||
|
<h2 id="selected"><%= t("admin.budget_investments.edit.selection") %></h2>
|
||||||
|
<%= f.label :selected do %>
|
||||||
|
<%= f.check_box :selected, title: t('admin.budget_investments.edit.selection'), label: false %>
|
||||||
|
<span class="checkbox"><%= t("admin.budget_investments.edit.mark_as_selected") %></span>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="margin-top">
|
<div class="margin-top">
|
||||||
|
|||||||
@@ -56,8 +56,3 @@
|
|||||||
<p>
|
<p>
|
||||||
<%= link_to t("admin.budget_investments.show.new_milestone"), new_admin_budget_budget_investment_budget_investment_milestone_path(@budget, @investment) %>
|
<%= link_to t("admin.budget_investments.show.new_milestone"), new_admin_budget_budget_investment_budget_investment_milestone_path(@budget, @investment) %>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h2 id="incompatible"><%= t("admin.budget_investments.show.compatibility.title") %></h2>
|
|
||||||
<p id="incompatible">
|
|
||||||
<%= t("admin.budget_investments.show.compatibility.#{@investment.incompatible?}") %>
|
|
||||||
</p>
|
|
||||||
|
|||||||
@@ -163,10 +163,20 @@ en:
|
|||||||
title: Compatibility
|
title: Compatibility
|
||||||
"true": Incompatible
|
"true": Incompatible
|
||||||
"false": Compatible
|
"false": Compatible
|
||||||
|
selection:
|
||||||
|
title: Selection
|
||||||
|
"true": Selected
|
||||||
|
"false": Not selected
|
||||||
|
winner:
|
||||||
|
title: Winner
|
||||||
|
"true": "Yes"
|
||||||
|
"false": "No"
|
||||||
edit:
|
edit:
|
||||||
classification: Clasification
|
classification: Clasification
|
||||||
compatibility: Compatibility
|
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
|
assigned_valuators: Valuators
|
||||||
select_heading: Select heading
|
select_heading: Select heading
|
||||||
submit_button: Update
|
submit_button: Update
|
||||||
|
|||||||
@@ -163,10 +163,20 @@ es:
|
|||||||
title: Compatibilidad
|
title: Compatibilidad
|
||||||
"true": Incompatible
|
"true": Incompatible
|
||||||
"false": Compatible
|
"false": Compatible
|
||||||
|
selection:
|
||||||
|
title: Selección
|
||||||
|
"true": Seleccionado
|
||||||
|
"false": No seleccionado
|
||||||
|
winner:
|
||||||
|
title: Ganador
|
||||||
|
"true": "Si"
|
||||||
|
"false": "No"
|
||||||
edit:
|
edit:
|
||||||
classification: Clasificación
|
classification: Clasificación
|
||||||
compatibility: Compatibilidad
|
compatibility: Compatibilidad
|
||||||
mark_as_incompatible: Marcar esta propuesta de inversión como incompatible
|
mark_as_incompatible: Marcar como incompatible
|
||||||
|
selection: Selección
|
||||||
|
mark_as_selected: Marcar como seleccionado
|
||||||
assigned_valuators: Evaluadores
|
assigned_valuators: Evaluadores
|
||||||
select_heading: Seleccionar partida
|
select_heading: Seleccionar partida
|
||||||
submit_button: Actualizar
|
submit_button: Actualizar
|
||||||
|
|||||||
@@ -312,7 +312,7 @@ feature 'Admin budget investments' do
|
|||||||
context "Edit" do
|
context "Edit" do
|
||||||
|
|
||||||
scenario "Change title, incompatible, description or heading" 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")
|
create(:budget_heading, group: budget_investment.group, name: "Barbate")
|
||||||
|
|
||||||
visit admin_budget_budget_investment_path(budget_investment.budget, budget_investment)
|
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'
|
fill_in 'budget_investment_description', with: 'Carrots'
|
||||||
select "#{budget_investment.group.name}: Barbate", from: 'budget_investment[heading_id]'
|
select "#{budget_investment.group.name}: Barbate", from: 'budget_investment[heading_id]'
|
||||||
check "budget_investment_incompatible"
|
check "budget_investment_incompatible"
|
||||||
|
check "budget_investment_selected"
|
||||||
|
|
||||||
click_button 'Update'
|
click_button 'Update'
|
||||||
|
|
||||||
@@ -329,6 +330,7 @@ feature 'Admin budget investments' do
|
|||||||
expect(page).to have_content 'Carrots'
|
expect(page).to have_content 'Carrots'
|
||||||
expect(page).to have_content 'Barbate'
|
expect(page).to have_content 'Barbate'
|
||||||
expect(page).to have_content 'Incompatible'
|
expect(page).to have_content 'Incompatible'
|
||||||
|
expect(page).to have_content 'Selected'
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Add administrator" do
|
scenario "Add administrator" do
|
||||||
|
|||||||
Reference in New Issue
Block a user