diff --git a/app/models/legislation/process.rb b/app/models/legislation/process.rb
index 9ce0bff2f..4cff200b5 100644
--- a/app/models/legislation/process.rb
+++ b/app/models/legislation/process.rb
@@ -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
diff --git a/app/views/admin/legislation/milestones/_summary_form.html.erb b/app/views/admin/legislation/milestones/_summary_form.html.erb
new file mode 100644
index 000000000..0adb00ecc
--- /dev/null
+++ b/app/views/admin/legislation/milestones/_summary_form.html.erb
@@ -0,0 +1,11 @@
+<%= render "admin/shared/globalize_locales", resource: @process %>
+
+<%= translatable_form_for [:admin, @process] do |f| %>
+ <%= f.translatable_fields do |translations_form| %>
+
+ <%= translations_form.cktext_area :milestones_summary, ckeditor: { language: I18n.locale } %>
+
+ <% end %>
+
+ <%= f.submit class: "button success" %>
+<% end %>
diff --git a/app/views/admin/legislation/milestones/index.html.erb b/app/views/admin/legislation/milestones/index.html.erb
index 4f4f9741b..456b6154a 100644
--- a/app/views/admin/legislation/milestones/index.html.erb
+++ b/app/views/admin/legislation/milestones/index.html.erb
@@ -8,4 +8,5 @@
<%= @process.title %>
<%= render "admin/legislation/processes/subnav", process: @process, active: "milestones" %>
+<%= render "summary_form", process: @process %>
<%= render "admin/milestones/milestones", milestoneable: @process %>
diff --git a/app/views/legislation/processes/milestones.html.erb b/app/views/legislation/processes/milestones.html.erb
index d54d5d54f..8ea3b6c9b 100644
--- a/app/views/legislation/processes/milestones.html.erb
+++ b/app/views/legislation/processes/milestones.html.erb
@@ -4,6 +4,12 @@
<%= render "key_dates", process: @process, phase: @phase %>
+
+
+ <%= WYSIWYGSanitizer.new.sanitize(@process.milestones_summary) %>
+
+
+
<%= render "milestones/milestones_content", milestoneable: @process %>
diff --git a/config/locales/en/activerecord.yml b/config/locales/en/activerecord.yml
index 6f21668c1..43415ff91 100644
--- a/config/locales/en/activerecord.yml
+++ b/config/locales/en/activerecord.yml
@@ -239,6 +239,7 @@ en:
summary: Summary
description: Description
additional_info: Additional info
+ milestones_summary: Summary
legislation/draft_version:
title: Version title
body: Text
diff --git a/config/locales/es/activerecord.yml b/config/locales/es/activerecord.yml
index bf4133daa..bbb0b358a 100644
--- a/config/locales/es/activerecord.yml
+++ b/config/locales/es/activerecord.yml
@@ -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
diff --git a/db/migrate/20181121123512_add_milestones_summary_to_legislation_process_translation.rb b/db/migrate/20181121123512_add_milestones_summary_to_legislation_process_translation.rb
new file mode 100644
index 000000000..c93b5d3fa
--- /dev/null
+++ b/db/migrate/20181121123512_add_milestones_summary_to_legislation_process_translation.rb
@@ -0,0 +1,5 @@
+class AddMilestonesSummaryToLegislationProcessTranslation < ActiveRecord::Migration
+ def change
+ add_column :legislation_process_translations, :milestones_summary, :text
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 4e384f9a9..b5f0cb270 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: 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
diff --git a/spec/features/admin/legislation/processes_spec.rb b/spec/features/admin/legislation/processes_spec.rb
index 8e7216cf9..0599c40ce 100644
--- a/spec/features/admin/legislation/processes_spec.rb
+++ b/spec/features/admin/legislation/processes_spec.rb
@@ -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