Merge pull request #1377 from consul/polls-question-summary

Polls question summary removal
This commit is contained in:
Raimond Garcia
2017-01-30 19:34:14 +01:00
committed by GitHub
12 changed files with 8 additions and 33 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -11,7 +11,6 @@
<thead>
<tr>
<th><%= t("admin.polls.show.table_name") %></th>
<th><%= t("admin.polls.show.table_summary") %></th>
<th class="text-center"><%= t("admin.polls.show.table_assignment") %></th>
</tr>
</thead>
@@ -21,9 +20,6 @@
<td>
<%= question.title %>
</td>
<td>
<%= question.summary %>
</td>
<td class="text-center">
<%= link_to t("admin.polls.show.add_question"),
add_question_admin_poll_path(poll_id: @poll.id, question_id: question.id),

View File

@@ -20,9 +20,6 @@
<p class="note"><%= t("admin.questions.new.valid_answers_note") %></p>
<%= f.text_field :valid_answers, label: false %>
<%= f.text_area :summary, rows: 4, maxlength: 200 %>
<div class="ckeditor">
<%= f.cktext_area :description,
maxlength: Poll::Question.description_max_length,

View File

@@ -34,12 +34,6 @@
</span>
<% end %>
<p>
<strong><%= t("admin.questions.show.summary") %></strong>
<br>
<%= @question.summary %>
</p>
<p>
<strong><%= t("admin.questions.show.description") %></strong>
<br>

View File

@@ -12,8 +12,6 @@
<%= link_to t('poll_questions.show.original_proposal'), @question.proposal %>
</div>
<% end %>
<p><%= @question.summary %></p>
</div>
<div class="small-12 medium-3 column info">

View File

@@ -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:

View File

@@ -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:

View File

@@ -0,0 +1,5 @@
class RemoveSummaryFromPollQuestion < ActiveRecord::Migration
def change
remove_column :poll_questions, :summary
end
end

View File

@@ -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"

View File

@@ -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

View File

@@ -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))