Migration for adding summary and description to polls created. Both text_areas were added to polls form.
Imageable class included in polls model and the first aproach for adding images added to form.
This commit is contained in:
@@ -73,7 +73,9 @@ class Admin::Poll::PollsController < Admin::Poll::BaseController
|
||||
end
|
||||
|
||||
def poll_params
|
||||
params.require(:poll).permit(:name, :starts_at, :ends_at, :geozone_restricted, geozone_ids: [])
|
||||
params.require(:poll).permit(:name, :starts_at, :ends_at, :geozone_restricted, :summary, :description,
|
||||
geozone_ids: [],
|
||||
image_attributes: [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy])
|
||||
end
|
||||
|
||||
def search_params
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
class Poll < ActiveRecord::Base
|
||||
include Imageable
|
||||
|
||||
has_many :booth_assignments, class_name: "Poll::BoothAssignment"
|
||||
has_many :booths, through: :booth_assignments
|
||||
has_many :partial_results, through: :booth_assignments
|
||||
|
||||
@@ -19,6 +19,43 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="small-12 column">
|
||||
<%=f.text_area :summary, rows: 4%>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="small-12 column">
|
||||
<%=f.text_area :description, rows: 8%>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="images small-12 column">
|
||||
<div>
|
||||
<%= f.label :image, t("images.form.admin_title") %>
|
||||
|
||||
<div id="nested-image">
|
||||
<%= f.fields_for :image do |image_builder| %>
|
||||
<%= render 'images/image_fields', f: image_builder, imageable: @poll %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= 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"
|
||||
} %>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="small-6 medium-6 column">
|
||||
<%= f.check_box :geozone_restricted, data: { checkbox_toggle: "#geozones" } %>
|
||||
|
||||
Reference in New Issue
Block a user