From 348e4e54f324ec18f16c93e530fc2267717aa863 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa=20Checa?= Date: Tue, 3 Oct 2017 19:11:54 +0200 Subject: [PATCH] Removed question description --- app/controllers/admin/poll/questions_controller.rb | 2 +- app/models/poll/question.rb | 7 ------- app/views/admin/poll/questions/_form.html.erb | 6 ------ ...0171003170029_remove_description_from_poll_questions.rb | 5 +++++ db/schema.rb | 3 +-- 5 files changed, 7 insertions(+), 16 deletions(-) create mode 100644 db/migrate/20171003170029_remove_description_from_poll_questions.rb diff --git a/app/controllers/admin/poll/questions_controller.rb b/app/controllers/admin/poll/questions_controller.rb index 97b301d43..107c06740 100644 --- a/app/controllers/admin/poll/questions_controller.rb +++ b/app/controllers/admin/poll/questions_controller.rb @@ -56,7 +56,7 @@ class Admin::Poll::QuestionsController < Admin::Poll::BaseController private def question_params - params.require(:poll_question).permit(:poll_id, :title, :question, :description, :proposal_id, :valid_answers, :video_url, + params.require(:poll_question).permit(:poll_id, :title, :question, :proposal_id, :valid_answers, :video_url, documents_attributes: [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy]) end diff --git a/app/models/poll/question.rb b/app/models/poll/question.rb index a46f28a8c..55396fd3b 100644 --- a/app/models/poll/question.rb +++ b/app/models/poll/question.rb @@ -23,7 +23,6 @@ class Poll::Question < ActiveRecord::Base validates :poll_id, presence: true validates :title, length: { minimum: 4 } - validates :description, length: { maximum: Poll::Question.description_max_length } scope :by_poll_id, ->(poll_id) { where(poll_id: poll_id) } @@ -40,15 +39,10 @@ class Poll::Question < ActiveRecord::Base def searchable_values { title => 'A', proposal.try(:title) => 'A', - description => 'B', author.username => 'C', author_visible_name => 'C' } end - def description - super.try :html_safe - end - def valid_answers (super.try(:split, ',').compact || []).map(&:strip) end @@ -59,7 +53,6 @@ class Poll::Question < ActiveRecord::Base self.author_visible_name = proposal.author.name self.proposal_id = proposal.id self.title = proposal.title - self.description = proposal.description self.valid_answers = I18n.t('poll_questions.default_valid_answers') end end diff --git a/app/views/admin/poll/questions/_form.html.erb b/app/views/admin/poll/questions/_form.html.erb index 7881936e4..6091c024f 100644 --- a/app/views/admin/poll/questions/_form.html.erb +++ b/app/views/admin/poll/questions/_form.html.erb @@ -20,12 +20,6 @@

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

<%= f.text_field :valid_answers, label: false, aria: {describedby: "valid-answers-help-text"} %> -
- <%= f.cktext_area :description, - maxlength: Poll::Question.description_max_length, - ckeditor: { language: I18n.locale } %> -
-
<%= render 'documents/nested_documents', documentable: @question, f: f %>
diff --git a/db/migrate/20171003170029_remove_description_from_poll_questions.rb b/db/migrate/20171003170029_remove_description_from_poll_questions.rb new file mode 100644 index 000000000..31e1b9578 --- /dev/null +++ b/db/migrate/20171003170029_remove_description_from_poll_questions.rb @@ -0,0 +1,5 @@ +class RemoveDescriptionFromPollQuestions < ActiveRecord::Migration + def change + remove_column :poll_questions, :description + end +end diff --git a/db/schema.rb b/db/schema.rb index e75c2aac3..9381f8e2c 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: 20171003095936) do +ActiveRecord::Schema.define(version: 20171003170029) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -675,7 +675,6 @@ ActiveRecord::Schema.define(version: 20171003095936) do t.string "author_visible_name" t.string "title" t.string "valid_answers" - t.text "description" t.integer "comments_count" t.datetime "hidden_at" t.datetime "created_at"