Merge pull request #1605 from bertocq/feature/legislation_process_summary
Legislative Process summary
This commit is contained in:
@@ -35,8 +35,7 @@ class Admin::Legislation::ProcessesController < Admin::Legislation::BaseControll
|
|||||||
def process_params
|
def process_params
|
||||||
params.require(:legislation_process).permit(
|
params.require(:legislation_process).permit(
|
||||||
:title,
|
:title,
|
||||||
:description_summary,
|
:summary,
|
||||||
:target_summary,
|
|
||||||
:description,
|
:description,
|
||||||
:target,
|
:target,
|
||||||
:how_to_participate,
|
:how_to_participate,
|
||||||
|
|||||||
@@ -164,6 +164,19 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="small-12 medium-4 column">
|
||||||
|
<%= f.label :summary %>
|
||||||
|
<small><%= t('admin.legislation.processes.form.use_markdown') %></small>
|
||||||
|
</div>
|
||||||
|
<div class="small-12 medium-8 column">
|
||||||
|
<%= f.text_area :summary,
|
||||||
|
label: false,
|
||||||
|
rows: 2,
|
||||||
|
placeholder: t('admin.legislation.processes.form.summary_placeholder') %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="small-12 medium-4 column">
|
<div class="small-12 medium-4 column">
|
||||||
<%= f.label :description %>
|
<%= f.label :description %>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="small-12 medium-11 column end">
|
<div class="small-12 medium-11 column end">
|
||||||
<%= markdown(first_paragraph(process.description)) %>
|
<%= markdown(process.summary.present? ? process.summary : first_paragraph(process.description)) %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -206,6 +206,7 @@ en:
|
|||||||
end: End
|
end: End
|
||||||
use_markdown: Use Markdown to format the text
|
use_markdown: Use Markdown to format the text
|
||||||
title_placeholder: The title of the process
|
title_placeholder: The title of the process
|
||||||
|
summary_placeholder: Short summary of the description
|
||||||
description_placeholder: Add a description of the process
|
description_placeholder: Add a description of the process
|
||||||
target_placeholder: Describe who is the target of the process
|
target_placeholder: Describe who is the target of the process
|
||||||
how_to_participate_placeholder: Describe how to participate
|
how_to_participate_placeholder: Describe how to participate
|
||||||
|
|||||||
@@ -206,6 +206,7 @@ es:
|
|||||||
end: Fin
|
end: Fin
|
||||||
use_markdown: Usa Markdown para formatear el texto
|
use_markdown: Usa Markdown para formatear el texto
|
||||||
title_placeholder: Escribe el título del proceso
|
title_placeholder: Escribe el título del proceso
|
||||||
|
summary_placeholder: Resumen corto de la descripción
|
||||||
description_placeholder: Añade una descripción del proceso
|
description_placeholder: Añade una descripción del proceso
|
||||||
target_placeholder: Describe a quién va dirigido
|
target_placeholder: Describe a quién va dirigido
|
||||||
how_to_participate_placeholder: Describe cómo participar
|
how_to_participate_placeholder: Describe cómo participar
|
||||||
|
|||||||
@@ -634,6 +634,7 @@ print "Creating legislation processes"
|
|||||||
(1..5).each do |i|
|
(1..5).each do |i|
|
||||||
process = ::Legislation::Process.create!(title: Faker::Lorem.sentence(3).truncate(60),
|
process = ::Legislation::Process.create!(title: Faker::Lorem.sentence(3).truncate(60),
|
||||||
description: Faker::Lorem.paragraphs.join("\n\n"),
|
description: Faker::Lorem.paragraphs.join("\n\n"),
|
||||||
|
summary: Faker::Lorem.paragraph,
|
||||||
target: Faker::Lorem.paragraphs.join("\n\n"),
|
target: Faker::Lorem.paragraphs.join("\n\n"),
|
||||||
how_to_participate: Faker::Lorem.paragraphs.join("\n\n"),
|
how_to_participate: Faker::Lorem.paragraphs.join("\n\n"),
|
||||||
additional_info: Faker::Lorem.paragraphs.join("\n\n"),
|
additional_info: Faker::Lorem.paragraphs.join("\n\n"),
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
class AddSummaryToLegislativeProcess < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :legislation_processes, :summary, :text, limit: 280
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20170519084239) do
|
ActiveRecord::Schema.define(version: 20170602162155) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
@@ -418,6 +418,7 @@ ActiveRecord::Schema.define(version: 20170519084239) do
|
|||||||
t.datetime "hidden_at"
|
t.datetime "hidden_at"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
|
t.text "summary"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "legislation_processes", ["allegations_end_date"], name: "index_legislation_processes_on_allegations_end_date", using: :btree
|
add_index "legislation_processes", ["allegations_end_date"], name: "index_legislation_processes_on_allegations_end_date", using: :btree
|
||||||
|
|||||||
@@ -603,6 +603,7 @@ FactoryGirl.define do
|
|||||||
factory :legislation_process, class: 'Legislation::Process' do
|
factory :legislation_process, class: 'Legislation::Process' do
|
||||||
title "A collaborative legislation process"
|
title "A collaborative legislation process"
|
||||||
description "Description of the process"
|
description "Description of the process"
|
||||||
|
summary "Summary of the process"
|
||||||
target "Who will affected by this law?"
|
target "Who will affected by this law?"
|
||||||
how_to_participate "You can participate by answering some questions"
|
how_to_participate "You can participate by answering some questions"
|
||||||
start_date Date.current - 5.days
|
start_date Date.current - 5.days
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ feature 'Admin legislation processes' do
|
|||||||
click_link "New process"
|
click_link "New process"
|
||||||
|
|
||||||
fill_in 'legislation_process_title', with: 'An example legislation process'
|
fill_in 'legislation_process_title', with: 'An example legislation process'
|
||||||
|
fill_in 'legislation_process_summary', with: 'Summary of the process'
|
||||||
fill_in 'legislation_process_description', with: 'Describing the process'
|
fill_in 'legislation_process_description', with: 'Describing the process'
|
||||||
fill_in 'legislation_process_target', with: 'This thing affects people'
|
fill_in 'legislation_process_target', with: 'This thing affects people'
|
||||||
fill_in 'legislation_process_how_to_participate', with: 'You can partipate in this thing by doing...'
|
fill_in 'legislation_process_how_to_participate', with: 'You can partipate in this thing by doing...'
|
||||||
@@ -57,12 +58,30 @@ feature 'Admin legislation processes' do
|
|||||||
click_button 'Create process'
|
click_button 'Create process'
|
||||||
|
|
||||||
expect(page).to have_content 'An example legislation process'
|
expect(page).to have_content 'An example legislation process'
|
||||||
|
expect(page).to have_content 'Process created successfully'
|
||||||
|
|
||||||
|
click_link 'Click to visit'
|
||||||
|
|
||||||
|
expect(page).to have_content 'An example legislation process'
|
||||||
|
expect(page).not_to have_content 'Summary of the process'
|
||||||
|
expect(page).to have_content 'Describing the process'
|
||||||
|
expect(page).to have_content 'This thing affects people'
|
||||||
|
|
||||||
|
visit legislation_processes_path
|
||||||
|
|
||||||
|
expect(page).to have_content 'An example legislation process'
|
||||||
|
expect(page).to have_content 'Summary of the process'
|
||||||
|
expect(page).not_to have_content 'Describing the process'
|
||||||
|
expect(page).not_to have_content 'This thing affects people'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'Update' do
|
context 'Update' do
|
||||||
scenario 'Deactivate debate phase', :js do
|
scenario 'Deactivate debate phase', js: true do
|
||||||
process = create(:legislation_process, title: 'An example legislation process')
|
process = create(:legislation_process,
|
||||||
|
title: 'An example legislation process',
|
||||||
|
summary: 'Summarizing the process',
|
||||||
|
description: 'Description of the process')
|
||||||
visit admin_root_path
|
visit admin_root_path
|
||||||
|
|
||||||
within('#side_menu') do
|
within('#side_menu') do
|
||||||
@@ -75,11 +94,16 @@ feature 'Admin legislation processes' do
|
|||||||
expect(find("#debate_phase_active")).to be_checked
|
expect(find("#debate_phase_active")).to be_checked
|
||||||
|
|
||||||
uncheck "debate_phase_active"
|
uncheck "debate_phase_active"
|
||||||
|
fill_in 'legislation_process_summary', with: ''
|
||||||
click_button "Save changes"
|
click_button "Save changes"
|
||||||
|
|
||||||
expect(page).to have_content "Process updated successfully"
|
expect(page).to have_content "Process updated successfully"
|
||||||
expect(find("#debate_start_date").value).to be_blank
|
expect(find("#debate_start_date").value).to be_blank
|
||||||
expect(find("#debate_end_date").value).to be_blank
|
expect(find("#debate_end_date").value).to be_blank
|
||||||
|
|
||||||
|
visit legislation_processes_path
|
||||||
|
expect(page).not_to have_content 'Summarizing the process'
|
||||||
|
expect(page).to have_content 'Description of the process'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user