Merge branch 'master' into aperez-admin-question-videos
This commit is contained in:
@@ -149,6 +149,7 @@ $sidebar-active: #f4fcd0;
|
||||
}
|
||||
|
||||
table {
|
||||
|
||||
.break {
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
@@ -1591,6 +1591,10 @@
|
||||
.orbit-container {
|
||||
height: 100% !important;
|
||||
max-height: none !important;
|
||||
|
||||
li {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
.orbit-slide {
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
class Admin::Poll::Questions::Answers::ImagesController < Admin::Poll::BaseController
|
||||
before_action :load_answer
|
||||
|
||||
def index
|
||||
end
|
||||
|
||||
def new
|
||||
@answer = ::Poll::Question::Answer.find(params[:answer_id])
|
||||
end
|
||||
|
||||
def create
|
||||
@answer = ::Poll::Question::Answer.find(params[:answer_id])
|
||||
@answer.attributes = images_params
|
||||
|
||||
if @answer.save
|
||||
redirect_to admin_answer_images_path(@answer),
|
||||
notice: "Image uploaded successfully"
|
||||
else
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def images_params
|
||||
params.permit(images_attributes: [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy])
|
||||
end
|
||||
|
||||
def load_answer
|
||||
@answer = ::Poll::Question::Answer.find(params[:answer_id])
|
||||
end
|
||||
end
|
||||
@@ -1,7 +1,6 @@
|
||||
class Admin::Poll::ShiftsController < Admin::Poll::BaseController
|
||||
|
||||
before_action :load_booth
|
||||
before_action :load_polls
|
||||
before_action :load_officer
|
||||
|
||||
def new
|
||||
@@ -39,10 +38,6 @@ class Admin::Poll::ShiftsController < Admin::Poll::BaseController
|
||||
@booth = ::Poll::Booth.find(params[:booth_id])
|
||||
end
|
||||
|
||||
def load_polls
|
||||
@polls = ::Poll.current_or_incoming
|
||||
end
|
||||
|
||||
def load_shifts
|
||||
@shifts = @booth.shifts
|
||||
end
|
||||
|
||||
@@ -3,7 +3,8 @@ class Officing::VotersController < Officing::BaseController
|
||||
|
||||
def new
|
||||
@user = User.find(params[:id])
|
||||
@polls = Poll.answerable_by(@user)
|
||||
booths = current_user.poll_officer.shifts.current.vote_collection.pluck(:booth_id).uniq
|
||||
@polls = Poll.answerable_by(@user).where(id: Poll::BoothAssignment.where(booth: booths).pluck(:poll_id).uniq)
|
||||
end
|
||||
|
||||
def create
|
||||
|
||||
@@ -25,7 +25,7 @@ module AdminHelper
|
||||
end
|
||||
|
||||
def menu_polls?
|
||||
%w[polls questions officers booths officer_assignments booth_assignments recounts results shifts].include? controller_name
|
||||
%w[polls questions officers booths officer_assignments booth_assignments recounts results shifts questions answers].include? controller_name
|
||||
end
|
||||
|
||||
def menu_profiles?
|
||||
|
||||
12
app/models/concerns/galleryable.rb
Normal file
12
app/models/concerns/galleryable.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
module Galleryable
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
has_many :images, as: :imageable, dependent: :destroy
|
||||
accepts_nested_attributes_for :images, allow_destroy: true, update_only: true
|
||||
|
||||
def image_url(style)
|
||||
image.attachment.url(style) if image && image.attachment.exists?
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -19,7 +19,9 @@ class DirectUpload
|
||||
if @resource_type.present? && @resource_relation.present? && (@attachment.present? || @cached_attachment.present?)
|
||||
@resource = @resource_type.constantize.find_or_initialize_by(id: @resource_id)
|
||||
|
||||
if @resource.class.reflections[@resource_relation].macro == :has_one
|
||||
if @resource.respond_to?(:images)
|
||||
@relation = @resource.images.send("build", relation_attributtes)
|
||||
elsif @resource.class.reflections[@resource_relation].macro == :has_one
|
||||
@relation = @resource.send("build_#{resource_relation}", relation_attributtes)
|
||||
else
|
||||
@relation = @resource.send(@resource_relation).build(relation_attributtes)
|
||||
|
||||
@@ -2,6 +2,7 @@ class Poll
|
||||
class Officer < ActiveRecord::Base
|
||||
belongs_to :user
|
||||
has_many :officer_assignments, class_name: "Poll::OfficerAssignment"
|
||||
has_many :shifts, class_name: "Poll::Shift"
|
||||
has_many :failed_census_calls, foreign_key: :poll_officer_id
|
||||
|
||||
validates :user_id, presence: true, uniqueness: true
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
class Poll::Question::Answer < ActiveRecord::Base
|
||||
include Galleryable
|
||||
|
||||
belongs_to :question, class_name: 'Poll::Question', foreign_key: 'question_id'
|
||||
has_many :videos, class_name: 'Poll::Question::Answer::Video'
|
||||
|
||||
|
||||
@@ -10,6 +10,10 @@ class Poll
|
||||
|
||||
enum task: { vote_collection: 0, recount_scrutiny: 1 }
|
||||
|
||||
scope :vote_collection, -> { where(task: 'vote_collection') }
|
||||
scope :recount_scrutiny, -> { where(task: 'recount_scrutiny') }
|
||||
scope :current, -> { where(date: Date.current) }
|
||||
|
||||
before_create :persist_data
|
||||
after_create :create_officer_assignments
|
||||
before_destroy :destroy_officer_assignments
|
||||
|
||||
@@ -60,12 +60,14 @@
|
||||
<span class="icon-checkmark-circle"></span>
|
||||
<strong><%= t("admin.menu.title_polls") %></strong>
|
||||
</a>
|
||||
<ul id="polls_menu" <%= "class=is-active" if menu_polls? && controller.class.parent == Admin::Poll %>>
|
||||
<ul id="polls_menu" <%= "class=is-active" if menu_polls? || controller.class.parent == Admin::Poll::Questions::Answers %>>
|
||||
<li <%= "class=active" if ["polls", "officer_assignments", "booth_assignments", "recounts", "results"].include? controller_name %>>
|
||||
<%= link_to t('admin.menu.polls'), admin_polls_path %>
|
||||
</li>
|
||||
|
||||
<li <%= "class=active" if current_page?(admin_questions_path) %>>
|
||||
<li <%= "class=active" if controller_name == "questions" ||
|
||||
controller_name == "answers" ||
|
||||
controller.class.parent == Admin::Poll::Questions::Answers %>>
|
||||
<%= link_to t("admin.menu.poll_questions"), admin_questions_path %>
|
||||
</li>
|
||||
|
||||
@@ -158,12 +160,14 @@
|
||||
<span class="icon-settings"></span>
|
||||
<strong><%= t("admin.menu.title_site_customization") %></strong>
|
||||
</a>
|
||||
<ul <%= "class=is-active" if menu_customization? %>>
|
||||
<ul <%= "class=is-active" if menu_customization? &&
|
||||
controller.class.parent != Admin::Poll::Questions::Answers %>>
|
||||
<li <%= "class=active" if controller_name == "pages" %>>
|
||||
<%= link_to t("admin.menu.site_customization.pages"), admin_site_customization_pages_path %>
|
||||
</li>
|
||||
|
||||
<li <%= "class=active" if controller_name == "images" %>>
|
||||
<li <%= "class=active" if controller_name == "images" &&
|
||||
controller.class.parent != Admin::Poll::Questions::Answers %>>
|
||||
<%= link_to t("admin.menu.site_customization.images"), admin_site_customization_images_path %>
|
||||
</li>
|
||||
|
||||
|
||||
@@ -4,34 +4,30 @@
|
||||
|
||||
<%= f.hidden_field :proposal_id %>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="small-12 column">
|
||||
<div class="small-12 medium-6 large-4">
|
||||
<%= f.select :poll_id,
|
||||
options_for_select(Poll.pluck(:name, :id)),
|
||||
prompt: t("admin.questions.index.select_poll"),
|
||||
label: t("admin.questions.new.poll_label") %>
|
||||
</div>
|
||||
<div class="small-12">
|
||||
<div class="small-12 medium-6 large-4">
|
||||
<%= f.select :poll_id,
|
||||
options_for_select(Poll.pluck(:name, :id)),
|
||||
prompt: t("admin.questions.index.select_poll"),
|
||||
label: t("admin.questions.new.poll_label") %>
|
||||
</div>
|
||||
|
||||
<%= f.text_field :title, maxlength: Poll::Question.title_max_length %>
|
||||
<%= f.text_field :title, maxlength: Poll::Question.title_max_length %>
|
||||
|
||||
<div class="documents small-12">
|
||||
<%= render 'documents/nested_documents', documentable: @question, f: f %>
|
||||
</div>
|
||||
<div class="documents small-12">
|
||||
<%= render 'documents/nested_documents', documentable: @question, f: f %>
|
||||
</div>
|
||||
|
||||
<div class="small-12">
|
||||
<%= f.label :video_url, t("proposals.form.proposal_video_url") %>
|
||||
<p class="help-text" id="video-url-help-text"><%= t("proposals.form.proposal_video_url_note") %></p>
|
||||
<%= f.text_field :video_url, placeholder: t("proposals.form.proposal_video_url"), label: false,
|
||||
aria: {describedby: "video-url-help-text"} %>
|
||||
</div>
|
||||
<div class="small-12">
|
||||
<%= f.label :video_url, t("proposals.form.proposal_video_url") %>
|
||||
<p class="help-text" id="video-url-help-text"><%= t("proposals.form.proposal_video_url_note") %></p>
|
||||
<%= f.text_field :video_url, placeholder: t("proposals.form.proposal_video_url"), label: false,
|
||||
aria: {describedby: "video-url-help-text"} %>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="actions small-12 medium-4 column margin-top">
|
||||
<%= f.submit(class: "button expanded", value: t("shared.save")) %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="small-12 medium-6 large-4 margin-top">
|
||||
<%= f.submit(class: "button expanded", value: t("shared.save")) %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -4,21 +4,19 @@
|
||||
|
||||
<%= f.hidden_field :question_id, value: @question.id %>
|
||||
|
||||
<div class="row">
|
||||
<div class="small-12 column">
|
||||
<%= f.text_field :title %>
|
||||
<%= f.label :title, t('admin.questions.new.form.title') %>
|
||||
<%= f.text_field :title, label: false %>
|
||||
|
||||
<div class="ckeditor">
|
||||
<%= f.cktext_area :description,
|
||||
maxlength: Poll::Question.description_max_length,
|
||||
ckeditor: { language: I18n.locale } %>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="actions small-12 medium-4 column margin-top">
|
||||
<%= f.submit(class: "button expanded", value: t("shared.save")) %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ckeditor">
|
||||
<%= f.label :description, t('admin.questions.new.form.description') %>
|
||||
<%= f.cktext_area :description,
|
||||
maxlength: Poll::Question.description_max_length,
|
||||
ckeditor: { language: I18n.locale },
|
||||
label: false %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-6 large-4">
|
||||
<%= f.submit(class: "button expanded", value: t("shared.save")) %>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
16
app/views/admin/poll/questions/answers/images/index.html.erb
Normal file
16
app/views/admin/poll/questions/answers/images/index.html.erb
Normal file
@@ -0,0 +1,16 @@
|
||||
<%= back_link_to admin_question_path(@answer.question) %>
|
||||
|
||||
<%= link_to t("admin.questions.answers.images.add_image"),
|
||||
new_admin_answer_image_path(@answer),
|
||||
class: "button hollow float-right" %>
|
||||
|
||||
<ul class="breadcrumbs margin-top">
|
||||
<li><%= @answer.question.title %></li>
|
||||
<li><%= @answer.title %></li>
|
||||
</ul>
|
||||
|
||||
<% @answer.images.each do |image| %>
|
||||
<div class="small-12 medium-4 column end">
|
||||
<%= render_image(image, :large, true) if image.present? %>
|
||||
</div>
|
||||
<% end %>
|
||||
13
app/views/admin/poll/questions/answers/images/new.html.erb
Normal file
13
app/views/admin/poll/questions/answers/images/new.html.erb
Normal file
@@ -0,0 +1,13 @@
|
||||
<div class="poll-question-form">
|
||||
<%= form_for(Poll::Question::Answer.new,
|
||||
url: admin_answer_images_path(@answer),
|
||||
method: :post) do |f| %>
|
||||
<%= render 'shared/errors', resource: @answer %>
|
||||
|
||||
<div class="images">
|
||||
<%= render 'images/nested_image', imageable: @answer, f: f, image_fields: :images %>
|
||||
</div>
|
||||
|
||||
<%= f.submit t("admin.questions.answers.images.save_image"), class: "button success" %>
|
||||
<% end %>
|
||||
</div>
|
||||
@@ -1,5 +1,10 @@
|
||||
<%= back_link_to %>
|
||||
|
||||
<ul class="breadcrumbs margin-top">
|
||||
<li><%= @question.title %></li>
|
||||
<li><%= t('admin.answers.new.title') %></li>
|
||||
</ul>
|
||||
|
||||
<h2><%= t('admin.answers.new.title') %></h2>
|
||||
|
||||
<div class="poll-question-answer-form">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<%= back_link_to %>
|
||||
|
||||
<h2><%= t("admin.questions.edit.title") %></h2>
|
||||
<h2 class="margin-top"><%= t("admin.questions.edit.title") %></h2>
|
||||
|
||||
<div class="poll-question-form">
|
||||
<%= render "form", form_url: admin_question_path(@question) %>
|
||||
|
||||
@@ -3,10 +3,8 @@
|
||||
<%= link_to t('admin.questions.index.create'), new_admin_question_path,
|
||||
class: "button success float-right" %>
|
||||
|
||||
<div class="row">
|
||||
<div class="small-12 medium-6 column">
|
||||
<%= render 'search' %>
|
||||
</div>
|
||||
<div class="small-12 medium-6">
|
||||
<%= render 'search' %>
|
||||
</div>
|
||||
|
||||
<div class="tabs-content" data-tabs-content="questions-tabs">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<%= back_link_to %>
|
||||
|
||||
<h2><%= t("admin.questions.new.title") %></h2>
|
||||
<h2 class="margin-top"><%= t("admin.questions.new.title") %></h2>
|
||||
|
||||
<div class="poll-question-form">
|
||||
<%= render "form", form_url: admin_questions_path %>
|
||||
|
||||
@@ -5,10 +5,19 @@
|
||||
|
||||
<div class="clear"></div>
|
||||
|
||||
<div class="row">
|
||||
<div class="small-12 medium-9 column">
|
||||
<strong><%= t("admin.questions.show.title") %></strong>
|
||||
<h1><%= @question.title %></h1>
|
||||
<div class="small-12 medium-6">
|
||||
<div class="callout highlight">
|
||||
<p>
|
||||
<strong><%= t("admin.questions.show.title") %></strong>
|
||||
<br>
|
||||
<%= @question.title %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong><%= t("admin.questions.show.author") %></strong>
|
||||
<br>
|
||||
<%= link_to @question.author.name, user_path(@question.author) %>
|
||||
</p>
|
||||
|
||||
<% if @question.proposal.present? %>
|
||||
<p>
|
||||
@@ -17,60 +26,53 @@
|
||||
<%= link_to @question.proposal.title, proposal_path(@question.proposal) %>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<p>
|
||||
<strong><%= t("admin.questions.show.author") %></strong>
|
||||
<br>
|
||||
<%= link_to @question.author.name, user_path(@question.author) %>
|
||||
</p>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<%= t('admin.questions.show.valid_answers') %>
|
||||
</th>
|
||||
<th colspan="2">
|
||||
<%= link_to t("admin.questions.show.add_answer"),
|
||||
new_admin_question_answer_path(@question),
|
||||
class: "button hollow float-right" %>
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th><%= t("admin.questions.show.answers.title") %></th>
|
||||
<th><%= t("admin.questions.show.answers.description") %></th>
|
||||
<th><%= t("admin.questions.show.answers.videos") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% @question.question_answers.each do |answer| %>
|
||||
<tr id="<%= dom_id(answer) %>" class="poll_question_answer">
|
||||
<td><%= answer.title %></td>
|
||||
<td><%= answer.description %></td>
|
||||
<td><%= link_to t("admin.questions.show.answers.video_list",
|
||||
count: answer.videos.count),
|
||||
admin_answer_videos_path(answer) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<% if @question.video_url.present? %>
|
||||
<p>
|
||||
<strong><%= t("admin.questions.show.video_url") %></strong>
|
||||
<br>
|
||||
<a href="<%= @question.video_url %>"><%= @question.video_url %></a>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<% if @question.documents.any? %>
|
||||
<p>
|
||||
<strong><%= t("admin.questions.show.documents") %></strong>
|
||||
<br>
|
||||
<a href="<%= @question.documents.first.attachment.url %>"><%= @question.documents.first.title %></a>
|
||||
</p>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table class="margin-top">
|
||||
<tr>
|
||||
<th colspan="3" scope="col" class="with-button">
|
||||
<%= t('admin.questions.show.valid_answers') %>
|
||||
<%= link_to t("admin.questions.show.add_answer"),
|
||||
new_admin_question_answer_path(@question),
|
||||
class: "button hollow float-right" %>
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th><%= t("admin.questions.show.answers.title") %></th>
|
||||
<th class="medium-7"><%= t("admin.questions.show.answers.description") %></th>
|
||||
<th class="text-center"><%= t("admin.questions.show.answers.images") %></th>
|
||||
<th><%= t("admin.questions.show.answers.videos") %></th>
|
||||
</tr>
|
||||
|
||||
<% @question.question_answers.each do |answer| %>
|
||||
<tr id="<%= dom_id(answer) %>" class="poll_question_answer">
|
||||
<td><%= answer.title %></td>
|
||||
<td><%= answer.description %></td>
|
||||
<td class="text-center">
|
||||
(<%= answer.images.count %>)<br>
|
||||
<%= link_to t("admin.questions.show.answers.images_list"),
|
||||
admin_answer_images_path(answer) %></td>
|
||||
<td><%= link_to t("admin.questions.show.answers.video_list",
|
||||
count: answer.videos.count),
|
||||
admin_answer_videos_path(answer) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
<% if @question.video_url.present? %>
|
||||
<p>
|
||||
<strong><%= t("admin.questions.show.video_url") %></strong>
|
||||
<br>
|
||||
<a href="<%= @question.video_url %>"><%= @question.video_url %></a>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<% if @question.documents.any? %>
|
||||
<p>
|
||||
<strong><%= t("admin.questions.show.documents") %></strong>
|
||||
<br>
|
||||
<a href="<%= @question.documents.first.attachment.url %>"><%= @question.documents.first.title %></a>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
@@ -24,12 +24,12 @@
|
||||
<div class="small-12 medium-3 column">
|
||||
<label><%= t("admin.poll_shifts.new.date") %></label>
|
||||
<%= select 'shift[date]', 'vote_collection_date',
|
||||
options_for_select(shift_vote_collection_dates(@polls)),
|
||||
options_for_select(shift_vote_collection_dates(@booth.polls)),
|
||||
{ prompt: t("admin.poll_shifts.new.select_date"),
|
||||
label: false },
|
||||
class: 'js-shift-vote-collection-dates' %>
|
||||
<%= select 'shift[date]', 'recount_scrutiny_date',
|
||||
options_for_select(shift_recount_scrutiny_dates(@polls)),
|
||||
options_for_select(shift_recount_scrutiny_dates(@booth.polls)),
|
||||
{ prompt: t("admin.poll_shifts.new.select_date"),
|
||||
label: false },
|
||||
class: 'js-shift-recount-scrutiny-dates',
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
<div>
|
||||
<%= f.label :image, t("images.form.admin_title") %>
|
||||
|
||||
|
||||
<%= link_to_add_association t('images.form.add_new_image'), f, :image,
|
||||
force_non_association_create: true,
|
||||
partial: "images/image_fields",
|
||||
@@ -15,6 +14,8 @@
|
||||
association_insertion_node: "#nested-image",
|
||||
association_insertion_method: "append"
|
||||
} %>
|
||||
|
||||
<%= render_image(f.object.image, :thumb, false) if f.object.image %>
|
||||
|
||||
<div id="nested-image">
|
||||
<%= f.fields_for :image do |image_builder| %>
|
||||
@@ -26,17 +27,11 @@
|
||||
|
||||
<%= image_builder.text_field :title, placeholder: t("images.form.title_placeholder"), label: "#{t("images.form.admin_alt_text")}" %>
|
||||
|
||||
|
||||
<div class="attachment-actions">
|
||||
<div class="small-12 column action-add attachment-errors image-attachment">
|
||||
<%= render_image_attachment(image_builder, imageable, image_builder.object) %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column">
|
||||
<div class="progress-bar-placeholder"><div class="loading-bar"></div></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
<%= f.label :image, t("images.form.title") %>
|
||||
<% image_fields ||= :image %>
|
||||
|
||||
<%= f.label image_fields, t("images.form.title") %>
|
||||
<p class="help-text"><%= imageables_note(imageable) %></p>
|
||||
|
||||
<div id="nested-image">
|
||||
<%= f.fields_for :image do |image_builder| %>
|
||||
<%= f.fields_for image_fields do |image_builder| %>
|
||||
<%= render 'images/image_fields', f: image_builder, imageable: imageable %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= link_to_add_association t('images.form.add_new_image'), f, :image,
|
||||
<%= link_to_add_association t('images.form.add_new_image'), f, image_fields,
|
||||
force_non_association_create: true,
|
||||
partial: "images/image_fields",
|
||||
id: "new_image_link",
|
||||
class: "button hollow #{"hide" if imageable.image.present?}",
|
||||
class: "button hollow
|
||||
#{"hide" if image_fields == :image && imageable.image.present?}",
|
||||
render_options: {
|
||||
locals: { imageable: imageable }
|
||||
},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div class="orbit margin-bottom" role="region" aria-label="Answer 1" data-orbit data-auto-play="false">
|
||||
<a data-toggle="answer_1" class="zoom-link show-for-medium-up">
|
||||
<div class="orbit margin-bottom" role="region" aria-label="<%= answer.title %>" data-orbit data-auto-play="false">
|
||||
<a data-toggle="answer_<%= answer.id %>" class="zoom-link show-for-medium-up">
|
||||
<span class="icon-search-plus"></span>
|
||||
<span class="show-for-sr"><%= t("polls.show.zoom_plus") %></span>
|
||||
</a>
|
||||
@@ -15,32 +15,25 @@
|
||||
<span class="show-for-sr"><%= t("shared.orbit.next_slide") %></span>▶︎
|
||||
</button>
|
||||
</li>
|
||||
<!-- each image do -->
|
||||
<li class="is-active orbit-slide">
|
||||
<%= link_to "/assets/example_vertical.jpg", target: "_blank" do %>
|
||||
<%= image_tag "example_horizontal.jpg", class: "orbit-image" %>
|
||||
<% end %>
|
||||
<!-- replace this with image title -->
|
||||
<span class="orbit-caption">Image title 1</span>
|
||||
<!-- /. replace this with image title -->
|
||||
</li>
|
||||
<!-- end -->
|
||||
<li class="orbit-slide">
|
||||
<%= link_to "/assets/example_vertical.jpg", target: "_blank" do %>
|
||||
<%= image_tag "example_vertical.jpg", class: "orbit-image" %>
|
||||
<% end %>
|
||||
<span class="orbit-caption">Image title 2</span>
|
||||
</li>
|
||||
|
||||
<% answer.images.each_with_index do |image, index| %>
|
||||
<li class="orbit-slide <%= active_class(index) %>">
|
||||
<%= link_to image.attachment.url(:original), target: "_blank" do %>
|
||||
<%= image_tag image.attachment.url(:medium),
|
||||
class: "orbit-image",
|
||||
alt: image.title %>
|
||||
<% end %>
|
||||
<span class="orbit-caption"><%= image.title %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
</ul>
|
||||
|
||||
<nav class="orbit-bullets">
|
||||
<button class="is-active" data-slide="0">
|
||||
<!-- replace this with image title -->
|
||||
<span class="show-for-sr">Image title 1</span>
|
||||
<!-- /. replace this with image title -->
|
||||
</button>
|
||||
<button data-slide="1">
|
||||
<span class="show-for-sr">Image title 2</span>
|
||||
</button>
|
||||
<% answer.images.each_with_index do |image, index| %>
|
||||
<button class="<%= active_class(index) %>" data-slide="<%= index %>">
|
||||
<span class="show-for-sr"><%= image.title %></span>
|
||||
</button>
|
||||
<% end %>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
@@ -1,37 +1,9 @@
|
||||
<% poll_group.each do |poll| %>
|
||||
<div class="poll with-image">
|
||||
<% if poll.answerable_by?(current_user) && poll.votable_by?(current_user) %>
|
||||
<%= link_to poll,
|
||||
class: "icon-poll-answer can-answer",
|
||||
title: t("polls.index.can_answer") do %>
|
||||
<span class="show-for-sr">
|
||||
<%= t("polls.index.can_answer") %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% elsif current_user.nil? %>
|
||||
<%= link_to new_user_session_path,
|
||||
class: "icon-poll-answer not-logged-in",
|
||||
title: t("polls.index.cant_answer_not_logged_in") do %>
|
||||
<span class="show-for-sr">
|
||||
<%= t("polls.index.cant_answer_not_logged_in") %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% elsif current_user.unverified? %>
|
||||
<%= link_to verification_path,
|
||||
class: "icon-poll-answer unverified",
|
||||
title: t("polls.index.cant_answer_verify") do %>
|
||||
<span class="show-for-sr">
|
||||
<%= t("polls.index.cant_answer_verify") %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% elsif !poll.votable_by?(current_user) %>
|
||||
<% if user_signed_in? && !poll.votable_by?(current_user) %>
|
||||
<div class="icon-poll-answer already-answer" title="<%= t("polls.index.already_answer") %>">
|
||||
<span class="show-for-sr"><%= t("polls.index.already_answer") %></span>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="icon-poll-answer cant-answer" title="<%= t("polls.index.cant_answer") %>">
|
||||
<span class="show-for-sr"><%= t("polls.index.cant_answer") %></span>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="row" data-equalizer>
|
||||
<div class="small-12 medium-3 column">
|
||||
|
||||
@@ -62,27 +62,23 @@
|
||||
<div class="expanded poll-more-info-answers">
|
||||
<div class="row padding">
|
||||
|
||||
<!-- EACH ANSWER DO -->
|
||||
<div class="small-12 medium-6 column end" id="answer_1" data-toggler=".medium-6">
|
||||
<% @poll.questions.map(&:question_answers).flatten.each do |answer| %>
|
||||
<div class="small-12 medium-6 column end" id="answer_<%= answer.id %>"
|
||||
data-toggler=".medium-6">
|
||||
|
||||
<!-- REPLACE THIS WITH answer title -->
|
||||
<h3>Answer 1</h3>
|
||||
<!-- /. REPLACE THIS WITH answer title -->
|
||||
<h3><%= answer.title %></h3>
|
||||
|
||||
<!-- If Answer have images render this:
|
||||
Maybe something like <%# render "gallery", gallery: answer.gallery %> -->
|
||||
<%= render "gallery" %>
|
||||
<!-- If Answer have images render this -->
|
||||
<% if answer.images.any? %>
|
||||
<%= render "gallery", answer: answer %>
|
||||
<% end %>
|
||||
|
||||
<div class="margin-top">
|
||||
<%= safe_html_with_links simple_format(answer.description) %>
|
||||
</div>
|
||||
|
||||
<!-- REPLACE THIS WITH answer description -->
|
||||
<div class="margin-top">
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
||||
</div>
|
||||
<!-- /. REPLACE THIS WITH answer description -->
|
||||
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<!-- /. EACH ANSWER DO -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user