<%= @question.title %>
+ <%= AdminWYSIWYGSanitizer.new.sanitize(@question.description) %>
<%= render "answer_form", process: @process, question: @question, answer: @answer %>
diff --git a/db/migrate/20220924224924_add_description_to_legislation_question_translations.rb b/db/migrate/20220924224924_add_description_to_legislation_question_translations.rb
new file mode 100644
index 000000000..d2321b70b
--- /dev/null
+++ b/db/migrate/20220924224924_add_description_to_legislation_question_translations.rb
@@ -0,0 +1,5 @@
+class AddDescriptionToLegislationQuestionTranslations < ActiveRecord::Migration[6.0]
+ def change
+ add_column :legislation_question_translations, :description, :text
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 7b3a7349d..802fe82b0 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -861,6 +861,7 @@ ActiveRecord::Schema.define(version: 2023_02_06_141152) do
t.datetime "updated_at", null: false
t.text "title"
t.datetime "hidden_at"
+ t.text "description"
t.index ["hidden_at"], name: "index_legislation_question_translations_on_hidden_at"
t.index ["legislation_question_id"], name: "index_d34cc1e1fe6d5162210c41ce56533c5afabcdbd3"
t.index ["locale"], name: "index_legislation_question_translations_on_locale"
diff --git a/spec/system/admin/legislation/questions_spec.rb b/spec/system/admin/legislation/questions_spec.rb
index 67601cb59..0fbe2a9ab 100644
--- a/spec/system/admin/legislation/questions_spec.rb
+++ b/spec/system/admin/legislation/questions_spec.rb
@@ -32,6 +32,7 @@ describe "Admin legislation questions", :admin do
click_link "Create question"
fill_in "Question", with: "Question 3"
+ fill_in_ckeditor "Description", with: "A little description about question 3"
click_button "Create question"
expect(page).to have_content "Question 3"
@@ -40,7 +41,7 @@ describe "Admin legislation questions", :admin do
context "Update" do
scenario "Valid legislation question" do
- create(:legislation_question, title: "Question 2", process: process)
+ create(:legislation_question, title: "Question 2", description: "Description 2", process: process)
visit admin_root_path
@@ -57,9 +58,11 @@ describe "Admin legislation questions", :admin do
click_link "Question 2"
fill_in "Question", with: "Question 2b"
+ fill_in_ckeditor "Description", with: "Description 2b"
click_button "Save changes"
expect(page).to have_content "Question 2b"
+ expect(page).to have_ckeditor "Description", with: "Description 2b"
end
end
diff --git a/spec/system/legislation/questions_spec.rb b/spec/system/legislation/questions_spec.rb
index b217ad7f4..41570c6a6 100644
--- a/spec/system/legislation/questions_spec.rb
+++ b/spec/system/legislation/questions_spec.rb
@@ -9,9 +9,9 @@ describe "Legislation" do
end
before do
- create(:legislation_question, process: process, title: "Question 1")
- create(:legislation_question, process: process, title: "Question 2")
- create(:legislation_question, process: process, title: "Question 3")
+ create(:legislation_question, process: process, title: "Question 1", description: "Description 1")
+ create(:legislation_question, process: process, title: "Question 2", description: "Description 2")
+ create(:legislation_question, process: process, title: "Question 3", description: "Description 3")
end
scenario "shows question list" do
@@ -24,16 +24,19 @@ describe "Legislation" do
click_link "Question 1"
expect(page).to have_content("Question 1")
+ expect(page).to have_content("Description 1")
expect(page).to have_content("NEXT QUESTION")
click_link "Next question"
expect(page).to have_content("Question 2")
+ expect(page).to have_content("Description 2")
expect(page).to have_content("NEXT QUESTION")
click_link "Next question"
expect(page).to have_content("Question 3")
+ expect(page).to have_content("Description 3")
expect(page).not_to have_content("NEXT QUESTION")
end
@@ -41,6 +44,7 @@ describe "Legislation" do
visit legislation_process_question_path(process, process.questions.first)
expect(page).to have_content("Question 1")
+ expect(page).to have_content("Description 1")
expect(page).to have_content("Open answers (0)")
end
@@ -48,16 +52,19 @@ describe "Legislation" do
visit legislation_process_question_path(process, process.questions.first)
expect(page).to have_content("Question 1")
+ expect(page).to have_content("Description 1")
expect(page).to have_content("NEXT QUESTION")
click_link "Next question"
expect(page).to have_content("Question 2")
+ expect(page).to have_content("Description 2")
expect(page).to have_content("NEXT QUESTION")
click_link "Next question"
expect(page).to have_content("Question 3")
+ expect(page).to have_content("Description 3")
expect(page).not_to have_content("NEXT QUESTION")
end