Merge branch 'master' into mlucena-poll-comments

This commit is contained in:
Raimond Garcia
2017-10-09 17:59:12 +02:00
committed by GitHub
58 changed files with 859 additions and 218 deletions

View File

@@ -1,6 +1,6 @@
<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>
<a data-toggle="answer_<%= answer.id %> zoom_<%= answer.id %>" class="zoom-link hide-for-small-only">
<span id="zoom_<%= answer.id %>" class="icon-search-plus" data-toggler="icon-search-plus icon-search-minus"></span>
<span class="show-for-sr"><%= t("polls.show.zoom_plus") %></span>
</a>
@@ -16,10 +16,10 @@
</button>
</li>
<% answer.images.each_with_index do |image, index| %>
<% answer.images.reverse.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),
<%= image_tag image.attachment.url(:original),
class: "orbit-image",
alt: image.title %>
<% end %>

View File

@@ -1,11 +1,11 @@
<% poll_group.each do |poll| %>
<div class="poll with-image">
<% if user_signed_in? && !poll.votable_by?(current_user) %>
<% if user_signed_in? && !current_user.unverified? && !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>
<% end %>
<div class="row" data-equalizer>
<div class="row" data-equalizer data-equalize-on="medium">
<div class="small-12 medium-3 column">
<div class="image-container" data-equalizer-watch>
<% if poll.image.present? %>

View File

@@ -1,18 +1,20 @@
<div class="poll-question-answers">
<% if can? :answer, question %>
<% if can?(:answer, question) && !question.poll.voted_in_booth?(current_user) %>
<% question.question_answers.each do |answer| %>
<% if @answers_by_question_id[question.id] == answer.title %>
<span class="button answered"
title="<%= t("poll_questions.show.voted", answer: answer)%>">
<% if @answers_by_question_id[question.id] == answer.title &&
(!voted_before_sign_in(question) ||
question.poll.voted_in_booth?(current_user)) %>
<span class="button answered"
title="<%= t("poll_questions.show.voted", answer: answer.title)%>">
<%= answer.title %>
</span>
<% else %>
<%= link_to answer.title,
answer_question_path(question, answer: answer.title),
answer_question_path(question, answer: answer.title, token: token),
method: :post,
remote: true,
title: t("poll_questions.show.vote_answer", answer: answer.title),
class: "button secondary hollow" %>
class: "button secondary hollow js-question-answer" %>
<% end %>
<% end %>
<% else %>

View File

@@ -4,6 +4,6 @@
</h3>
<div id="<%= dom_id(question) %>_answers" class="padding">
<%= render 'polls/questions/answers', question: question %>
<%= render 'polls/questions/answers', question: question, token: token %>
</div>
</div>

View File

@@ -1 +1,2 @@
$("#<%= dom_id(@question) %>_answers").html('<%= j render("polls/questions/answers", question: @question) %>');
<% token = poll_voter_token(@question.poll, current_user) %>
$("#<%= dom_id(@question) %>_answers").html('<%= j render("polls/questions/answers", question: @question, token: token) %>');

View File

@@ -38,10 +38,25 @@
<%= t("polls.show.already_voted_in_booth") %>
</div>
<% else %>
<% @questions.each do |question| %>
<%= render 'polls/questions/question', question: question %>
<% if current_user && !@poll.votable_by?(current_user) %>
<div class="callout warning">
<%= t("polls.show.already_voted_in_web") %>
</div>
<% end %>
<% end %>
<% @questions.each do |question| %>
<%= render 'polls/questions/question', question: question, token: @token %>
<% end %>
<% if poll_voter_token(@poll, current_user).empty? %>
<div class="callout token-message js-token-message" style="display: none">
<%= t('poll_questions.show.voted_token') %>
</div>
<% end %>
<%= link_to t("polls.show.participate_in_other_polls"), polls_path, class: "button hollow" %>
</div>
</div>
@@ -52,10 +67,12 @@
<%= safe_html_with_links simple_format(@poll.description) %>
</div>
<aside class="small-12 medium-3 column">
<% if false %>
<aside class="small-12 medium-3 column">
<div class="sidebar-divider"></div>
<h2><%= t("polls.show.documents") %></h2>
</aside>
</aside>
<% end %>
</div>
</div>
@@ -64,23 +81,57 @@
<% @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">
data-toggler="medium-6 answer-divider">
<h3><%= answer.title %></h3>
<% if answer.description.present? %>
<h3><%= answer.title %></h3>
<% end %>
<% if answer.images.any? %>
<%= render "gallery", answer: answer %>
<% end %>
<div class="margin-top">
<%= safe_html_with_links simple_format(answer.description) %>
</div>
<% if answer.description.present? %>
<div class="margin-top">
<div id="answer_description_<%= answer.id %>" class="answer-description short" data-toggler="short">
<%= safe_html_with_links simple_format(answer.description) %>
</div>
<a id="read_more_<%= answer.id %>"
data-toggle="answer_description_<%= answer.id %> read_more_<%= answer.id %> read_less_<%= answer.id %>"
data-toggler="hide">
<%= t("polls.show.read_more", answer: answer.title) %>
</a>
<a id="read_less_<%= answer.id %>"
data-toggle="answer_description_<%= answer.id %> read_more_<%= answer.id %> read_less_<%= answer.id %>"
data-toggler="hide"
class="hide">
<%= t("polls.show.read_less", answer: answer.title) %>
</a>
</div>
<% end %>
<% if answer.documents.present? %>
<div class="document-link">
<p>
<span class="icon-document"></span>&nbsp;
<strong><%= t("polls.show.documents") %></strong>
</p>
<% answer.documents.each do |document| %>
<%= link_to document.title,
document.attachment.url,
target: "_blank",
rel: "nofollow" %><br>
<% end %>
</div>
<% end %>
</div>
<% end %>
</div>
<div class="tabs-panel is-active" id="tab-comments">
<%= render "shared/comments" %>
</div>
</div>
</div>