diff --git a/app/assets/stylesheets/participation.scss b/app/assets/stylesheets/participation.scss
index fbcda0ebb..ab3369387 100644
--- a/app/assets/stylesheets/participation.scss
+++ b/app/assets/stylesheets/participation.scss
@@ -313,7 +313,8 @@
.proposal-form,
.proposal-edit,
.new_poll_question,
-.edit_poll_question {
+.edit_poll_question,
+.edit_poll {
@include direct-uploads;
}
diff --git a/app/models/concerns/imageable.rb b/app/models/concerns/imageable.rb
index a2a2f537d..fea94d102 100644
--- a/app/models/concerns/imageable.rb
+++ b/app/models/concerns/imageable.rb
@@ -5,6 +5,7 @@ module Imageable
included do
has_one :image, as: :imageable, dependent: :destroy
+ has_many :images, as: :imageable, dependent: :destroy
accepts_nested_attributes_for :image, allow_destroy: true, update_only: true
def image_url(style)
diff --git a/app/models/poll.rb b/app/models/poll.rb
index e852e912a..9aa41cd16 100644
--- a/app/models/poll.rb
+++ b/app/models/poll.rb
@@ -1,5 +1,6 @@
class Poll < ActiveRecord::Base
- include Imageable
+ include Imageable
+ include Documentable
has_many :booth_assignments, class_name: "Poll::BoothAssignment"
has_many :booths, through: :booth_assignments
diff --git a/app/views/admin/poll/polls/_form.html.erb b/app/views/admin/poll/polls/_form.html.erb
index 3fa7daa4f..235522c65 100644
--- a/app/views/admin/poll/polls/_form.html.erb
+++ b/app/views/admin/poll/polls/_form.html.erb
@@ -31,29 +31,28 @@
-
-
- <%= f.label :image, t("images.form.admin_title") %>
+
+ <%= render 'images/admin_image', imageable: @poll, f: f %>
+
-
- <%= f.fields_for :image do |image_builder| %>
- <%= render 'images/image_fields', f: image_builder, imageable: @poll %>
- <% end %>
-
-
-
- <%= link_to_add_association t('images.form.add_new_image'), f, :image,
- force_non_association_create: true,
- partial: "images/image_fields",
- id: "new_image_link",
- class: "button hollow #{"hide" if @poll.image.present?}",
- render_options: {
- locals: { imageable: @poll }
- },
- data: {
- association_insertion_node: "#nested-image",
- association_insertion_method: "append"
- } %>
+
+
+
+
+ | <%= t("admin.polls.attachments.title") %> |
+
+
+ | <%= t("admin.polls.attachments.images_title") %> |
+ <%= t("admin.polls.attachments.documents_title") %> |
+
+
+
+
+ | <%= link_to "#{t("admin.polls.attachments.images_link")} (#{@poll.images.count})", root_path %> |
+ <%= link_to "#{t("admin.polls.attachments.documents_link")} (#{@poll.documents.count})", root_path %> |
+
+
+
diff --git a/app/views/images/_admin_image.html.erb b/app/views/images/_admin_image.html.erb
new file mode 100644
index 000000000..7c5157216
--- /dev/null
+++ b/app/views/images/_admin_image.html.erb
@@ -0,0 +1,60 @@
+
+
+ <%= f.label :image, t("images.form.admin_title") %>
+
+
+ <%= f.fields_for :image do |image_builder| %>
+ <%#= render 'images/image_fields', f: image_builder, imageable: imageable %>
+
+
+
+
+ <%= image_builder.hidden_field :id %>
+ <%= image_builder.hidden_field :user_id, value: current_user.id %>
+ <%= image_builder.hidden_field :cached_attachment %>
+
+ <%= image_builder.text_field :title, placeholder: t("images.form.title_placeholder") %>
+
+
+ <%= render_image(image_builder.object, :thumb, false) if image_builder.object.attachment.exists? %>
+
+
+
+ <%= render_image_attachment(image_builder, imageable, image_builder.object) %>
+
+
+ <%= render_destroy_image_link(image_builder, image_builder.object) %>
+
+
+
+
+
+ <%= image_attachment_file_name(image_builder.object) %>
+
+
+
+
+
+
+
+
+
+ <% end %>
+
+
+
+ <%= link_to_add_association t('images.form.add_new_image'), f, :image,
+ force_non_association_create: true,
+ partial: "images/image_fields",
+ id: "new_image_link",
+ class: "button hollow #{"hide" if imageable.image.present?}",
+ render_options: {
+ locals: { imageable: imageable }
+ },
+ data: {
+ association_insertion_node: "#nested-image",
+ association_insertion_method: "append"
+ } %>
+
diff --git a/config/locales/en/activerecord.yml b/config/locales/en/activerecord.yml
index 1e3f62b1a..8bb2c3286 100644
--- a/config/locales/en/activerecord.yml
+++ b/config/locales/en/activerecord.yml
@@ -152,6 +152,8 @@ en:
starts_at: "Start Date"
ends_at: "Closing Date"
geozone_restricted: "Restricted by geozone"
+ summary: "Summary"
+ description: "Description"
poll/question:
title: "Question"
valid_answers: "Posibles answers"
diff --git a/config/locales/es/activerecord.yml b/config/locales/es/activerecord.yml
index 108f19fcf..415e81bed 100644
--- a/config/locales/es/activerecord.yml
+++ b/config/locales/es/activerecord.yml
@@ -146,6 +146,8 @@ es:
starts_at: "Fecha de apertura"
ends_at: "Fecha de cierre"
geozone_restricted: "Restringida por zonas"
+ summary: "Resumen"
+ description: "Descripción"
poll/question:
title: "Pregunta"
valid_answers: "Posibles respuestas"
diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml
index 816cadd57..afa963c20 100644
--- a/config/locales/es/admin.yml
+++ b/config/locales/es/admin.yml
@@ -580,6 +580,12 @@ es:
error_on_question_added: "No se pudo asignar la pregunta"
question_removed: "Pregunta eliminada de esta votación"
error_on_question_removed: "No se pudo quitar la pregunta"
+ attachments:
+ title: "Imágenes y documentos de la votación"
+ images_title: "Imágenes"
+ documents_title: "Documents"
+ images_link: "Lista de imágenes"
+ documents_link: "Lista de documentos"
questions:
index:
title: "Preguntas ciudadanas"