From 4c54d9da554fb7961231f3d7e2cdb8b632be5a07 Mon Sep 17 00:00:00 2001 From: kikito Date: Mon, 30 Jan 2017 18:30:53 +0100 Subject: [PATCH 1/7] Removes summary from poll_questions table --- .../20170130171322_remove_summary_from_poll_question.rb | 5 +++++ db/schema.rb | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20170130171322_remove_summary_from_poll_question.rb diff --git a/db/migrate/20170130171322_remove_summary_from_poll_question.rb b/db/migrate/20170130171322_remove_summary_from_poll_question.rb new file mode 100644 index 000000000..02c5fb68e --- /dev/null +++ b/db/migrate/20170130171322_remove_summary_from_poll_question.rb @@ -0,0 +1,5 @@ +class RemoveSummaryFromPollQuestion < ActiveRecord::Migration + def change + remove_column :poll_questions, :summary + end +end diff --git a/db/schema.rb b/db/schema.rb index 88a43f82f..544d2a6ff 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20170130163030) do +ActiveRecord::Schema.define(version: 20170130171322) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -443,7 +443,6 @@ ActiveRecord::Schema.define(version: 20170130163030) do t.integer "author_id" t.string "author_visible_name" t.string "title" - t.string "summary" t.string "valid_answers" t.text "description" t.integer "comments_count" From 043e2e3586bf18ec5a9b0859b0c7ca5c558de0d3 Mon Sep 17 00:00:00 2001 From: kikito Date: Mon, 30 Jan 2017 18:37:17 +0100 Subject: [PATCH 2/7] Removes summary from poll::Question model --- app/models/poll/question.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/models/poll/question.rb b/app/models/poll/question.rb index 16786a9b6..5930ee9d8 100644 --- a/app/models/poll/question.rb +++ b/app/models/poll/question.rb @@ -14,7 +14,6 @@ class Poll::Question < ActiveRecord::Base belongs_to :proposal validates :title, presence: true - validates :summary, presence: true validates :author, presence: true validates :title, length: { in: 4..Poll::Question.title_max_length } @@ -35,8 +34,7 @@ class Poll::Question < ActiveRecord::Base def searchable_values { title => 'A', proposal.try(:title) => 'A', - summary => 'B', - description => 'C', + description => 'B', author.username => 'C', author_visible_name => 'C' } end @@ -56,7 +54,6 @@ class Poll::Question < ActiveRecord::Base self.proposal_id = proposal.id self.title = proposal.title self.description = proposal.description - self.summary = proposal.summary self.valid_answers = I18n.t('poll_questions.default_valid_answers') end end From d72dc209870596d3a2f8026272ad3778586eb351 Mon Sep 17 00:00:00 2001 From: kikito Date: Mon, 30 Jan 2017 18:37:38 +0100 Subject: [PATCH 3/7] Removes summary from poll questions controller --- app/controllers/admin/poll/questions_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/admin/poll/questions_controller.rb b/app/controllers/admin/poll/questions_controller.rb index a9a1d0c76..ab7297a95 100644 --- a/app/controllers/admin/poll/questions_controller.rb +++ b/app/controllers/admin/poll/questions_controller.rb @@ -54,7 +54,7 @@ class Admin::Poll::QuestionsController < Admin::BaseController private def question_params - params.require(:poll_question).permit(:poll_id, :title, :question, :summary, :description, :proposal_id, :valid_answers) + params.require(:poll_question).permit(:poll_id, :title, :question, :description, :proposal_id, :valid_answers) end def search_params From bc763c34c28f1f391a0d26e9998b51e60493d7e0 Mon Sep 17 00:00:00 2001 From: kikito Date: Mon, 30 Jan 2017 18:39:21 +0100 Subject: [PATCH 4/7] Removes Poll::Question.summary from views --- .../admin/poll/polls/_search_questions_results.html.erb | 4 ---- app/views/admin/poll/questions/_form.html.erb | 3 --- app/views/admin/poll/questions/show.html.erb | 6 ------ app/views/polls/questions/show.html.erb | 2 -- 4 files changed, 15 deletions(-) diff --git a/app/views/admin/poll/polls/_search_questions_results.html.erb b/app/views/admin/poll/polls/_search_questions_results.html.erb index 27dcbb652..12bc25a85 100644 --- a/app/views/admin/poll/polls/_search_questions_results.html.erb +++ b/app/views/admin/poll/polls/_search_questions_results.html.erb @@ -11,7 +11,6 @@ <%= t("admin.polls.show.table_name") %> - <%= t("admin.polls.show.table_summary") %> <%= t("admin.polls.show.table_assignment") %> @@ -21,9 +20,6 @@ <%= question.title %> - - <%= question.summary %> - <%= link_to t("admin.polls.show.add_question"), add_question_admin_poll_path(poll_id: @poll.id, question_id: question.id), diff --git a/app/views/admin/poll/questions/_form.html.erb b/app/views/admin/poll/questions/_form.html.erb index e5c228b4e..0da36913a 100644 --- a/app/views/admin/poll/questions/_form.html.erb +++ b/app/views/admin/poll/questions/_form.html.erb @@ -20,9 +20,6 @@

<%= t("admin.questions.new.valid_answers_note") %>

<%= f.text_field :valid_answers, label: false %> - - <%= f.text_area :summary, rows: 4, maxlength: 200 %> -
<%= f.cktext_area :description, maxlength: Poll::Question.description_max_length, diff --git a/app/views/admin/poll/questions/show.html.erb b/app/views/admin/poll/questions/show.html.erb index 72109693b..a8f25f2bd 100644 --- a/app/views/admin/poll/questions/show.html.erb +++ b/app/views/admin/poll/questions/show.html.erb @@ -34,12 +34,6 @@ <% end %> -

