From 0a0eb00f9793577d17a8f4f109c33ecc86c49470 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baz=C3=A1n?= Date: Tue, 8 Mar 2016 19:45:51 +0100 Subject: [PATCH 1/8] changes price fields type to bigint --- ...20160308184050_change_price_fields_to_bigint.rb | 11 +++++++++++ db/schema.rb | 14 +++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 db/migrate/20160308184050_change_price_fields_to_bigint.rb diff --git a/db/migrate/20160308184050_change_price_fields_to_bigint.rb b/db/migrate/20160308184050_change_price_fields_to_bigint.rb new file mode 100644 index 000000000..fd9000278 --- /dev/null +++ b/db/migrate/20160308184050_change_price_fields_to_bigint.rb @@ -0,0 +1,11 @@ +class ChangePriceFieldsToBigint < ActiveRecord::Migration + def up + change_column :spending_proposals, :price, :bigint + change_column :spending_proposals, :price_first_year, :bigint + end + + def down + change_column :spending_proposals, :price, :integer + change_column :spending_proposals, :price_first_year, :integer + end +end diff --git a/db/schema.rb b/db/schema.rb index 04f41722d..8d3a3caa9 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: 20160308103548) do +ActiveRecord::Schema.define(version: 20160308184050) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -296,20 +296,20 @@ ActiveRecord::Schema.define(version: 20160308103548) do t.text "description" t.integer "author_id" t.string "external_url" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.integer "geozone_id" - t.integer "price" + t.integer "price", limit: 8 t.boolean "feasible" t.string "association_name" t.text "price_explanation" t.text "feasible_explanation" t.text "internal_comments" - t.boolean "valuation_finished", default: false + t.boolean "valuation_finished", default: false t.text "explanations_log" t.integer "administrator_id" - t.integer "valuation_assignments_count", default: 0 - t.integer "price_first_year" + t.integer "valuation_assignments_count", default: 0 + t.integer "price_first_year", limit: 8 t.string "time_scope" end From a37e6afa7de8d96cd586f3ca0e71044073e21be7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baz=C3=A1n?= Date: Tue, 8 Mar 2016 19:46:46 +0100 Subject: [PATCH 2/8] sets max limit for price form fields --- app/views/valuation/spending_proposals/edit.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/valuation/spending_proposals/edit.html.erb b/app/views/valuation/spending_proposals/edit.html.erb index a3dba0b4b..cf0b936e2 100644 --- a/app/views/valuation/spending_proposals/edit.html.erb +++ b/app/views/valuation/spending_proposals/edit.html.erb @@ -6,12 +6,12 @@
<%= f.label :price, "#{t('valuation.spending_proposals.edit.price')} (#{t('valuation.spending_proposals.edit.currency')})" %> - <%= f.number_field :price, label: false %> + <%= f.number_field :price, label: false, max: 1000000000000000 %>
<%= f.label :price_first_year, "#{t('valuation.spending_proposals.edit.price_first_year')} ( #{t('valuation.spending_proposals.edit.currency')})" %> - <%= f.number_field :price_first_year, label: false %> + <%= f.number_field :price_first_year, label: false, max: 1000000000000000 %>
From 7d315282399384dc6981a083e99644d894fa7d14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baz=C3=A1n?= Date: Tue, 8 Mar 2016 20:05:09 +0100 Subject: [PATCH 3/8] moves feasibility fields to top --- .../spending_proposals/edit.html.erb | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/app/views/valuation/spending_proposals/edit.html.erb b/app/views/valuation/spending_proposals/edit.html.erb index cf0b936e2..417147e21 100644 --- a/app/views/valuation/spending_proposals/edit.html.erb +++ b/app/views/valuation/spending_proposals/edit.html.erb @@ -3,25 +3,6 @@ <%= form_for(@spending_proposal, url: valuate_valuation_spending_proposal_path(@spending_proposal)) do |f| %> <%= render 'shared/errors', resource: @spending_proposal %> -
-
- <%= f.label :price, "#{t('valuation.spending_proposals.edit.price')} (#{t('valuation.spending_proposals.edit.currency')})" %> - <%= f.number_field :price, label: false, max: 1000000000000000 %> -
- -
- <%= f.label :price_first_year, "#{t('valuation.spending_proposals.edit.price_first_year')} ( #{t('valuation.spending_proposals.edit.currency')})" %> - <%= f.number_field :price_first_year, label: false, max: 1000000000000000 %> -
-
- -
-
- <%= f.label :price_explanation, t("valuation.spending_proposals.edit.price_explanation") %> - <%= f.text_area :price_explanation, label: false, rows: 3 %> -
-
-
@@ -50,6 +31,25 @@
+
+
+ <%= f.label :price, "#{t('valuation.spending_proposals.edit.price')} (#{t('valuation.spending_proposals.edit.currency')})" %> + <%= f.number_field :price, label: false, max: 1000000000000000 %> +
+ +
+ <%= f.label :price_first_year, "#{t('valuation.spending_proposals.edit.price_first_year', currency: t('valuation.spending_proposals.edit.currency'))}" %> + <%= f.number_field :price_first_year, label: false, max: 1000000000000000 %> +
+
+ +
+
+ <%= f.label :price_explanation, t("valuation.spending_proposals.edit.price_explanation") %> + <%= f.text_area :price_explanation, label: false, rows: 3 %> +
+
+
<%= f.label :time_scope, t("valuation.spending_proposals.edit.time_scope") %> From c4532bf339f315c5cb68521db61c203702ca070e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baz=C3=A1n?= Date: Tue, 8 Mar 2016 20:06:27 +0100 Subject: [PATCH 4/8] updates i18n for dossier form --- config/locales/valuation.en.yml | 2 +- config/locales/valuation.es.yml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/config/locales/valuation.en.yml b/config/locales/valuation.en.yml index 2aba2e89c..8cd50096b 100644 --- a/config/locales/valuation.en.yml +++ b/config/locales/valuation.en.yml @@ -43,7 +43,7 @@ en: edit: dossier: Dossier price: Price - price_first_year: Cost during the first year + price_first_year: "Cost during the first year (%{currency})" currency: "€" price_explanation: Price explanation feasibility: Feasibility diff --git a/config/locales/valuation.es.yml b/config/locales/valuation.es.yml index 94e9d1ec0..13cdca833 100644 --- a/config/locales/valuation.es.yml +++ b/config/locales/valuation.es.yml @@ -43,16 +43,16 @@ es: edit: dossier: Informe price: Coste - price_first_year: Coste en el primer año + price_first_year: "Coste en el primer año (%{currency}) (opcional)" currency: "€" - price_explanation: Justificación del precio + price_explanation: Informe de coste (opcional) feasibility: Viabilidad feasible: Viable not_feasible: No viable - feasible_explanation: Justificación de la viabilidad + feasible_explanation: Informe de inviabilidad (en caso de que lo sea) valuation_finished: Informe finalizado - time_scope: Plazo de ejecución - internal_comments: Comentarios internos + time_scope: Plazo de ejecución (opcional) + internal_comments: Comentarios y observaciones (para responsables internos, no se publicará) save: Guardar cambios notice: valuate: "Informe actualizado" From 7f5e79da6b1de9b46e8b628551a6341b6af64cda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baz=C3=A1n?= Date: Tue, 8 Mar 2016 20:10:19 +0100 Subject: [PATCH 5/8] improves spending_proposal back link --- app/views/admin/spending_proposals/show.html.erb | 2 +- app/views/valuation/spending_proposals/show.html.erb | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/views/admin/spending_proposals/show.html.erb b/app/views/admin/spending_proposals/show.html.erb index 304e6f792..f03c6e423 100644 --- a/app/views/admin/spending_proposals/show.html.erb +++ b/app/views/admin/spending_proposals/show.html.erb @@ -1,4 +1,4 @@ -<%= link_to admin_spending_proposals_path, class: 'back' do %> +<%= link_to :back, class: 'back' do %> <%= t("admin.spending_proposals.show.back") %> <% end %> diff --git a/app/views/valuation/spending_proposals/show.html.erb b/app/views/valuation/spending_proposals/show.html.erb index b5b71fcdf..406ad00bf 100644 --- a/app/views/valuation/spending_proposals/show.html.erb +++ b/app/views/valuation/spending_proposals/show.html.erb @@ -1,4 +1,7 @@ -<%= link_to t("valuation.spending_proposals.show.back"), :back, class: 'back' %> +<%= link_to :back, class: 'back' do %> + <%= t("valuation.spending_proposals.show.back") %> +<% end %> +

