Proposals description migration and form
- Added to legislation processes a new attribute called `proposals_description`. - Then created new views to show a form for the `@process` to edit this attribute **from in the proposals section**. - Completed translations for new views.
This commit is contained in:
@@ -20,7 +20,7 @@ class Admin::Legislation::ProcessesController < Admin::Legislation::BaseControll
|
|||||||
def update
|
def update
|
||||||
if @process.update(process_params)
|
if @process.update(process_params)
|
||||||
link = legislation_process_path(@process).html_safe
|
link = legislation_process_path(@process).html_safe
|
||||||
redirect_to edit_admin_legislation_process_path(@process), notice: t('admin.legislation.processes.update.notice', link: link)
|
redirect_to :back, notice: t('admin.legislation.processes.update.notice', link: link)
|
||||||
else
|
else
|
||||||
flash.now[:error] = t('admin.legislation.processes.update.error')
|
flash.now[:error] = t('admin.legislation.processes.update.error')
|
||||||
render :edit
|
render :edit
|
||||||
@@ -55,7 +55,8 @@ class Admin::Legislation::ProcessesController < Admin::Legislation::BaseControll
|
|||||||
:proposals_phase_enabled,
|
:proposals_phase_enabled,
|
||||||
:draft_publication_enabled,
|
:draft_publication_enabled,
|
||||||
:result_publication_enabled,
|
:result_publication_enabled,
|
||||||
:published
|
:published,
|
||||||
|
:proposals_description
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,9 +2,12 @@
|
|||||||
<li <%= "class=active" if active == 'info' %>>
|
<li <%= "class=active" if active == 'info' %>>
|
||||||
<%= link_to t("admin.legislation.processes.subnav.info"), edit_admin_legislation_process_path(process) %>
|
<%= link_to t("admin.legislation.processes.subnav.info"), edit_admin_legislation_process_path(process) %>
|
||||||
</li>
|
</li>
|
||||||
<li <%= "class=active" if active == 'questions' %>>
|
<li <%= "class=active" if active == 'questions' %>>
|
||||||
<%= link_to t("admin.legislation.processes.subnav.questions"), admin_legislation_process_questions_path(process) %>
|
<%= link_to t("admin.legislation.processes.subnav.questions"), admin_legislation_process_questions_path(process) %>
|
||||||
</li>
|
</li>
|
||||||
|
<li <%= "class=active" if active == 'proposals' %>>
|
||||||
|
<%= link_to t("admin.legislation.processes.subnav.proposals"), admin_legislation_process_proposals_path(process) %>
|
||||||
|
</li>
|
||||||
<li <%= "class=active" if active == 'draft_versions' %>>
|
<li <%= "class=active" if active == 'draft_versions' %>>
|
||||||
<%= link_to t("admin.legislation.processes.subnav.draft_texts"), admin_legislation_process_draft_versions_path(process) %>
|
<%= link_to t("admin.legislation.processes.subnav.draft_texts"), admin_legislation_process_draft_versions_path(process) %>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
36
app/views/admin/legislation/proposals/_form.html.erb
Normal file
36
app/views/admin/legislation/proposals/_form.html.erb
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<%= form_for [:admin, @process], html: {data: {watch_changes: true}} do |f| %>
|
||||||
|
|
||||||
|
<% if @process.errors.any? %>
|
||||||
|
|
||||||
|
<div id="error_explanation" data-alert class="callout alert" data-closable>
|
||||||
|
<button class="close-button" aria-label="<%= t("application.close") %>" type="button" data-close>
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<strong>
|
||||||
|
<%= @process.errors.count %>
|
||||||
|
<%= t("admin.legislation.processes.errors.form.error", count: @process.errors.count) %>
|
||||||
|
</strong>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="small-12 medium-4 column">
|
||||||
|
<%= label_tag t('admin.legislation.proposals.form.header_information') %>
|
||||||
|
<small><%= t('admin.legislation.proposals.form.header_information_description') %></small>
|
||||||
|
</div>
|
||||||
|
<div class="small-12 medium-8 column">
|
||||||
|
<%= f.text_area :proposals_description,
|
||||||
|
label: false,
|
||||||
|
rows: 5,
|
||||||
|
placeholder: t('admin.legislation.proposals.form.header_information_placeholder') %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="actions small-12 medium-3 column legislation-process-save">
|
||||||
|
<%= f.submit(class: "button expanded", value: t("admin.legislation.processes.#{admin_submit_action(@process)}.submit_button")) %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
16
app/views/admin/legislation/proposals/index.html.erb
Normal file
16
app/views/admin/legislation/proposals/index.html.erb
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<% provide :title do %>
|
||||||
|
Admin - <%= t("admin.menu.legislation") %> - <%= @process.title %> - <%= t("admin.legislation.proposals.index.title") %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<div class="legislation-admin legislation-draft-versions-index row">
|
||||||
|
<div class="small-12 column">
|
||||||
|
<%= back_link_to admin_legislation_processes_path, t("admin.legislation.proposals.index.back") %>
|
||||||
|
|
||||||
|
<h2><%= @process.title %></h2>
|
||||||
|
|
||||||
|
<%= render 'admin/legislation/processes/subnav', process: @process, active: 'proposals' %>
|
||||||
|
|
||||||
|
<%= render "form" %>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -291,6 +291,15 @@ en:
|
|||||||
info: Information
|
info: Information
|
||||||
draft_texts: Text
|
draft_texts: Text
|
||||||
questions: Debate
|
questions: Debate
|
||||||
|
proposals: Proposals
|
||||||
|
proposals:
|
||||||
|
index:
|
||||||
|
title: Proposals
|
||||||
|
back: Back
|
||||||
|
form:
|
||||||
|
header_information: Information header
|
||||||
|
header_information_description: Provide information about the proposals. This text will be displayed as an alert in the Proposals section inside this Process. Use Markdown to format the text.
|
||||||
|
header_information_placeholder: Add information for the proposals' header
|
||||||
draft_versions:
|
draft_versions:
|
||||||
create:
|
create:
|
||||||
notice: 'Draft created successfully. <a href="%{link}">Click to visit</a>'
|
notice: 'Draft created successfully. <a href="%{link}">Click to visit</a>'
|
||||||
|
|||||||
@@ -291,6 +291,15 @@ es:
|
|||||||
info: Información
|
info: Información
|
||||||
draft_texts: Texto
|
draft_texts: Texto
|
||||||
questions: Debate
|
questions: Debate
|
||||||
|
proposals: Propuestas
|
||||||
|
proposals:
|
||||||
|
index:
|
||||||
|
title: Propuestas
|
||||||
|
back: Volver
|
||||||
|
form:
|
||||||
|
header_information: Encabezado de información
|
||||||
|
header_information_description: Proporciona información sobre el recorrido de las propuestas. Este texto se mostrará como una alerta en el encabezado de la sección de Propuestas dentro de este proceso. Usa Markdown para formatear el texto.
|
||||||
|
header_information_placeholder: Añade información para el encabezado de las las propuestas
|
||||||
draft_versions:
|
draft_versions:
|
||||||
create:
|
create:
|
||||||
notice: 'Borrador creado correctamente. <a href="%{link}">Haz click para verlo</a>'
|
notice: 'Borrador creado correctamente. <a href="%{link}">Haz click para verlo</a>'
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
class AddProposalsDescriptionToLegislationProcesses < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :legislation_processes, :proposals_description, :text
|
||||||
|
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: 20170913101029) do
|
ActiveRecord::Schema.define(version: 20170913130803) 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"
|
||||||
@@ -473,6 +473,7 @@ ActiveRecord::Schema.define(version: 20170913101029) do
|
|||||||
t.date "proposals_phase_start_date"
|
t.date "proposals_phase_start_date"
|
||||||
t.date "proposals_phase_end_date"
|
t.date "proposals_phase_end_date"
|
||||||
t.boolean "proposals_phase_enabled"
|
t.boolean "proposals_phase_enabled"
|
||||||
|
t.text "proposals_description"
|
||||||
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
|
||||||
|
|||||||
Reference in New Issue
Block a user