Add milestones summary to legislation processes

This commit is contained in:
Javi Martín
2018-11-22 11:15:51 +01:00
parent b95ca9df8a
commit a42f5fab37
9 changed files with 49 additions and 5 deletions

View File

@@ -10,10 +10,11 @@ class Legislation::Process < ActiveRecord::Base
acts_as_paranoid column: :hidden_at
acts_as_taggable_on :customs
translates :title, touch: true
translates :summary, touch: true
translates :description, touch: true
translates :additional_info, touch: true
translates :title, touch: true
translates :summary, touch: true
translates :description, touch: true
translates :additional_info, touch: true
translates :milestones_summary, touch: true
include Globalizable
PHASES_AND_PUBLICATIONS = %i(draft_phase debate_phase allegations_phase proposals_phase draft_publication result_publication).freeze

View File

@@ -0,0 +1,11 @@
<%= render "admin/shared/globalize_locales", resource: @process %>
<%= translatable_form_for [:admin, @process] do |f| %>
<%= f.translatable_fields do |translations_form| %>
<div class="ckeditor">
<%= translations_form.cktext_area :milestones_summary, ckeditor: { language: I18n.locale } %>
</div>
<% end %>
<%= f.submit class: "button success" %>
<% end %>

View File

@@ -8,4 +8,5 @@
<h2><%= @process.title %></h2>
<%= render "admin/legislation/processes/subnav", process: @process, active: "milestones" %>
<%= render "summary_form", process: @process %>
<%= render "admin/milestones/milestones", milestoneable: @process %>

View File

@@ -4,6 +4,12 @@
<%= render "key_dates", process: @process, phase: @phase %>
<div class="row">
<div class="small-12 column">
<%= WYSIWYGSanitizer.new.sanitize(@process.milestones_summary) %>
</div>
</div>
<div class="tab-milestones">
<%= render "milestones/milestones_content", milestoneable: @process %>
</div>

View File

@@ -239,6 +239,7 @@ en:
summary: Summary
description: Description
additional_info: Additional info
milestones_summary: Summary
legislation/draft_version:
title: Version title
body: Text

View File

@@ -239,6 +239,7 @@ es:
summary: Resumen
description: En qué consiste
additional_info: Información adicional
milestones_summary: Seguimiento del proceso
legislation/draft_version:
title: Título de la version
body: Texto

View File

@@ -0,0 +1,5 @@
class AddMilestonesSummaryToLegislationProcessTranslation < ActiveRecord::Migration
def change
add_column :legislation_process_translations, :milestones_summary, :text
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: 20181109111037) do
ActiveRecord::Schema.define(version: 20181121123512) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -627,6 +627,7 @@ ActiveRecord::Schema.define(version: 20181109111037) do
t.text "summary"
t.text "description"
t.text "additional_info"
t.text "milestones_summary"
end
add_index "legislation_process_translations", ["legislation_process_id"], name: "index_199e5fed0aca73302243f6a1fca885ce10cdbb55", using: :btree

View File

@@ -188,5 +188,22 @@ feature 'Admin legislation processes' do
visit admin_legislation_process_proposals_path(process)
expect(page).to have_field("Categories", with: "bicycles, recycling")
end
scenario "Edit milestones summary", :js do
visit admin_legislation_process_milestones_path(process)
within(".translatable-fields[data-locale='en']") do
fill_in_ckeditor find("textarea", visible: false)[:id],
with: "There is still a long journey ahead of us"
end
click_button "Update Process"
expect(page).to have_current_path admin_legislation_process_milestones_path(process)
visit milestones_legislation_process_path(process)
expect(page).to have_content "There is still a long journey ahead of us"
end
end
end