Merge pull request #2008 from consul/polls-gallery-polish

Polls gallery polish
This commit is contained in:
Raimond Garcia
2017-10-07 15:44:37 +02:00
committed by GitHub
11 changed files with 84 additions and 40 deletions

View File

@@ -1574,7 +1574,23 @@
border-bottom: 1px solid #eee;
.column:nth-child(odd) {
border-right: 1px solid #eee;
border-right: 2px solid $text;
}
.answer-divider {
border-bottom: 2px solid $text;
border-right: 0 !important;
margin-bottom: $line-height;
padding-bottom: $line-height;
}
.answer-description {
height: 100%;
&.short {
height: $line-height * 12;
overflow: hidden;
}
}
}
@@ -1769,6 +1785,10 @@
margin-right: $line-height / 4;
min-width: rem-calc(168);
@include breakpoint(medium down) {
width: 100%;
}
&.answered {
background: #f4f8ec;
border: 2px solid #92ba48;

View File

@@ -1,5 +1,4 @@
class Admin::Poll::Questions::AnswersController < Admin::Poll::BaseController
before_action :load_question, except: [:show, :edit, :update]
before_action :load_answer, only: [:show, :edit, :update, :documents]
load_and_authorize_resource :question, class: "::Poll::Question"
@@ -12,7 +11,7 @@ class Admin::Poll::Questions::AnswersController < Admin::Poll::BaseController
@answer = ::Poll::Question::Answer.new(answer_params)
if @answer.save
redirect_to admin_question_path(@question),
redirect_to admin_question_path(@answer.question),
notice: t("flash.actions.create.poll_question_answer")
else
render :new
@@ -50,8 +49,4 @@ class Admin::Poll::Questions::AnswersController < Admin::Poll::BaseController
@answer = ::Poll::Question::Answer.find(params[:id] || params[:answer_id])
end
def load_question
@question = ::Poll::Question.find(params[:question_id])
end
end

View File

@@ -64,8 +64,9 @@
admin_answer_documents_path(answer) %>
</td>
<td class="text-center">
<%= link_to t("admin.questions.show.answers.video_list",
count: answer.videos.count),
(<%= answer.videos.count %>)
<br>
<%= link_to t("admin.questions.show.answers.video_list"),
admin_answer_videos_path(answer) %>
</td>
</tr>

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 show-for-medium-up">
<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>
@@ -19,7 +19,7 @@
<% 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(:large),
<%= image_tag image.attachment.url(:original),
class: "orbit-image",
alt: image.title %>
<% end %>

View File

@@ -71,33 +71,57 @@
<div class="expanded poll-more-info-answers">
<div class="row padding">
<div class="small-12 medium-6 column end" id="answer_<%= answer.id %>"
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 answer-divider">
<h3><%= answer.title %></h3>
<h3><%= answer.title %></h3>
<% if answer.description.present? %>
<div class="margin-top">
<%= safe_html_with_links simple_format(answer.description) %>
</div>
<% end %>
<% if answer.images.any? %>
<%= render "gallery", answer: answer %>
<% end %>
<% if answer.documents.present? %>
<% answer.documents.each do |document| %>
<tr>
<td><%= link_to document.title,
document.attachment.url,
target: "_blank",
rel: "nofollow" %></td>
</tr>
<% if answer.description.present? %>
<div class="margin-top">
<%= safe_html_with_links simple_format(answer.description) %>
</div>
<% end %>
<% end %>
</div>
<% if answer.images.any? %>
<%= render "gallery", answer: answer %>
<% end %>
<% 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>
<% end %>

View File

@@ -602,7 +602,7 @@ en:
title: Answer
description: Description
videos: Videos
video_list: Video list (%{count})
video_list: Video list
images: Images
images_list: Images list
documents: Documents

View File

@@ -492,6 +492,8 @@ en:
more_info_title: "More information"
documents: Documents
zoom_plus: Expand image
read_more: "Read more about %{answer}"
read_less: "Read less about %{answer}"
poll_questions:
create_question: "Create question"
default_valid_answers: "Yes, No"

View File

@@ -602,7 +602,7 @@ es:
title: Respuesta
description: Descripción
videos: Vídeos
video_list: Lista de vídeos (%{count})
video_list: Lista de vídeos
images: Imágenes
images_list: Lista de imágenes
documents: Documentos

View File

@@ -492,6 +492,8 @@ es:
more_info_title: "Más información"
documents: Documentación
zoom_plus: Ampliar imagen
read_more: "Leer más sobre %{answer}"
read_less: "Leer menos sobre %{answer}"
poll_questions:
create_question: "Crear pregunta para votación"
default_valid_answers: "Sí, No"

View File

@@ -389,7 +389,7 @@ fr:
title: Réponse
description: Description
videos: Vidéos
video_list: Liste des vidéos (%{count})
video_list: Liste des vidéos
answers:
show:
title: Titre

View File

@@ -16,7 +16,7 @@ feature 'Videos' do
visit admin_question_path(question)
within("#poll_question_answer_#{answer.id}") do
click_link "Video list (#{answer.videos.count})"
click_link "Video list"
end
click_link "Add video"