<%= t("valuation.spending_proposals.show.heading") %> <%= @spending_proposal.id %>

<%= @spending_proposal.title %>

From 1e6dc18fbf388f591b80afe4ad96f24218a3325d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baza=CC=81n?= Date: Tue, 8 Mar 2016 20:17:42 +0100 Subject: [PATCH 6/8] adds link to edit dossier for admins --- app/views/admin/spending_proposals/show.html.erb | 5 +++++ config/locales/admin.en.yml | 1 + config/locales/admin.es.yml | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/views/admin/spending_proposals/show.html.erb b/app/views/admin/spending_proposals/show.html.erb index f03c6e423..536597545 100644 --- a/app/views/admin/spending_proposals/show.html.erb +++ b/app/views/admin/spending_proposals/show.html.erb @@ -32,4 +32,9 @@

<%= t("admin.spending_proposals.show.dossier") %>

+ +

+ <%= link_to t("admin.spending_proposals.show.edit_dossier"), edit_valuation_spending_proposal_path(@spending_proposal) %> +

+ <%= render 'valuation/spending_proposals/written_by_valuators' %> diff --git a/config/locales/admin.en.yml b/config/locales/admin.en.yml index 3a8d1bf84..8b045dbd1 100755 --- a/config/locales/admin.en.yml +++ b/config/locales/admin.en.yml @@ -173,6 +173,7 @@ en: sent: Sent geozone: Scope dossier: Dossier + edit_dossier: Edit dossier tags: Tags undefined: Undefined edit: diff --git a/config/locales/admin.es.yml b/config/locales/admin.es.yml index 81af24d36..6dcf1c0c9 100644 --- a/config/locales/admin.es.yml +++ b/config/locales/admin.es.yml @@ -153,7 +153,7 @@ es: tags_filter_all: Todas las etiquetas filters: valuation_open: Abiertas - without_admin: Sin administrador asignado + without_admin: Sin administrador managed: Gestionando valuating: En evaluación valuation_finished: Evaluación finalizada @@ -173,6 +173,7 @@ es: sent: Fecha geozone: Ámbito dossier: Informe + edit_dossier: Editar informe tags: Etiquetas undefined: Sin definir edit: From e732f88f460af5f70b128dbcd1c153876e02ca22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baz=C3=A1n?= Date: Tue, 8 Mar 2016 20:32:23 +0100 Subject: [PATCH 7/8] adds info on public visibility for dossier fields --- app/views/valuation/spending_proposals/edit.html.erb | 2 +- config/locales/valuation.en.yml | 2 +- config/locales/valuation.es.yml | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/views/valuation/spending_proposals/edit.html.erb b/app/views/valuation/spending_proposals/edit.html.erb index 417147e21..0331b4e4f 100644 --- a/app/views/valuation/spending_proposals/edit.html.erb +++ b/app/views/valuation/spending_proposals/edit.html.erb @@ -33,7 +33,7 @@
- <%= f.label :price, "#{t('valuation.spending_proposals.edit.price')} (#{t('valuation.spending_proposals.edit.currency')})" %> + <%= f.label :price, "#{t('valuation.spending_proposals.edit.price', currency: t('valuation.spending_proposals.edit.currency'))}" %> <%= f.number_field :price, label: false, max: 1000000000000000 %>
diff --git a/config/locales/valuation.en.yml b/config/locales/valuation.en.yml index 8cd50096b..f1f22f2e8 100644 --- a/config/locales/valuation.en.yml +++ b/config/locales/valuation.en.yml @@ -42,7 +42,7 @@ en: assigned_valuators: Assigned valuators edit: dossier: Dossier - price: Price + price: "Price (%{currency})" price_first_year: "Cost during the first year (%{currency})" currency: "€" price_explanation: Price explanation diff --git a/config/locales/valuation.es.yml b/config/locales/valuation.es.yml index 13cdca833..6688dc109 100644 --- a/config/locales/valuation.es.yml +++ b/config/locales/valuation.es.yml @@ -42,17 +42,17 @@ es: assigned_valuators: Evaluadores asignados edit: dossier: Informe - price: Coste - price_first_year: "Coste en el primer año (%{currency}) (opcional)" + price: "Coste (%{currency}) (dato público)" + price_first_year: "Coste en el primer año (%{currency}) (opcional, no público)" currency: "€" - price_explanation: Informe de coste (opcional) + price_explanation: "Informe de coste (opcional, dato público)" feasibility: Viabilidad feasible: Viable not_feasible: No viable - feasible_explanation: Informe de inviabilidad (en caso de que lo sea) + feasible_explanation: "Informe de inviabilidad (en caso de que lo sea, dato público)" valuation_finished: Informe finalizado - time_scope: Plazo de ejecución (opcional) - internal_comments: Comentarios y observaciones (para responsables internos, no se publicará) + time_scope: "Plazo de ejecución (opcional, dato no público)" + internal_comments: "Comentarios y observaciones (para responsables internos, dato no público)" save: Guardar cambios notice: valuate: "Informe actualizado" From 7f97b9ef2cfa781e9e7d1b7196ac7beca9e27fcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baz=C3=A1n?= Date: Tue, 8 Mar 2016 20:50:36 +0100 Subject: [PATCH 8/8] uses _html i18n keys for html_safe values --- app/views/valuation/spending_proposals/edit.html.erb | 12 ++++++------ config/locales/valuation.en.yml | 12 ++++++------ config/locales/valuation.es.yml | 12 ++++++------ 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/app/views/valuation/spending_proposals/edit.html.erb b/app/views/valuation/spending_proposals/edit.html.erb index 0331b4e4f..8652fd070 100644 --- a/app/views/valuation/spending_proposals/edit.html.erb +++ b/app/views/valuation/spending_proposals/edit.html.erb @@ -26,33 +26,33 @@
- <%= f.label :feasible_explanation, t("valuation.spending_proposals.edit.feasible_explanation") %> + <%= f.label :feasible_explanation, t("valuation.spending_proposals.edit.feasible_explanation_html") %> <%= f.text_area :feasible_explanation, label: false, rows: 3 %>
- <%= f.label :price, "#{t('valuation.spending_proposals.edit.price', currency: t('valuation.spending_proposals.edit.currency'))}" %> + <%= f.label :price, "#{t('valuation.spending_proposals.edit.price_html', currency: t('valuation.spending_proposals.edit.currency'))}" %> <%= f.number_field :price, label: false, max: 1000000000000000 %>
- <%= f.label :price_first_year, "#{t('valuation.spending_proposals.edit.price_first_year', currency: t('valuation.spending_proposals.edit.currency'))}" %> + <%= f.label :price_first_year, "#{t('valuation.spending_proposals.edit.price_first_year_html', currency: t('valuation.spending_proposals.edit.currency'))}" %> <%= f.number_field :price_first_year, label: false, max: 1000000000000000 %>
- <%= f.label :price_explanation, t("valuation.spending_proposals.edit.price_explanation") %> + <%= f.label :price_explanation, t("valuation.spending_proposals.edit.price_explanation_html") %> <%= f.text_area :price_explanation, label: false, rows: 3 %>
- <%= f.label :time_scope, t("valuation.spending_proposals.edit.time_scope") %> + <%= f.label :time_scope, t("valuation.spending_proposals.edit.time_scope_html") %> <%= f.text_field :time_scope, label: false %>
@@ -68,7 +68,7 @@
- <%= f.label :internal_comments, t("valuation.spending_proposals.edit.internal_comments") %> + <%= f.label :internal_comments, t("valuation.spending_proposals.edit.internal_comments_html") %> <%= f.text_area :internal_comments, label: false, rows: 3 %>
diff --git a/config/locales/valuation.en.yml b/config/locales/valuation.en.yml index f1f22f2e8..1fd016991 100644 --- a/config/locales/valuation.en.yml +++ b/config/locales/valuation.en.yml @@ -42,17 +42,17 @@ en: assigned_valuators: Assigned valuators edit: dossier: Dossier - price: "Price (%{currency})" - price_first_year: "Cost during the first year (%{currency})" + price_html: "Price (%{currency})" + price_first_year_html: "Cost during the first year (%{currency})" currency: "€" - price_explanation: Price explanation + price_explanation_html: Price explanation feasibility: Feasibility feasible: Feasible not_feasible: Not feasible - feasible_explanation: Feasibility explanation + feasible_explanation_html: Feasibility explanation valuation_finished: Valuation finished - time_scope: Time scope - internal_comments: Internal comments + time_scope_html: Time scope + internal_comments_html: Internal comments save: Save changes notice: valuate: "Dossier updated" diff --git a/config/locales/valuation.es.yml b/config/locales/valuation.es.yml index 6688dc109..e3804beec 100644 --- a/config/locales/valuation.es.yml +++ b/config/locales/valuation.es.yml @@ -42,17 +42,17 @@ es: assigned_valuators: Evaluadores asignados edit: dossier: Informe - price: "Coste (%{currency}) (dato público)" - price_first_year: "Coste en el primer año (%{currency}) (opcional, no público)" + price_html: "Coste (%{currency}) (dato público)" + price_first_year_html: "Coste en el primer año (%{currency}) (opcional, privado)" currency: "€" - price_explanation: "Informe de coste (opcional, dato público)" + price_explanation_html: "Informe de coste (opcional, dato público)" feasibility: Viabilidad feasible: Viable not_feasible: No viable - feasible_explanation: "Informe de inviabilidad (en caso de que lo sea, dato público)" + feasible_explanation_html: "Informe de inviabilidad (en caso de que lo sea, dato público)" valuation_finished: Informe finalizado - time_scope: "Plazo de ejecución (opcional, dato no público)" - internal_comments: "Comentarios y observaciones (para responsables internos, dato no público)" + time_scope_html: "Plazo de ejecución (opcional, dato no público)" + internal_comments_html: "Comentarios y observaciones (para responsables internos, dato no público)" save: Guardar cambios notice: valuate: "Informe actualizado"