- <%= render_recommendation_image(recommended, image_default) %>
+ <%= render_recommendation_image(recommended) %>
<%= link_to recommended_path(recommended) do %>
<%= recommended.title %>
diff --git a/config/locales/en/activerecord.yml b/config/locales/en/activerecord.yml
index 17f39b6dc..47f5fe23a 100644
--- a/config/locales/en/activerecord.yml
+++ b/config/locales/en/activerecord.yml
@@ -296,7 +296,6 @@ en:
public_interests: "Keep the elements I follow public"
recommended_debates: "Recommend debates to me"
recommended_proposals: "Recommend proposals to me"
- redeemable_code: "Verification code received via email"
direct_message:
title: "Title"
body: "Message"
diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml
index f51a3daf6..d842a34fa 100644
--- a/config/locales/en/admin.yml
+++ b/config/locales/en/admin.yml
@@ -1134,18 +1134,11 @@ en:
multiple_description: "Allows to choose multiple answers. It's possible to set the maximum number of answers."
questions:
index:
- title: "Questions"
create: "Create question"
- no_questions: "There are no questions."
- filter_poll: Filter by Poll
select_poll: Select Poll
- questions_tab: "Questions"
successful_proposals_tab: "Successful proposals"
create_question: "Create question"
table_proposal: "Proposal"
- table_question: "Question"
- table_poll: "Poll"
- poll_not_assigned: "Poll not assigned"
edit:
title: "Edit Question"
form:
@@ -1166,7 +1159,6 @@ en:
edit_question: Edit question
valid_answers: Valid answers
add_answer: Add answer
- video_url: External video
answers:
title: Answer
description: Description
diff --git a/config/locales/en/general.yml b/config/locales/en/general.yml
index d62b8a1f5..4ee75c137 100644
--- a/config/locales/en/general.yml
+++ b/config/locales/en/general.yml
@@ -569,7 +569,6 @@ en:
support: "You just have to click on the button that you will see below 'Support this proposal' and you can inform yourself about before promoting it. Only the proposals that achieve the maximum support will be carried out by the City Council, and I thought that you, I'm sure you help me achieve it!"
share: "And if you also do me the great favor of sharing my proposal with your friends, family and contacts, it would be perfect!"
polls:
- all: "All"
dates: "From %{open_at} to %{closed_at}"
final_date: "Final recounts/Results"
index:
diff --git a/config/locales/es/activerecord.yml b/config/locales/es/activerecord.yml
index a2ba75682..3fe8f2540 100644
--- a/config/locales/es/activerecord.yml
+++ b/config/locales/es/activerecord.yml
@@ -296,7 +296,6 @@ es:
public_interests: "Mostrar públicamente los elementos que sigo"
recommended_debates: "Mostrar recomendaciones en el listado de debates"
recommended_proposals: "Mostrar recomendaciones en el listado de propuestas"
- redeemable_code: "Código de verificación por carta (opcional)"
direct_message:
title: "Título"
body: "Mensaje"
diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml
index 993c8594a..ffa0f58f4 100644
--- a/config/locales/es/admin.yml
+++ b/config/locales/es/admin.yml
@@ -1134,18 +1134,11 @@ es:
multiple_description: "Permite elegir más de una respuesta. Se puede elegir el número máximo de respuestas."
questions:
index:
- title: "Preguntas de votaciones"
create: "Crear pregunta ciudadana"
- no_questions: "No hay ninguna pregunta ciudadana."
- filter_poll: Filtrar por votación
select_poll: Seleccionar votación
- questions_tab: "Preguntas"
successful_proposals_tab: "Propuestas que han superado el umbral"
create_question: "Crear pregunta para votación"
table_proposal: "Propuesta"
- table_question: "Pregunta"
- table_poll: "Votación"
- poll_not_assigned: "Votación no asignada"
edit:
title: "Editar pregunta ciudadana"
form:
@@ -1166,7 +1159,6 @@ es:
edit_question: Editar pregunta
valid_answers: Respuestas válidas
add_answer: Añadir respuesta
- video_url: Vídeo externo
answers:
title: Respuesta
description: Descripción
diff --git a/config/locales/es/general.yml b/config/locales/es/general.yml
index ff88aca9c..458f437a8 100644
--- a/config/locales/es/general.yml
+++ b/config/locales/es/general.yml
@@ -569,7 +569,6 @@ es:
support: "Tan sólo tienes que hacer clic en el botón que verás a continuación 'Apoyar esta propuesta' y directamente podrás informarte acerca de ella antes de impulsarla. Sólo las propuestas que consigan el máximo apoyo se llevarán a cabo por parte del Ayuntamiento, y he pensado que tú ¡seguro que me ayudas a lograrlo!"
share: "Y si además, me haces el gran favor de compartir mi propuesta con tus amigos, familiares y contactos ¡sería perfecto!"
polls:
- all: "Todas"
dates: "Desde el %{open_at} hasta el %{closed_at}"
final_date: "Recuento final/Resultados"
index:
diff --git a/config/routes/admin.rb b/config/routes/admin.rb
index e0eec7867..7407e6736 100644
--- a/config/routes/admin.rb
+++ b/config/routes/admin.rb
@@ -45,6 +45,10 @@ namespace :admin do
resources :debates, only: [:index, :show]
resources :proposals, only: [:index, :show, :update] do
+ collection do
+ get :successful
+ end
+
member do
patch :select
patch :deselect
@@ -192,7 +196,7 @@ namespace :admin do
end
end
- resources :questions, shallow: true do
+ resources :questions, except: :index, shallow: true do
resources :options, except: [:index, :show], controller: "questions/options", shallow: false
resources :options, only: [], controller: "questions/options" do
resources :images, controller: "questions/options/images"
diff --git a/db/migrate/20250222222739_remove_poll_questions_video_url.rb b/db/migrate/20250222222739_remove_poll_questions_video_url.rb
new file mode 100644
index 000000000..bf66fcff5
--- /dev/null
+++ b/db/migrate/20250222222739_remove_poll_questions_video_url.rb
@@ -0,0 +1,5 @@
+class RemovePollQuestionsVideoUrl < ActiveRecord::Migration[7.0]
+ def change
+ remove_column :poll_questions, :video_url, :string
+ end
+end
diff --git a/db/migrate/20250313014205_remove_users_redeemable_code.rb b/db/migrate/20250313014205_remove_users_redeemable_code.rb
new file mode 100644
index 000000000..79db34579
--- /dev/null
+++ b/db/migrate/20250313014205_remove_users_redeemable_code.rb
@@ -0,0 +1,5 @@
+class RemoveUsersRedeemableCode < ActiveRecord::Migration[7.0]
+ def change
+ remove_column :users, :redeemable_code, :string
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index e3b541dc0..a3c4a7b45 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema[7.0].define(version: 2024_10_26_112901) do
+ActiveRecord::Schema[7.0].define(version: 2025_03_13_014205) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_trgm"
enable_extension "plpgsql"
@@ -1138,7 +1138,6 @@ ActiveRecord::Schema[7.0].define(version: 2024_10_26_112901) do
t.datetime "created_at", precision: nil
t.datetime "updated_at", precision: nil
t.tsvector "tsv"
- t.string "video_url"
t.index ["author_id"], name: "index_poll_questions_on_author_id"
t.index ["poll_id"], name: "index_poll_questions_on_poll_id"
t.index ["proposal_id"], name: "index_poll_questions_on_proposal_id"
@@ -1612,7 +1611,6 @@ ActiveRecord::Schema[7.0].define(version: 2024_10_26_112901) do
t.string "locale"
t.string "oauth_email"
t.integer "geozone_id"
- t.string "redeemable_code"
t.string "gender", limit: 10
t.datetime "date_of_birth", precision: nil
t.boolean "email_digest", default: true
diff --git a/spec/components/admin/poll/questions/filter_component_spec.rb b/spec/components/admin/poll/questions/filter_component_spec.rb
deleted file mode 100644
index 3da7270ad..000000000
--- a/spec/components/admin/poll/questions/filter_component_spec.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-require "rails_helper"
-
-describe Admin::Poll::Questions::FilterComponent do
- it "renders a button to submit the form" do
- render_inline Admin::Poll::Questions::FilterComponent.new([])
-
- expect(page).to have_button "Filter"
- end
-end
diff --git a/spec/components/admin/proposals/index_component_spec.rb b/spec/components/admin/proposals/index_component_spec.rb
new file mode 100644
index 000000000..e1620e76c
--- /dev/null
+++ b/spec/components/admin/proposals/index_component_spec.rb
@@ -0,0 +1,35 @@
+require "rails_helper"
+
+describe Admin::Proposals::IndexComponent, controller: Admin::ProposalsController do
+ around do |example|
+ with_request_url(Rails.application.routes.url_helpers.admin_proposals_path) { example.run }
+ end
+
+ describe "#successful_proposals_link" do
+ it "is shown when there are successful proposals" do
+ create(:proposal, :successful)
+
+ render_inline Admin::Proposals::IndexComponent.new(Proposal.page(1))
+
+ expect(page).to have_link "Successful proposals"
+ end
+
+ it "is not shown when there aren't any successful proposals" do
+ create(:proposal)
+
+ render_inline Admin::Proposals::IndexComponent.new(Proposal.page(1))
+
+ expect(page).not_to have_link "Successful proposals"
+ end
+
+ it "is shown when there are successful proposals on a previous page" do
+ allow(Proposal).to receive(:default_per_page).and_return(1)
+ create(:proposal, :successful)
+ create(:proposal)
+
+ render_inline Admin::Proposals::IndexComponent.new(Proposal.order(:id).page(2))
+
+ expect(page).to have_link "Successful proposals"
+ end
+ end
+end
diff --git a/spec/system/admin/poll/questions_spec.rb b/spec/system/admin/poll/questions_spec.rb
index b71f92db5..127dca219 100644
--- a/spec/system/admin/poll/questions_spec.rb
+++ b/spec/system/admin/poll/questions_spec.rb
@@ -118,10 +118,9 @@ describe "Admin poll questions", :admin do
create(:poll, :future, name: "Proposals")
proposal = create(:proposal, :successful)
- visit admin_proposal_path(proposal)
-
- expect(page).to have_content("This proposal has reached the required supports")
- click_link "Add this proposal to a poll to be voted"
+ visit admin_proposals_path
+ click_link "Successful proposals"
+ click_link "Create question"
expect(page).to have_current_path(new_admin_question_path, ignore_query: true)
expect(page).to have_field("Question", with: proposal.title)
@@ -130,11 +129,7 @@ describe "Admin poll questions", :admin do
click_button "Save"
- expect(page).to have_content(proposal.title)
-
- visit admin_questions_path
-
- expect(page).to have_content(proposal.title)
+ expect(page).to have_content proposal.title
end
scenario "Update" do
diff --git a/spec/system/admin/translatable_spec.rb b/spec/system/admin/translatable_spec.rb
index 8a8dc8128..707682aea 100644
--- a/spec/system/admin/translatable_spec.rb
+++ b/spec/system/admin/translatable_spec.rb
@@ -130,8 +130,6 @@ describe "Admin edit translatable records", :admin do
end
context "Add an invalid translation" do
- let(:translatable) { create(:budget_investment) }
-
context "Input field" do
let(:translatable) { create(:budget, main_link_url: "https://consuldemocracy.org") }
diff --git a/spec/system/budget_polls/questions_spec.rb b/spec/system/budget_polls/questions_spec.rb
deleted file mode 100644
index bc96e8e0c..000000000
--- a/spec/system/budget_polls/questions_spec.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-require "rails_helper"
-
-describe "Poll Questions", :admin do
- scenario "Do not display polls associated to a budget" do
- create(:poll, name: "Citizen Proposal Poll")
- create(:poll, :for_budget, name: "Participatory Budget Poll")
-
- visit admin_questions_path
-
- expect(page).to have_select("poll_id", text: "Citizen Proposal Poll")
- expect(page).not_to have_select("poll_id", text: "Participatory Budget Poll")
- end
-end
diff --git a/spec/system/budgets/budgets_spec.rb b/spec/system/budgets/budgets_spec.rb
index 9b6207af5..17d0a9fc8 100644
--- a/spec/system/budgets/budgets_spec.rb
+++ b/spec/system/budgets/budgets_spec.rb
@@ -1,9 +1,7 @@
require "rails_helper"
describe "Budgets" do
- let(:budget) { create(:budget) }
- let(:level_two_user) { create(:user, :level_two) }
- let(:allowed_phase_list) { ["balloting", "reviewing_ballots", "finished"] }
+ let(:budget) { create(:budget) }
context "Load" do
before { budget.update(slug: "budget_slug") }
diff --git a/spec/system/budgets/stats_spec.rb b/spec/system/budgets/stats_spec.rb
index b6bd86977..e426121fc 100644
--- a/spec/system/budgets/stats_spec.rb
+++ b/spec/system/budgets/stats_spec.rb
@@ -1,8 +1,7 @@
require "rails_helper"
describe "Stats" do
- let(:budget) { create(:budget, :finished) }
- let(:heading) { create(:budget_heading, budget: budget, price: 1000) }
+ let(:budget) { create(:budget, :finished) }
context "Load" do
before { budget.update(slug: "budget_slug") }
diff --git a/spec/system/comments/legislation_annotations_spec.rb b/spec/system/comments/legislation_annotations_spec.rb
index e439be1dd..22d169430 100644
--- a/spec/system/comments/legislation_annotations_spec.rb
+++ b/spec/system/comments/legislation_annotations_spec.rb
@@ -2,7 +2,6 @@ require "rails_helper"
describe "Commenting legislation annotations" do
let(:user) { create(:user) }
- let(:annotation) { create(:legislation_annotation, author: user) }
describe "Merged comment threads" do
let!(:draft_version) { create(:legislation_draft_version, :published) }
diff --git a/spec/system/management/users_spec.rb b/spec/system/management/users_spec.rb
index 3b183b0fa..b35cec7c8 100644
--- a/spec/system/management/users_spec.rb
+++ b/spec/system/management/users_spec.rb
@@ -72,6 +72,7 @@ describe "Users" do
scenario "Delete a level 2 user account from document verification page" do
level_2_user = create(:user, :level_two, document_number: "12345678Z")
manager = create(:manager)
+ administrator = create(:administrator)
login_as_manager(manager)
visit management_document_verifications_path
@@ -92,7 +93,7 @@ describe "Users" do
expect(page).to have_content "no user account associated to it"
logout
- login_as(create(:administrator).user)
+ login_as(administrator.user)
visit admin_users_path(filter: "erased")
diff --git a/spec/system/registration_form_spec.rb b/spec/system/registration_form_spec.rb
index ab7df5ce2..48ce98c1c 100644
--- a/spec/system/registration_form_spec.rb
+++ b/spec/system/registration_form_spec.rb
@@ -38,26 +38,6 @@ describe "Registration form" do
expect(page).to have_content "can't be blank"
end
- scenario "do not save blank redeemable codes" do
- visit new_user_registration_path(use_redeemable_code: "true")
-
- fill_in "user_username", with: "NewUserWithCode77"
- fill_in "user_email", with: "new@consul.dev"
- fill_in "user_password", with: "password"
- fill_in "user_password_confirmation", with: "password"
- fill_in "user_redeemable_code", with: " "
- check "user_terms_of_service"
-
- click_button "Register"
-
- expect(page).to have_title "Confirm your email address"
- expect(page).to have_content "Thank you for registering"
-
- new_user = User.last
- expect(new_user.username).to eq("NewUserWithCode77")
- expect(new_user.redeemable_code).to be nil
- end
-
scenario "Create with invisible_captcha honeypot field", :no_js do
visit new_user_registration_path
diff --git a/spec/system/tags/budget_investments_spec.rb b/spec/system/tags/budget_investments_spec.rb
index 8f49284dd..3f3d4cdac 100644
--- a/spec/system/tags/budget_investments_spec.rb
+++ b/spec/system/tags/budget_investments_spec.rb
@@ -10,7 +10,6 @@ describe "Tags" do
end
let!(:tag_medio_ambiente) { create(:tag, :category, name: "Medio Ambiente") }
let!(:tag_economia) { create(:tag, :category, name: "Economía") }
- let(:admin) { create(:administrator).user }
scenario "Index" do
earth = create(:budget_investment, heading: heading, tag_list: tag_medio_ambiente.name)
diff --git a/spec/system/users_spec.rb b/spec/system/users_spec.rb
index 4d9d1e31c..204fa2673 100644
--- a/spec/system/users_spec.rb
+++ b/spec/system/users_spec.rb
@@ -213,8 +213,6 @@ describe "Users" do
end
describe "User email" do
- let(:user) { create(:user) }
-
scenario "is not shown if no user logged in" do
visit user_path(user)
expect(page).not_to have_content(user.email)
diff --git a/spec/system/welcome_spec.rb b/spec/system/welcome_spec.rb
index 79d4b1af5..584365be9 100644
--- a/spec/system/welcome_spec.rb
+++ b/spec/system/welcome_spec.rb
@@ -1,8 +1,6 @@
require "rails_helper"
describe "Welcome screen" do
- let(:budget) { create(:budget) }
-
it_behaves_like "remotely_translatable", :proposal, "root_path", {}
it_behaves_like "remotely_translatable", :debate, "root_path", {}
it_behaves_like "remotely_translatable", :legislation_process, "root_path", {}
diff --git a/spec/views/welcome/index.html.erb_spec.rb b/spec/views/welcome/index.html.erb_spec.rb
index 411c999c5..2f71ce7d3 100644
--- a/spec/views/welcome/index.html.erb_spec.rb
+++ b/spec/views/welcome/index.html.erb_spec.rb
@@ -1,36 +1,34 @@
require "rails_helper"
RSpec.describe "welcome#index" do
- it "Display images on orbit carrousel when we have defined image_default" do
- debate = create(:debate)
+ it "displays images on the orbit carrousel when recommendations have an image" do
+ proposal = create(:proposal, :with_image)
render template: "welcome/_recommended_carousel",
locals: { key: "debates",
- recommendeds: [debate],
+ recommendeds: [proposal],
image_field: nil,
image_version: nil,
- image_default: "https://dummyimage.com/600x400/000/fff",
carousel_size: "medium-6 large-6 medium-centered large-centered",
- btn_text_link: t("welcome.recommended.debates.btn_text_link"),
- btn_path_link: debates_path(order: "recommendations") }
+ btn_text_link: t("welcome.recommended.proposals.btn_text_link"),
+ btn_path_link: proposals_path(order: "recommendations") }
within 'li[data-slide="0"] .card' do
expect(page).to have_css "img"
end
end
- it "Not display images on orbit carrousel when we have not defined image_default" do
- debate = create(:debate)
+ it "does not display images on the orbit carrousel when recommendations don't have an image" do
+ proposal = create(:proposal)
render template: "welcome/_recommended_carousel",
locals: { key: "debates",
- recommendeds: [debate],
+ recommendeds: [proposal],
image_field: nil,
image_version: nil,
- image_default: nil,
carousel_size: "medium-6 large-6 medium-centered large-centered",
- btn_text_link: t("welcome.recommended.debates.btn_text_link"),
- btn_path_link: debates_path(order: "recommendations") }
+ btn_text_link: t("welcome.recommended.proposals.btn_text_link"),
+ btn_path_link: proposals_path(order: "recommendations") }
within 'li[data-slide="0"] .card' do
expect(page).not_to have_css "img"