From 687fbfac08feac36ccf7ceabd89e882eb76cbbff Mon Sep 17 00:00:00 2001 From: decabeza Date: Sat, 7 Oct 2017 02:05:37 +0200 Subject: [PATCH 01/12] changes zoom icon when is active --- app/views/polls/_gallery.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/polls/_gallery.html.erb b/app/views/polls/_gallery.html.erb index d3da43b88..14da0f27b 100644 --- a/app/views/polls/_gallery.html.erb +++ b/app/views/polls/_gallery.html.erb @@ -1,6 +1,6 @@
- - + + <%= t("polls.show.zoom_plus") %> From cd495c80fe8bd35a567ba5d1e0a9cfdfe0bae2fb Mon Sep 17 00:00:00 2001 From: decabeza Date: Sat, 7 Oct 2017 02:08:01 +0200 Subject: [PATCH 02/12] changes border right to bottom when expand gallery --- app/assets/stylesheets/participation.scss | 7 +++++++ app/views/polls/show.html.erb | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/participation.scss b/app/assets/stylesheets/participation.scss index 2df8292f6..8567bde69 100644 --- a/app/assets/stylesheets/participation.scss +++ b/app/assets/stylesheets/participation.scss @@ -1576,6 +1576,13 @@ .column:nth-child(odd) { border-right: 1px solid #eee; } + + .answer-divider { + border-bottom: 1px solid #eee; + border-right: 0 !important; + margin-bottom: $line-height; + padding-bottom: $line-height; + } } .orbit-bullets button { diff --git a/app/views/polls/show.html.erb b/app/views/polls/show.html.erb index 1eb128333..365f6f37c 100644 --- a/app/views/polls/show.html.erb +++ b/app/views/polls/show.html.erb @@ -71,7 +71,7 @@ <% @poll.questions.map(&:question_answers).flatten.each do |answer| %>
+ data-toggler="medium-6 answer-divider"> <% if answer.description.present? %>

<%= answer.title %>

From 732fb70730eec1727fccd1c12ef43cd4f16f6d22 Mon Sep 17 00:00:00 2001 From: decabeza Date: Sat, 7 Oct 2017 03:03:17 +0200 Subject: [PATCH 03/12] makes answers buttons width 100% on mobile size --- app/assets/stylesheets/participation.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/assets/stylesheets/participation.scss b/app/assets/stylesheets/participation.scss index 8567bde69..ca9f7ab08 100644 --- a/app/assets/stylesheets/participation.scss +++ b/app/assets/stylesheets/participation.scss @@ -1776,6 +1776,10 @@ margin-right: $line-height / 4; min-width: rem-calc(168); + @include breakpoint(medium down) { + width: 100%; + } + &.answered { background: #f4f8ec; border: 2px solid #92ba48; From 3ddcb0fd218539caf425db80fae50dcb1fc31479 Mon Sep 17 00:00:00 2001 From: decabeza Date: Sat, 7 Oct 2017 11:52:50 +0200 Subject: [PATCH 04/12] changes large size to original for gallery images --- app/views/polls/_gallery.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/polls/_gallery.html.erb b/app/views/polls/_gallery.html.erb index 14da0f27b..45408c0da 100644 --- a/app/views/polls/_gallery.html.erb +++ b/app/views/polls/_gallery.html.erb @@ -19,7 +19,7 @@ <% answer.images.reverse.each_with_index do |image, 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 %> From a5d3d5d239486d3d6ccbd5095447a3e4bc8e8325 Mon Sep 17 00:00:00 2001 From: decabeza Date: Sat, 7 Oct 2017 11:53:34 +0200 Subject: [PATCH 05/12] adds links to read more and less for answer description --- app/assets/stylesheets/participation.scss | 9 +++++++++ app/views/polls/show.html.erb | 15 ++++++++++++++- config/locales/en/general.yml | 2 ++ config/locales/es/general.yml | 2 ++ 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/participation.scss b/app/assets/stylesheets/participation.scss index ca9f7ab08..b41e2de2f 100644 --- a/app/assets/stylesheets/participation.scss +++ b/app/assets/stylesheets/participation.scss @@ -1583,6 +1583,15 @@ margin-bottom: $line-height; padding-bottom: $line-height; } + + .answer-description { + height: 100%; + + &.short { + height: $line-height * 12; + overflow: hidden; + } + } } .orbit-bullets button { diff --git a/app/views/polls/show.html.erb b/app/views/polls/show.html.erb index 365f6f37c..7686759ca 100644 --- a/app/views/polls/show.html.erb +++ b/app/views/polls/show.html.erb @@ -83,7 +83,20 @@ <% if answer.description.present? %>
    - <%= safe_html_with_links simple_format(answer.description) %> +
    + <%= safe_html_with_links simple_format(answer.description) %> +
    + + <%= t("polls.show.read_more", answer: answer.title) %> + + + <%= t("polls.show.read_less", answer: answer.title) %> +
    <% end %> diff --git a/config/locales/en/general.yml b/config/locales/en/general.yml index 82abea68b..79621ddb5 100644 --- a/config/locales/en/general.yml +++ b/config/locales/en/general.yml @@ -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" diff --git a/config/locales/es/general.yml b/config/locales/es/general.yml index c613e6b40..334090b7b 100644 --- a/config/locales/es/general.yml +++ b/config/locales/es/general.yml @@ -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" From e7716ca4b33e3aa99df75981f2bd3824e86f72af Mon Sep 17 00:00:00 2001 From: decabeza Date: Sat, 7 Oct 2017 11:56:34 +0200 Subject: [PATCH 06/12] makes darker border answer divider --- app/assets/stylesheets/participation.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/stylesheets/participation.scss b/app/assets/stylesheets/participation.scss index b41e2de2f..605afaee8 100644 --- a/app/assets/stylesheets/participation.scss +++ b/app/assets/stylesheets/participation.scss @@ -1574,11 +1574,11 @@ border-bottom: 1px solid #eee; .column:nth-child(odd) { - border-right: 1px solid #eee; + border-right: 2px solid $text; } .answer-divider { - border-bottom: 1px solid #eee; + border-bottom: 2px solid $text; border-right: 0 !important; margin-bottom: $line-height; padding-bottom: $line-height; From 316b6720cbc574a85a3efa2a8905436409befd3e Mon Sep 17 00:00:00 2001 From: decabeza Date: Sat, 7 Oct 2017 14:31:04 +0200 Subject: [PATCH 07/12] fixes polls show indentation and adds missing <% end %> --- app/views/polls/show.html.erb | 66 +++++++++++++++++------------------ 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/app/views/polls/show.html.erb b/app/views/polls/show.html.erb index a6324b985..913b58d4c 100644 --- a/app/views/polls/show.html.erb +++ b/app/views/polls/show.html.erb @@ -71,41 +71,41 @@
    - <% @poll.questions.map(&:question_answers).flatten.each do |answer| %> -
    -

    <%= answer.title %>

    + <% @poll.questions.map(&:question_answers).flatten.each do |answer| %> +
    +

    <%= answer.title %>

    - <% if answer.description.present? %> -
    - <%= safe_html_with_links simple_format(answer.description) %> -
    - <% end %> - - <% if answer.images.any? %> - <%= render "gallery", answer: answer %> - <% end %> - - <% if answer.description.present? %> -
    -
    + <% if answer.description.present? %> +
    <%= safe_html_with_links simple_format(answer.description) %>
    - - <%= t("polls.show.read_more", answer: answer.title) %> - - - <%= t("polls.show.read_less", answer: answer.title) %> - -
    - <% end %> + <% end %> - <% if answer.documents.present? %> + <% if answer.images.any? %> + <%= render "gallery", answer: answer %> + <% end %> + + <% if answer.description.present? %> + + <% end %> + + <% if answer.documents.present? %> <% answer.documents.each do |document| %> <%= link_to document.title, document.attachment.url, @@ -113,8 +113,8 @@ rel: "nofollow" %> <% end %> <% end %> -
    - +
    + <% end %>
    <% end %> From 38f100d183883cccf9aa44d7c32ac9d69f486467 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Sat, 7 Oct 2017 14:40:26 +0200 Subject: [PATCH 08/12] fixes loading of poll question --- app/controllers/admin/poll/questions/answers_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/admin/poll/questions/answers_controller.rb b/app/controllers/admin/poll/questions/answers_controller.rb index 45f0abcd7..18b44d279 100644 --- a/app/controllers/admin/poll/questions/answers_controller.rb +++ b/app/controllers/admin/poll/questions/answers_controller.rb @@ -1,6 +1,6 @@ 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] + before_action :load_question, except: [:show, :edit, :update] load_and_authorize_resource :question, class: "::Poll::Question" @@ -51,7 +51,7 @@ class Admin::Poll::Questions::AnswersController < Admin::Poll::BaseController end def load_question - @question = ::Poll::Question.find(params[:question_id]) + @question = @answer.question end end From 12427e1ce5e57fcd2f43e04d575f21a551f81135 Mon Sep 17 00:00:00 2001 From: decabeza Date: Sat, 7 Oct 2017 14:46:55 +0200 Subject: [PATCH 09/12] adds styles to document link on polls show --- app/views/polls/show.html.erb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/views/polls/show.html.erb b/app/views/polls/show.html.erb index 913b58d4c..e152f888c 100644 --- a/app/views/polls/show.html.erb +++ b/app/views/polls/show.html.erb @@ -106,12 +106,19 @@ <% end %> <% if answer.documents.present? %> + <% end %>
    <% end %> From 9ec57f68c2f80d3ff54204b28d5b1450dd0912f2 Mon Sep 17 00:00:00 2001 From: decabeza Date: Sat, 7 Oct 2017 14:49:36 +0200 Subject: [PATCH 10/12] changes list of videos links on polls question admin --- app/views/admin/poll/questions/show.html.erb | 5 +++-- config/locales/en/admin.yml | 2 +- config/locales/es/admin.yml | 2 +- config/locales/fr/admin.yml | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/views/admin/poll/questions/show.html.erb b/app/views/admin/poll/questions/show.html.erb index 123d2ec13..5baabeafe 100644 --- a/app/views/admin/poll/questions/show.html.erb +++ b/app/views/admin/poll/questions/show.html.erb @@ -64,8 +64,9 @@ admin_answer_documents_path(answer) %> - <%= link_to t("admin.questions.show.answers.video_list", - count: answer.videos.count), + (<%= answer.videos.count %>) +
    + <%= link_to t("admin.questions.show.answers.video_list"), admin_answer_videos_path(answer) %> diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index b16214a2a..442c93727 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -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 diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index 75fa73dff..5b6393b1b 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -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 diff --git a/config/locales/fr/admin.yml b/config/locales/fr/admin.yml index d80e55fc9..b9cdfcfd3 100644 --- a/config/locales/fr/admin.yml +++ b/config/locales/fr/admin.yml @@ -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 From 777237421fa5a4d777ccf17ec7add08b044d0d3e Mon Sep 17 00:00:00 2001 From: rgarcia Date: Sat, 7 Oct 2017 14:55:08 +0200 Subject: [PATCH 11/12] fixes specs --- app/controllers/admin/poll/questions/answers_controller.rb | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/app/controllers/admin/poll/questions/answers_controller.rb b/app/controllers/admin/poll/questions/answers_controller.rb index 18b44d279..511807b10 100644 --- a/app/controllers/admin/poll/questions/answers_controller.rb +++ b/app/controllers/admin/poll/questions/answers_controller.rb @@ -1,6 +1,5 @@ class Admin::Poll::Questions::AnswersController < Admin::Poll::BaseController before_action :load_answer, only: [:show, :edit, :update, :documents] - before_action :load_question, except: [:show, :edit, :update] 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 = @answer.question - end - end From 953a6e7573321c5c4705f63b2bd84f4c1a456d92 Mon Sep 17 00:00:00 2001 From: decabeza Date: Sat, 7 Oct 2017 15:23:31 +0200 Subject: [PATCH 12/12] updates videos link spec --- .../features/admin/poll/questions/answers/videos/videos_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/features/admin/poll/questions/answers/videos/videos_spec.rb b/spec/features/admin/poll/questions/answers/videos/videos_spec.rb index ee04ce128..35d07f454 100644 --- a/spec/features/admin/poll/questions/answers/videos/videos_spec.rb +++ b/spec/features/admin/poll/questions/answers/videos/videos_spec.rb @@ -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"