Added investment's user generated tags to admin interface form
This commit is contained in:
@@ -51,7 +51,7 @@ 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,
|
.permit(:title, :description, :external_url, :heading_id, :administrator_id, :tag_list, :valuation_tag_list, :incompatible,
|
||||||
:selected, valuator_ids: [])
|
:selected, valuator_ids: [])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,13 @@
|
|||||||
<%= f.cktext_area :description, maxlength: Budget::Investment.description_max_length, ckeditor: { language: I18n.locale } %>
|
<%= f.cktext_area :description, maxlength: Budget::Investment.description_max_length, ckeditor: { language: I18n.locale } %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="small-12 column">
|
||||||
|
<%= f.label :tag_list, t("admin.budget_investments.edit.user_tags") %>
|
||||||
|
<%= f.text_field :tag_list,
|
||||||
|
value: @investment.tag_list.sort.join(','),
|
||||||
|
label: false %>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="small-12 column">
|
<div class="small-12 column">
|
||||||
<%= f.text_field :external_url %>
|
<%= f.text_field :external_url %>
|
||||||
</div>
|
</div>
|
||||||
@@ -39,7 +46,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<div class="small-12 column">
|
<div class="small-12 column">
|
||||||
<%= f.label :tag_list, t("admin.budget_investments.edit.tags") %>
|
<%= f.label :valuation_tag_list, t("admin.budget_investments.edit.tags") %>
|
||||||
<div class="tags">
|
<div class="tags">
|
||||||
<% @tags.each do |tag| %>
|
<% @tags.each do |tag| %>
|
||||||
<a class="js-add-tag-link"><%= tag.name %></a>
|
<a class="js-add-tag-link"><%= tag.name %></a>
|
||||||
|
|||||||
@@ -181,6 +181,7 @@ en:
|
|||||||
assigned_valuators: Valuators
|
assigned_valuators: Valuators
|
||||||
select_heading: Select heading
|
select_heading: Select heading
|
||||||
submit_button: Update
|
submit_button: Update
|
||||||
|
user_tags: User assigned tags
|
||||||
tags: Tags
|
tags: Tags
|
||||||
tags_placeholder: "Write the tags you want separated by commas (,)"
|
tags_placeholder: "Write the tags you want separated by commas (,)"
|
||||||
undefined: Undefined
|
undefined: Undefined
|
||||||
|
|||||||
@@ -181,6 +181,7 @@ es:
|
|||||||
assigned_valuators: Evaluadores
|
assigned_valuators: Evaluadores
|
||||||
select_heading: Seleccionar partida
|
select_heading: Seleccionar partida
|
||||||
submit_button: Actualizar
|
submit_button: Actualizar
|
||||||
|
user_tags: Etiquetas asignadas por el usuario
|
||||||
tags: Etiquetas
|
tags: Etiquetas
|
||||||
tags_placeholder: "Escribe las etiquetas que desees separadas por comas (,)"
|
tags_placeholder: "Escribe las etiquetas que desees separadas por comas (,)"
|
||||||
undefined: Sin definir
|
undefined: Sin definir
|
||||||
|
|||||||
@@ -421,20 +421,37 @@ feature 'Admin budget investments' do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Only displays valuation tags" do
|
scenario "Changes valuation and user generated tags" do
|
||||||
budget_investment = create(:budget_investment, tag_list: 'Park')
|
budget_investment = create(:budget_investment, tag_list: 'Park')
|
||||||
budget_investment.set_tag_list_on(:valuation, 'Education')
|
budget_investment.set_tag_list_on(:valuation, 'Education')
|
||||||
budget_investment.save
|
budget_investment.save
|
||||||
|
|
||||||
visit admin_budget_budget_investment_path(budget_investment.budget, budget_investment)
|
visit admin_budget_budget_investment_path(budget_investment.budget, budget_investment)
|
||||||
|
|
||||||
expect(page).to have_content "Education"
|
within("#user-tags") do
|
||||||
expect(page).to_not have_content "Park"
|
expect(page).to_not have_content "Education"
|
||||||
|
expect(page).to have_content "Park"
|
||||||
|
end
|
||||||
|
|
||||||
click_link 'Edit classification'
|
click_link 'Edit classification'
|
||||||
|
|
||||||
expect(page).to have_content "Education"
|
fill_in 'budget_investment_tag_list', with: 'Park, Trees'
|
||||||
expect(page).to_not have_content "Park"
|
fill_in 'budget_investment_valuation_tag_list', with: 'Education, Environment'
|
||||||
|
click_button 'Update'
|
||||||
|
|
||||||
|
visit admin_budget_budget_investment_path(budget_investment.budget, budget_investment)
|
||||||
|
|
||||||
|
within("#user-tags") do
|
||||||
|
expect(page).to_not have_content "Education"
|
||||||
|
expect(page).to_not have_content "Environment"
|
||||||
|
expect(page).to have_content "Park, Trees"
|
||||||
|
end
|
||||||
|
|
||||||
|
within("#tags") do
|
||||||
|
expect(page).to have_content "Education, Environment"
|
||||||
|
expect(page).to_not have_content "Park"
|
||||||
|
expect(page).to_not have_content "Trees"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Maintains user tags" do
|
scenario "Maintains user tags" do
|
||||||
|
|||||||
Reference in New Issue
Block a user