Add SDG goals/targets to legislation proposals
This commit is contained in:
@@ -58,6 +58,7 @@
|
||||
}
|
||||
|
||||
&.legislation-link,
|
||||
&.legislation-proposals-link,
|
||||
&.legislation-processes-link {
|
||||
@include icon(file-alt, solid);
|
||||
}
|
||||
|
||||
@@ -32,8 +32,12 @@ class SDG::FilterLinksComponent < ApplicationComponent
|
||||
end
|
||||
|
||||
def index_by(advanced_search)
|
||||
if related_model.name == "Legislation::Proposal"
|
||||
legislation_process_proposals_path(params[:id], advanced_search: advanced_search, filter: params[:filter])
|
||||
else
|
||||
polymorphic_path(related_model, advanced_search: advanced_search)
|
||||
end
|
||||
end
|
||||
|
||||
def i18n_namespace
|
||||
parameter_name.pluralize
|
||||
|
||||
@@ -112,7 +112,7 @@ class Legislation::ProcessesController < Legislation::BaseController
|
||||
set_process
|
||||
@phase = :proposals_phase
|
||||
|
||||
@proposals = ::Legislation::Proposal.where(process: @process)
|
||||
@proposals = ::Legislation::Proposal.where(process: @process).filter_by(params[:advanced_search])
|
||||
@proposals = @proposals.search(params[:search]) if params[:search].present?
|
||||
|
||||
@current_filter = "winners" if params[:filter].blank? && @proposals.winners.any?
|
||||
|
||||
@@ -6,6 +6,7 @@ module SDG::Related
|
||||
Budget::Investment
|
||||
Debate
|
||||
Legislation::Process
|
||||
Legislation::Proposal
|
||||
Poll
|
||||
Proposal
|
||||
].freeze
|
||||
|
||||
@@ -13,6 +13,7 @@ class Legislation::Proposal < ApplicationRecord
|
||||
include Notifiable
|
||||
include Imageable
|
||||
include Randomizable
|
||||
include SDG::Relatable
|
||||
|
||||
accepts_nested_attributes_for :documents, allow_destroy: true
|
||||
|
||||
|
||||
@@ -1282,6 +1282,7 @@ en:
|
||||
budget_investments: "Search investments by title, description or heading"
|
||||
debates: "Search debates by title or description"
|
||||
legislation_processes: "Search processes by title or description"
|
||||
legislation_proposals: "Search proposals by title or description"
|
||||
local_census_records: "Search by document number"
|
||||
organizations: "Name, email or phone number"
|
||||
poll_officers: "Search poll officers"
|
||||
|
||||
@@ -11,7 +11,8 @@ en:
|
||||
menu:
|
||||
budget_investments: "Participatory budgets"
|
||||
debates: "Debates"
|
||||
legislation_processes: "Collaborative legislation"
|
||||
legislation_processes: "Legislation processes"
|
||||
legislation_proposals: "Legislation proposals"
|
||||
polls: "Polls"
|
||||
proposals: "Proposals"
|
||||
sdg_content: "Goals and Targets"
|
||||
|
||||
@@ -1281,6 +1281,7 @@ es:
|
||||
budget_investments: "Buscar proyectos por título, descripción o partida"
|
||||
debates: "Buscar debates por título o descripción"
|
||||
legislation_processes: "Buscar procesos por título o descripción"
|
||||
legislation_proposals: "Buscar propuestas por título o descripción"
|
||||
local_census_records: "Búsqueda por número de documento"
|
||||
organizations: "Nombre, email o teléfono"
|
||||
poll_officers: "Buscar presidentes de mesa"
|
||||
|
||||
@@ -11,7 +11,8 @@ es:
|
||||
menu:
|
||||
budget_investments: "Presupuestos participativos"
|
||||
debates: "Debates"
|
||||
legislation_processes: "Legislación colaborativa"
|
||||
legislation_processes: "Procesos legislativos"
|
||||
legislation_proposals: "Propuestas legislativas"
|
||||
polls: "Votaciones"
|
||||
proposals: "Propuestas"
|
||||
sdg_content: "Objetivos y Metas"
|
||||
|
||||
@@ -20,7 +20,8 @@ describe SDGManagement::MenuComponent, type: :component do
|
||||
expect(page).to have_link "SDG homepage"
|
||||
expect(page).to have_link "Participatory budgets"
|
||||
expect(page).to have_link "Debates"
|
||||
expect(page).to have_link "Collaborative legislation"
|
||||
expect(page).to have_link "Legislation processes"
|
||||
expect(page).to have_link "Legislation proposals"
|
||||
expect(page).to have_link "Polls"
|
||||
expect(page).to have_link "Proposals"
|
||||
end
|
||||
@@ -71,7 +72,8 @@ describe SDGManagement::MenuComponent, type: :component do
|
||||
expect(page).to have_link "Goals and Targets"
|
||||
expect(page).to have_link "SDG homepage"
|
||||
expect(page).to have_link "Participatory budgets"
|
||||
expect(page).to have_link "Collaborative legislation"
|
||||
expect(page).to have_link "Legislation processes"
|
||||
expect(page).to have_link "Legislation proposals"
|
||||
expect(page).to have_link "Polls"
|
||||
expect(page).to have_link "Proposals"
|
||||
|
||||
@@ -92,7 +94,8 @@ describe SDGManagement::MenuComponent, type: :component do
|
||||
expect(page).to have_link "Polls"
|
||||
expect(page).to have_link "Proposals"
|
||||
|
||||
expect(page).not_to have_link "Collaborative legislation"
|
||||
expect(page).not_to have_link "Legislation processes"
|
||||
expect(page).not_to have_link "Legislation proposals"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -33,8 +33,8 @@ describe SDG::ProcessEnabled do
|
||||
end
|
||||
|
||||
it "returns false when record or name are not a relatable type" do
|
||||
expect(SDG::ProcessEnabled.new(build(:legislation_proposal))).not_to be_enabled
|
||||
expect(SDG::ProcessEnabled.new("Legislation::Proposal")).not_to be_enabled
|
||||
expect(SDG::ProcessEnabled.new(build(:legislation_question))).not_to be_enabled
|
||||
expect(SDG::ProcessEnabled.new("Legislation::Question")).not_to be_enabled
|
||||
expect(SDG::ProcessEnabled.new("officing/booth")).not_to be_enabled
|
||||
end
|
||||
end
|
||||
|
||||
@@ -26,10 +26,16 @@ describe "SDG Relations", :js do
|
||||
expect(page).to have_css "h2", exact_text: "Debates"
|
||||
expect(page).to have_css "li.is-active h2", exact_text: "Pending"
|
||||
|
||||
within("#side_menu") { click_link "Collaborative legislation" }
|
||||
within("#side_menu") { click_link "Legislation processes" }
|
||||
|
||||
expect(page).to have_current_path "/sdg_management/legislation/processes"
|
||||
expect(page).to have_css "h2", exact_text: "Collaborative legislation"
|
||||
expect(page).to have_css "h2", exact_text: "Legislation processes"
|
||||
expect(page).to have_css "li.is-active h2", exact_text: "Pending"
|
||||
|
||||
within("#side_menu") { click_link "Legislation proposals" }
|
||||
|
||||
expect(page).to have_current_path "/sdg_management/legislation/proposals"
|
||||
expect(page).to have_css "h2", exact_text: "Legislation proposals"
|
||||
expect(page).to have_css "li.is-active h2", exact_text: "Pending"
|
||||
|
||||
within("#side_menu") { click_link "Polls" }
|
||||
|
||||
Reference in New Issue
Block a user