Remove question and external_url fields from proposals

This commit is contained in:
decabeza
2019-03-14 14:06:02 +01:00
parent 9df433eeda
commit 0995480b73
22 changed files with 20 additions and 82 deletions

View File

@@ -52,9 +52,9 @@ class Management::ProposalsController < Management::BaseController
end
def proposal_params
params.require(:proposal).permit(:title, :question, :summary, :description, :external_url,
:video_url, :responsible_name, :tag_list, :terms_of_service,
:geozone_id, :skip_map,
params.require(:proposal).permit(:title, :summary, :description, :video_url,
:responsible_name, :tag_list, :terms_of_service, :geozone_id,
:skip_map,
map_location_attributes: [:latitude, :longitude, :zoom])
end

View File

@@ -96,8 +96,8 @@ class ProposalsController < ApplicationController
private
def proposal_params
params.require(:proposal).permit(:title, :question, :summary, :description, :external_url,
:video_url, :responsible_name, :tag_list, :terms_of_service,
params.require(:proposal).permit(:title, :summary, :description, :video_url,
:responsible_name, :tag_list, :terms_of_service,
:geozone_id, :skip_map, image_attributes: image_attributes,
documents_attributes: [:id, :title, :attachment,
:cached_attachment, :user_id, :_destroy],

View File

@@ -117,7 +117,6 @@ class Proposal < ApplicationRecord
def searchable_values
{ title => "A",
question => "B",
author.username => "B",
tag_list.join(" ") => "B",
geozone.try(:name) => "B",

View File

@@ -22,13 +22,9 @@
<div class="moderation-description">
<p><small><%= proposal.summary %></small></p>
<%= proposal.description %>
<% if proposal.external_url.present? %>
<p><%= text_with_links proposal.external_url %></p>
<% end %>
<% if proposal.video_url.present? %>
<p><%= text_with_links proposal.video_url %></p>
<% end %>
<p><%= proposal.question %></p>
</div>
</td>
<td class="align-top">

View File

@@ -4,7 +4,7 @@
<div class="small-12 column">
<div class="additional-document-link">
<p>
<strong><%= t("proposals.show.title_external_url") %></strong>
<strong><%= t("documents.additional") %></strong>
</p>
<%= render partial: "documents/additional_document", collection: documents, as: :document %>
</div>

View File

@@ -41,11 +41,6 @@
aria: {describedby: "video-url-help-text"} %>
</div>
<div class="small-12 column">
<%= f.label :external_url, t("proposals.form.proposal_external_url") %>
<%= f.text_field :external_url, placeholder: t("proposals.form.proposal_external_url"), label: false %>
</div>
<% if feature?(:allow_images) %>
<div class="images small-12 column">
<%= render "images/nested_image", imageable: @proposal, f: f %>

View File

@@ -42,16 +42,6 @@
</div>
<% end %>
<% if @proposal.external_url.present? %>
<div class="document-link">
<p>
<span class="icon-document"></span>&nbsp;
<strong><%= t("proposals.show.title_external_url") %></strong>
</p>
<%= text_with_links @proposal.external_url %>
</div>
<% end %>
<% if @proposal.video_url.present? %>
<div class="video-link">
<p>
@@ -62,10 +52,6 @@
</div>
<% end %>
<% if @proposal.question.present? %>
<h4><%= @proposal.question %></h4>
<% end %>
<% if @proposal.retired? %>
<div id="retired_explanation" class="callout">
<h2>

View File

@@ -27,7 +27,6 @@ Proposal:
id: integer
title: string
description: string
external_url: string
cached_votes_up: integer
comments_count: integer
hot_score: integer

View File

@@ -2,6 +2,7 @@ en:
documents:
title: Documents
max_documents_allowed_reached_html: You have reached the maximum number of documents allowed! <strong>You have to delete one before you can upload another.</strong>
additional: Additional documentation
form:
title: Documents
title_placeholder: Add a descriptive title for the document

View File

@@ -338,9 +338,6 @@ en:
other: Other
form:
geozone: Scope of operation
proposal_external_url: Link to additional documentation
proposal_question: Proposal question
proposal_question_example_html: "Must be summarised in one question with a Yes or No answer"
proposal_responsible_name: Full name of the person submitting the proposal
proposal_responsible_name_note: "(individually or as representative of a collective; will not be displayed publically)"
proposal_summary: Proposal summary
@@ -462,7 +459,6 @@ en:
share: Share
no_notifications: "This proposal has no notifications."
embed_video_title: "Video on %{proposal}"
title_external_url: "Additional documentation"
title_video_url: "External video"
author: Author
draft: Proposal in draft. Cannot yet get supports, nor does it appear in the list of proposals.

View File

@@ -2,6 +2,7 @@ es:
documents:
title: Documentos
max_documents_allowed_reached_html: "¡Has alcanzado el número máximo de documentos permitidos! <strong>Tienes que eliminar uno antes de poder subir otro.</strong>"
additional: Documentación adicional
form:
title: Documentos
title_placeholder: Añade un título descriptivo para el documento

View File

@@ -338,9 +338,6 @@ es:
other: Otra
form:
geozone: Ámbito de actuación
proposal_external_url: Enlace a documentación adicional
proposal_question: Pregunta de la propuesta
proposal_question_example_html: "Debe ser resumida en una pregunta cuya respuesta sea Sí o No"
proposal_responsible_name: Nombre y apellidos de la persona que hace esta propuesta
proposal_responsible_name_note: "(individualmente o como representante de un colectivo; no se mostrará públicamente)"
proposal_summary: Resumen de la propuesta
@@ -462,7 +459,6 @@ es:
share: Compartir
no_notifications: "Esta propuesta no tiene notificaciones."
embed_video_title: "Vídeo en %{proposal}"
title_external_url: "Documentación adicional"
title_video_url: "Vídeo externo"
author: Autor
draft: Propuesta en borrador. Todavía no puede recoger apoyos, ni aparece en la lista de propuestas.

View File

@@ -28,10 +28,8 @@ section "Creating Proposals" do
description = "<p>#{Faker::Lorem.paragraphs.join("</p><p>")}</p>"
proposal = Proposal.create!(author: author,
title: Faker::Lorem.sentence(3).truncate(60),
question: Faker::Lorem.sentence(3) + "?",
summary: Faker::Lorem.sentence(3),
responsible_name: Faker::Name.name,
external_url: Faker::Internet.url,
description: description,
created_at: rand((Time.current - 1.week)..Time.current),
tag_list: tags.sample(3).join(","),
@@ -51,10 +49,8 @@ section "Creating Archived Proposals" do
months_to_archive_proposals = Setting["months_to_archive_proposals"]
proposal = Proposal.create!(author: author,
title: Faker::Lorem.sentence(3).truncate(60),
question: Faker::Lorem.sentence(3) + "?",
summary: Faker::Lorem.sentence(3),
responsible_name: Faker::Name.name,
external_url: Faker::Internet.url,
description: description,
tag_list: tags.sample(3).join(","),
geozone: Geozone.all.sample,
@@ -73,10 +69,8 @@ section "Creating Successful Proposals" do
description = "<p>#{Faker::Lorem.paragraphs.join("</p><p>")}</p>"
proposal = Proposal.create!(author: author,
title: Faker::Lorem.sentence(3).truncate(60),
question: Faker::Lorem.sentence(3) + "?",
summary: Faker::Lorem.sentence(3),
responsible_name: Faker::Name.name,
external_url: Faker::Internet.url,
description: description,
created_at: rand((Time.current - 1.week)..Time.current),
tag_list: tags.sample(3).join(","),
@@ -94,10 +88,8 @@ section "Creating Successful Proposals" do
description = "<p>#{Faker::Lorem.paragraphs.join("</p><p>")}</p>"
proposal = Proposal.create!(author: author,
title: Faker::Lorem.sentence(4).truncate(60),
question: Faker::Lorem.sentence(6) + "?",
summary: Faker::Lorem.sentence(3),
responsible_name: Faker::Name.name,
external_url: Faker::Internet.url,
description: description,
created_at: rand((Time.current - 1.week)..Time.current),
tag_list: tags.sample(3).join(","),

View File

@@ -0,0 +1,6 @@
class RemoveQuestionAndExternalUrlFromProposals < ActiveRecord::Migration
def change
remove_column :proposals, :question, :string
remove_column :proposals, :external_url, :string
end
end

View File

@@ -728,7 +728,6 @@ ActiveRecord::Schema.define(version: 20190411090023) do
t.string "title", limit: 80
t.text "description"
t.string "question"
t.string "external_url"
t.integer "author_id"
t.datetime "hidden_at"
t.integer "flags_count", default: 0
@@ -1172,8 +1171,6 @@ ActiveRecord::Schema.define(version: 20190411090023) do
create_table "proposals", force: :cascade do |t|
t.string "title", limit: 80
t.text "description"
t.string "question"
t.string "external_url"
t.integer "author_id"
t.datetime "hidden_at"
t.integer "flags_count", default: 0
@@ -1203,7 +1200,6 @@ ActiveRecord::Schema.define(version: 20190411090023) do
t.index ["geozone_id"], name: "index_proposals_on_geozone_id", using: :btree
t.index ["hidden_at"], name: "index_proposals_on_hidden_at", using: :btree
t.index ["hot_score"], name: "index_proposals_on_hot_score", using: :btree
t.index ["question"], name: "index_proposals_on_question", using: :btree
t.index ["summary"], name: "index_proposals_on_summary", using: :btree
t.index ["title"], name: "index_proposals_on_title", using: :btree
t.index ["tsv"], name: "index_proposals_on_tsv", using: :gin

View File

@@ -3,8 +3,6 @@ FactoryBot.define do
sequence(:title) { |n| "Proposal #{n} title" }
sequence(:summary) { |n| "In summary, what we want is... #{n}" }
description "Proposal description"
question "Proposal question"
external_url "http://external_documention.es"
video_url "https://youtu.be/nhuNb0XtRhQ"
responsible_name "John Snow"
terms_of_service "1"

View File

@@ -22,8 +22,6 @@ feature "Admin hidden proposals" do
expect(page).to have_content(proposal.title)
expect(page).to have_content(proposal.summary)
expect(page).to have_content(proposal.description)
expect(page).to have_content(proposal.question)
expect(page).to have_content(proposal.external_url)
expect(page).to have_content(proposal.video_url)
end

View File

@@ -25,7 +25,6 @@ feature "Proposals" do
fill_in "proposal_question", with: "¿Would you like to give assistance to war refugees?"
fill_in "proposal_summary", with: "In summary, what we want is..."
fill_in "proposal_description", with: "This is very important because..."
fill_in "proposal_external_url", with: "http://rescue.org/refugees"
fill_in "proposal_video_url", with: "https://www.youtube.com/watch?v=yRYFKcMa_Ek"
check "proposal_terms_of_service"
@@ -37,7 +36,6 @@ feature "Proposals" do
expect(page).to have_content "¿Would you like to give assistance to war refugees?"
expect(page).to have_content "In summary, what we want is..."
expect(page).to have_content "This is very important because..."
expect(page).to have_content "http://rescue.org/refugees"
expect(page).to have_content "https://www.youtube.com/watch?v=yRYFKcMa_Ek"
expect(page).to have_content user.name
expect(page).to have_content I18n.l(Proposal.last.created_at.to_date)

View File

@@ -127,7 +127,6 @@ feature "Proposals" do
expect(page).to have_content proposal.code
expect(page).to have_content "Proposal question"
expect(page).to have_content "Proposal description"
expect(page).to have_content "http://external_documention.es"
expect(page).to have_content proposal.author.name
expect(page).to have_content I18n.l(proposal.created_at.to_date)
expect(page).to have_selector(avatar(proposal.author.name))
@@ -222,7 +221,6 @@ feature "Proposals" do
fill_in "proposal_question", with: "¿Would you like to give assistance to war refugees?"
fill_in "proposal_summary", with: "In summary, what we want is..."
fill_in "proposal_description", with: "This is very important because..."
fill_in "proposal_external_url", with: "http://rescue.org/refugees"
fill_in "proposal_video_url", with: "https://www.youtube.com/watch?v=yPQfcG-eimk"
fill_in "proposal_responsible_name", with: "Isabel Garcia"
fill_in "proposal_tag_list", with: "Refugees, Solidarity"
@@ -243,7 +241,6 @@ feature "Proposals" do
expect(page).to have_content "¿Would you like to give assistance to war refugees?"
expect(page).to have_content "In summary, what we want is..."
expect(page).to have_content "This is very important because..."
expect(page).to have_content "http://rescue.org/refugees"
expect(page).to have_content "https://www.youtube.com/watch?v=yPQfcG-eimk"
expect(page).to have_content author.name
expect(page).to have_content "Refugees"
@@ -261,7 +258,6 @@ feature "Proposals" do
fill_in "proposal_question", with: "This is a question"
fill_in "proposal_summary", with: "This is the summary"
fill_in "proposal_description", with: "This is the description"
fill_in "proposal_external_url", with: "http://google.com/robots.txt"
fill_in "proposal_responsible_name", with: "Some other robot"
check "proposal_terms_of_service"
@@ -328,7 +324,6 @@ feature "Proposals" do
fill_in "proposal_question", with: "¿Would you like to give assistance to war refugees?"
fill_in "proposal_summary", with: "In summary, what we want is..."
fill_in "proposal_description", with: "This is very important because..."
fill_in "proposal_external_url", with: "http://rescue.org/refugees"
check "proposal_terms_of_service"
click_button "Create proposal"
@@ -442,10 +437,8 @@ feature "Proposals" do
visit new_proposal_path
fill_in "proposal_title", with: "Help refugees"
fill_in "proposal_question", with: "¿Would you like to give assistance to war refugees?"
fill_in "proposal_summary", with: "In summary, what we want is..."
fill_in "proposal_description", with: "This is very important because..."
fill_in "proposal_external_url", with: "http://rescue.org/refugees"
fill_in "proposal_summary", with: "In summary what we want is..."
fill_in_ckeditor "proposal_description", with: "A description with enough characters"
fill_in "proposal_video_url", with: "https://www.youtube.com/watch?v=yPQfcG-eimk"
fill_in "proposal_responsible_name", with: "Isabel Garcia"
check "proposal_terms_of_service"
@@ -632,7 +625,6 @@ feature "Proposals" do
fill_in "proposal_question", with: "¿Would you like to give assistance to war refugees?"
fill_in "proposal_summary", with: "Basically..."
fill_in "proposal_description", with: "Let's do something to end child poverty"
fill_in "proposal_external_url", with: "http://rescue.org/refugees"
fill_in "proposal_responsible_name", with: "Isabel Garcia"
click_button "Save changes"
@@ -1835,7 +1827,6 @@ feature "Successful proposals" do
fill_in "proposal_summary", with: "In summary what we want is..."
fill_in "proposal_question", with: "Would you like to?"
fill_in "proposal_description", with: "This is very important because..."
fill_in "proposal_external_url", with: "http://rescue.org/refugees"
fill_in "proposal_video_url", with: "https://www.youtube.com/watch?v=yPQfcG-eimk"
fill_in "proposal_tag_list", with: "Refugees, Solidarity"
check "proposal_terms_of_service"

View File

@@ -100,7 +100,6 @@ feature "Tags" do
fill_in "proposal_question", with: "¿Would you like to give assistance to war refugees?"
fill_in "proposal_summary", with: "In summary, what we want is..."
fill_in_ckeditor "proposal_description", with: "A description with enough characters"
fill_in "proposal_external_url", with: "http://rescue.org/refugees"
fill_in "proposal_video_url", with: "https://www.youtube.com/watch?v=Ae6gQmhaMn4"
fill_in "proposal_responsible_name", with: "Isabel Garcia"
check "proposal_terms_of_service"
@@ -145,7 +144,6 @@ feature "Tags" do
fill_in "proposal_question", with: "¿Would you like to give assistance to war refugees?"
fill_in "proposal_summary", with: "In summary, what we want is..."
fill_in "proposal_description", with: "A description suitable for this test"
fill_in "proposal_external_url", with: "http://rescue.org/refugees"
fill_in "proposal_responsible_name", with: "Isabel Garcia"
check "proposal_terms_of_service"

View File

@@ -491,12 +491,6 @@ describe Proposal do
expect(results).to eq([proposal])
end
it "searches by question" do
proposal = create(:proposal, question: "to be or not to be")
results = described_class.search("to be or not to be")
expect(results).to eq([proposal])
end
it "searches by author name" do
author = create(:user, username: "Danny Trejo")
proposal = create(:proposal, author: author)
@@ -575,7 +569,6 @@ describe Proposal do
context "order" do
it "orders by weight" do
proposal_question = create(:proposal, question: "stop corruption")
proposal_title = create(:proposal, title: "stop corruption")
proposal_description = create(:proposal, description: "stop corruption")
proposal_summary = create(:proposal, summary: "stop corruption")
@@ -583,9 +576,8 @@ describe Proposal do
results = described_class.search("stop corruption")
expect(results.first).to eq(proposal_title)
expect(results.second).to eq(proposal_question)
expect(results.third).to eq(proposal_summary)
expect(results.fourth).to eq(proposal_description)
expect(results.second).to eq(proposal_summary)
expect(results.third).to eq(proposal_description)
end
it "orders by weight and then by votes" do

View File

@@ -1,8 +1,8 @@
module Proposals
def create_successful_proposals
[create(:proposal, title: "Winter is coming", question: "Do you speak it?",
[create(:proposal, title: "Winter is coming",
cached_votes_up: Proposal.votes_needed_for_success + 100),
create(:proposal, title: "Fire and blood", question: "You talking to me?",
create(:proposal, title: "Fire and blood",
cached_votes_up: Proposal.votes_needed_for_success + 1)]
end