- <%= t("admin.questions.show.summary") %> -
- <%= @question.summary %> -

-

<%= t("admin.questions.show.description") %>
diff --git a/app/views/polls/questions/show.html.erb b/app/views/polls/questions/show.html.erb index f743d89a9..52b8e3774 100644 --- a/app/views/polls/questions/show.html.erb +++ b/app/views/polls/questions/show.html.erb @@ -12,8 +12,6 @@ <%= link_to t('poll_questions.show.original_proposal'), @question.proposal %>

<% end %> - -

<%= @question.summary %>

From cca6758f719605a95eef7bb4f7fe8977a4ddb630 Mon Sep 17 00:00:00 2001 From: kikito Date: Mon, 30 Jan 2017 18:39:37 +0100 Subject: [PATCH 5/7] Removes poll::question.summary from specs --- spec/features/admin/poll/questions_spec.rb | 6 ------ 1 file changed, 6 deletions(-) diff --git a/spec/features/admin/poll/questions_spec.rb b/spec/features/admin/poll/questions_spec.rb index de26889d6..2a1e100f0 100644 --- a/spec/features/admin/poll/questions_spec.rb +++ b/spec/features/admin/poll/questions_spec.rb @@ -25,7 +25,6 @@ feature 'Admin poll questions' do expect(page).to have_content(question.title) expect(page).to have_content(question.description) - expect(page).to have_content(question.summary) expect(page).to have_content(question.author.name) expect(page).to have_content(question.valid_answers.join(" ")) end @@ -33,7 +32,6 @@ feature 'Admin poll questions' do scenario 'Create' do poll = create(:poll, name: 'Movies') title = "Star Wars: Episode IV - A New Hope" - summary = "It is a period of civil war. Rebel spaceships, striking from a hidden base, have won their first victory against the evil Galactic Empire" description = %{ During the battle, Rebel spies managed to steal secret plans to the Empire's ultimate weapon, the DEATH STAR, an armored space station with enough power to destroy an entire planet. Pursued by the Empire's sinister agents, Princess Leia races home aboard her starship, custodian of the stolen plans that can save her people and restore freedom to the galaxy.... @@ -44,14 +42,12 @@ feature 'Admin poll questions' do select 'Movies', from: 'poll_question_poll_id' fill_in 'poll_question_title', with: title - fill_in 'poll_question_summary', with: summary fill_in 'poll_question_description', with: description click_button 'Save' expect(page).to have_content(title) expect(page).to have_content(description) - expect(page).to have_content(summary) end scenario 'Create from successful proposal index' do @@ -63,7 +59,6 @@ feature 'Admin poll questions' do expect(current_path).to eq(new_admin_question_path) expect(page).to have_field('poll_question_title', with: proposal.title) - expect(page).to have_field('poll_question_summary', with: proposal.summary) expect(page).to have_field('poll_question_description', with: proposal.description) expect(page).to have_field('poll_question_valid_answers', with: "Yes, No") @@ -72,7 +67,6 @@ feature 'Admin poll questions' do click_button 'Save' 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_link(proposal.title, href: proposal_path(proposal)) expect(page).to have_link(proposal.author.name, href: user_path(proposal.author)) From 7fa413b6df02fbf421983a34844b106b3940808b Mon Sep 17 00:00:00 2001 From: kikito Date: Mon, 30 Jan 2017 19:05:16 +0100 Subject: [PATCH 6/7] i18n --- config/locales/admin.en.yml | 2 -- config/locales/admin.es.yml | 2 -- 2 files changed, 4 deletions(-) diff --git a/config/locales/admin.en.yml b/config/locales/admin.en.yml index 7a05586ae..7db4d2d48 100755 --- a/config/locales/admin.en.yml +++ b/config/locales/admin.en.yml @@ -321,7 +321,6 @@ en: search_results: "Search results" no_search_results: "No results found." table_title: "Title" - table_summary: "Summary" table_assignment: "Assignment" table_name: "Name" table_location: "Location" @@ -352,7 +351,6 @@ en: author: Author title: Title valid_answers: Valid answers - summary: Summary description: Description preview: View on website booths: diff --git a/config/locales/admin.es.yml b/config/locales/admin.es.yml index 1a349246a..abe65bd60 100644 --- a/config/locales/admin.es.yml +++ b/config/locales/admin.es.yml @@ -321,7 +321,6 @@ es: search_results: "Resultados de la búsqueda" no_search_results: "No se han encontrado resultados." table_title: "Título" - table_summary: "Resumen" table_assignment: "Asignación" table_name: "Nombre" table_location: "Ubicación" @@ -352,7 +351,6 @@ es: author: Autor title: Título valid_answers: Respuestas válidas - summary: Resumen description: Descripción preview: Ver en la web booths: From 883658e3910b275758f1a4e9f209abce20f86e53 Mon Sep 17 00:00:00 2001 From: kikito Date: Mon, 30 Jan 2017 19:23:47 +0100 Subject: [PATCH 7/7] removes summary from factory --- spec/factories.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/factories.rb b/spec/factories.rb index 3ead9bf0e..706607a37 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -396,7 +396,6 @@ FactoryGirl.define do poll association :author, factory: :user sequence(:title) { |n| "Question title #{n}" } - sequence(:summary) { |n| "Question summary #{n}" } sequence(:description) { |n| "Question description #{n}" } valid_answers { Faker::Lorem.words(3).join(', ') } end