Merge branch 'master' into fix/shift_creation_polls

This commit is contained in:
Bertocq
2017-10-04 15:27:54 +02:00
47 changed files with 304 additions and 446 deletions

Binary file not shown.

View File

@@ -63,4 +63,6 @@
<glyph glyph-name="telegram" unicode="&#49;" d="M504 509c6-5 9-11 8-18l-73-439c-1-6-4-10-10-13-2-2-5-2-8-2-3 0-5 0-7 1l-130 53-69-84c-3-5-8-7-14-7-2 0-4 0-6 1-4 1-7 4-9 7-2 3-3 6-3 10l0 100 247 303-306-265-113 47c-7 2-10 7-11 15 0 8 3 14 9 17l476 274c2 2 5 3 9 3 4 0 7-1 10-3z"/>
<glyph glyph-name="instagram" unicode="&#50;" d="M426 105l0 185-39 0c4-12 6-25 6-38 0-24-6-46-18-66-13-20-29-36-50-48-21-12-44-18-69-18-37 0-69 13-96 39-27 26-40 57-40 93 0 13 2 26 6 38l-41 0 0-185c0-5 2-10 5-13 4-3 8-5 13-5l305 0c5 0 9 2 13 5 3 3 5 8 5 13z m-81 152c0 23-9 44-26 60-18 17-38 25-63 25-24 0-45-8-62-25-17-16-26-37-26-60 0-24 9-44 26-61 17-16 38-25 62-25 25 0 45 9 63 25 17 17 26 37 26 61z m81 103l0 47c0 5-2 10-6 14-4 4-8 6-14 6l-50 0c-5 0-10-2-14-6-4-4-5-9-5-14l0-47c0-6 1-10 5-14 4-4 9-6 14-6l50 0c6 0 10 2 14 6 4 4 6 8 6 14z m49 59l0-326c0-16-5-29-16-40-11-11-24-16-40-16l-326 0c-16 0-29 5-40 16-11 11-16 24-16 40l0 326c0 16 5 29 16 40 11 11 24 16 40 16l326 0c16 0 29-5 40-16 11-11 16-24 16-40z"/>
<glyph glyph-name="image" unicode="&#51;" d="M165 347c0-15-6-28-16-38-11-11-24-16-39-16-16 0-28 5-39 16-11 10-16 23-16 38 0 16 5 29 16 39 11 11 23 16 39 16 15 0 28-5 39-16 10-10 16-23 16-39z m292-109l0-128-402 0 0 55 91 91 46-46 146 147z m28 201l-458 0c-2 0-4-1-6-3-2-2-3-4-3-6l0-348c0-2 1-4 3-6 2-2 4-3 6-3l458 0c2 0 4 1 6 3 2 2 3 4 3 6l0 348c0 2-1 4-3 6-2 2-4 3-6 3z m45-9l0-348c0-12-4-23-13-32-9-9-20-13-32-13l-458 0c-12 0-23 4-32 13-9 9-13 20-13 32l0 348c0 12 4 23 13 32 9 9 20 13 32 13l458 0c12 0 23-4 32-13 9-9 13-20 13-32z"/>
<glyph glyph-name="search-plus" unicode="&#52;" d="M311 283l0-18c0-2-1-4-3-6-2-2-4-3-6-3l-64 0 0-64c0-2-1-5-3-6-2-2-4-3-6-3l-19 0c-2 0-4 1-6 3-2 1-3 4-3 6l0 64-64 0c-2 0-4 1-6 3-2 2-3 4-3 6l0 18c0 3 1 5 3 7 2 2 4 3 6 3l64 0 0 64c0 2 1 4 3 6 2 2 4 3 6 3l19 0c2 0 4-1 6-3 2-2 3-4 3-6l0-64 64 0c2 0 4-1 6-3 2-2 3-4 3-7z m36-9c0 36-12 66-37 91-25 25-55 37-91 37-35 0-65-12-90-37-25-25-38-55-38-91 0-35 13-65 38-90 25-25 55-38 90-38 36 0 66 13 91 38 25 25 37 55 37 90z m147-237c0-11-4-19-11-26-7-7-16-11-26-11-10 0-19 4-26 11l-98 98c-34-24-72-36-114-36-27 0-53 5-78 16-25 11-46 25-64 43-18 18-32 39-43 64-10 25-16 51-16 78 0 28 6 54 16 78 11 25 25 47 43 65 18 18 39 32 64 43 25 10 51 15 78 15 28 0 54-5 79-15 24-11 46-25 64-43 18-18 32-40 43-65 10-24 16-50 16-78 0-42-12-80-36-114l98-98c7-7 11-15 11-25z"/>
<glyph glyph-name="search-minus" unicode="&#53;" d="M311 283l0-18c0-2-1-4-3-6-2-2-4-3-6-3l-165 0c-2 0-4 1-6 3-2 2-3 4-3 6l0 18c0 3 1 5 3 7 2 2 4 3 6 3l165 0c2 0 4-1 6-3 2-2 3-4 3-7z m36-9c0 36-12 66-37 91-25 25-55 37-91 37-35 0-65-12-90-37-25-25-38-55-38-91 0-35 13-65 38-90 25-25 55-38 90-38 36 0 66 13 91 38 25 25 37 55 37 90z m147-237c0-11-4-19-11-26-7-7-16-11-26-11-10 0-19 4-26 11l-98 98c-34-24-72-36-114-36-27 0-53 5-78 16-25 11-46 25-64 43-18 18-32 39-43 64-10 25-16 51-16 78 0 28 6 54 16 78 11 25 25 47 43 65 18 18 39 32 64 43 25 10 51 15 78 15 28 0 54-5 79-15 24-11 46-25 64-43 18-18 32-40 43-65 10-24 16-50 16-78 0-42-12-80-36-114l98-98c7-7 11-15 11-25z"/>
</font></defs></svg>

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

View File

@@ -75,3 +75,5 @@ $accordion-content-color: foreground($accordion-background, $text);
$tab-item-font-size: $base-font-size;
$tab-item-padding: $line-height / 2 0;
$tab-content-border: $border;
$orbit-bullet-diameter: 0.8rem;

View File

@@ -411,7 +411,7 @@ $maincontent-shadow: 0 0 10px rgba($black, 0.5);
$orbit-bullet-background: $medium-gray;
$orbit-bullet-background-active: $dark-gray;
$orbit-bullet-diameter: 0.8rem;
$orbit-bullet-diameter: 1.2rem;
$orbit-bullet-margin: 0.1rem;
$orbit-bullet-margin-top: 0.8rem;
$orbit-bullet-margin-bottom: 0.8rem;

View File

@@ -4,6 +4,7 @@
@import 'consul_settings';
@import 'custom_settings';
@import 'foundation';
@import 'motion-ui/motion-ui';
@include foundation-global-styles;
@include foundation-grid;
@@ -37,3 +38,7 @@
@include foundation-title-bar;
@include foundation-top-bar;
@include foundation-menu-icon;
@include foundation-orbit;
@include motion-ui-transitions;
@include motion-ui-animations;

View File

@@ -260,3 +260,11 @@
.icon-image::before {
content: '\33';
}
.icon-search-plus::before {
content: '\34';
}
.icon-search-minus::before {
content: '\35';
}

View File

@@ -303,6 +303,10 @@ a {
float: left;
}
.back:not([class^="icon-"]) {
text-decoration: underline;
}
.tabs-content {
border: 0;
}
@@ -343,11 +347,9 @@ a {
}
.truncate-horizontal-text {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
-o-text-overflow: ellipsis;
-ms-text-overflow: ellipsis;
white-space: nowrap;
}
.align-top {
@@ -633,7 +635,7 @@ header {
text-align: left;
@include breakpoint(medium) {
margin-right: rem-calc(24);
margin-right: $line-height;
}
&:hover {
@@ -2183,9 +2185,10 @@ table {
}
// 19. Recommended Section Home
// -----------
// ----------------------------
.home-page {
.push {
display: none;
}
@@ -2219,7 +2222,7 @@ table {
.card-section {
padding: $line-height 0;
max-width: 300px;
max-width: rem-calc(300);
margin: 0 auto;
p {
@@ -2229,10 +2232,10 @@ table {
}
.orbit {
height: 300px;
height: rem-calc(300);
.orbit-wrapper {
max-height: 250px;
max-height: rem-calc(250);
overflow: hidden;
position: relative;
}
@@ -2248,7 +2251,7 @@ table {
background: image-url('truncate.png');
background-repeat: repeat-x;
bottom: 0;
height: 20px;
height: rem-calc(20);
position: absolute;
width: 100%;
}
@@ -2269,21 +2272,21 @@ table {
.proposals-inner,
.budget-investments-inner {
background: #fff;
max-height: 350px;
max-height: rem-calc(350);
@include breakpoint(small) {
max-height: 400px;
max-height: rem-calc(400);
}
h4 {
margin-top: $line-height;
margin-bottom: 0;
font-size: rem-calc(18);
min-height: 50px;
min-height: rem-calc(50);
}
h5 {
font-size: rem-calc(14);
font-size: $small-font-size;
text-align: left;
}
}
@@ -2291,20 +2294,20 @@ table {
.carousel-image {
.card .orbit {
height: 480px;
height: rem-calc(480);
.orbit-wrapper {
max-height: 450px;
max-height: rem-calc(450);
}
}
.debates-inner,
.proposals-inner,
.budget-investments-inner {
max-height: 500px;
max-height: rem-calc(500);
@include breakpoint(small) {
max-height: 600px;
max-height: rem-calc(600);
}
}
}
@@ -2318,7 +2321,9 @@ table {
}
}
// 19. Documents
// 20. Documents
// -------------
.documents-list {
table {

View File

@@ -2,7 +2,8 @@
//
// 01. Logo
// 02. Orbit bullets
//
// 03. Direct uploads
// ------------------
// 01. Logo
// --------
@@ -34,6 +35,7 @@
// 02. Orbit bullet
// ----------------
@mixin orbit-bullets {
@include disable-mouse-outline;
position: relative;
@@ -59,8 +61,9 @@
}
}
// 02. Direct uploads
// 03. Direct uploads
// ------------------
@mixin direct-uploads {
.cached-image {
@@ -133,5 +136,4 @@
.loading-bar.no-transition {
transition: none;
}
}

View File

@@ -310,10 +310,7 @@
.budget-investment-new,
.proposal-form,
.proposal-edit,
.new_poll_question,
.edit_poll_question,
.new_poll,
.edit_poll,
.polls-form,
.poll-question-form {
@include direct-uploads;
}
@@ -672,16 +669,15 @@
padding-top: 100%;
}
}
.column:first-child {
text-align: center;
}
}
@include breakpoint(medium) {
.panel {
padding: 0 $line-height / 2 0 0;
&.with-image {
padding: 0 $line-height / 2 0 0;
}
.no-image {
height: 100%;
@@ -829,7 +825,7 @@
background: image-url('truncate.png');
background-repeat: repeat-x;
bottom: 0;
height: 24px;
height: rem-calc(24);
position: absolute;
width: 100%;
}
@@ -1549,18 +1545,8 @@
// 08. Polls
// ----------------------
.dark-heading {
background: #2d3e50;
color: #fff;
.title {
color: #92ba48;
}
.button {
background: #fff;
color: $brand;
}
.polls-show-header {
background: #fafafa;
.callout {
@@ -1576,29 +1562,86 @@
color: $color-alert;
}
}
}
.info {
background: #314253;
padding: $line-height;
.poll-more-info,
.poll-more-info-answers {
border-top: 1px solid #eee;
}
@include breakpoint(medium) {
border-top: rem-calc(6) solid #92ba48;
.poll-more-info-answers {
background: #fafafa;
border-bottom: 1px solid #eee;
.column:nth-child(odd) {
border-right: 1px solid #eee;
}
}
.orbit-bullets button {
background-color: #ccc;
height: $line-height / 2;
width: $line-height / 2;
&.is-active {
background-color: $brand;
}
}
.orbit-container {
height: 100% !important;
max-height: none !important;
}
.orbit-slide {
max-height: none !important;
}
.orbit-caption {
background: #eee;
color: $text;
}
.zoom-link {
background: #fff;
border-radius: rem-calc(48);
color: #000;
font-size: rem-calc(24);
font-weight: bold;
height: rem-calc(48);
line-height: rem-calc(48);
right: 12px;
padding-top: rem-calc(4);
position: absolute;
text-align: center;
top: 24px;
width: rem-calc(48);
z-index: 9;
&:hover {
background: $dark;
color: #fff;
text-decoration: none;
}
}
.image-container {
background: #fafafa;
overflow: hidden;
position: relative;
}
.poll {
&.with-image {
padding: 0 $line-height / 2 0 0;
img {
height: 100%;
max-width: none;
position: absolute;
}
}
a:not(.button) {
color: #fff;
text-decoration: underline;
}
.back,
.icon-angle-left {
color: #fff;
}
&.polls-show-header {
min-height: $line-height * 8;
}
}
.poll,

View File

@@ -56,7 +56,7 @@ class Admin::Poll::QuestionsController < Admin::Poll::BaseController
private
def question_params
params.require(:poll_question).permit(:poll_id, :title, :question, :description, :proposal_id, :valid_answers, :video_url,
params.require(:poll_question).permit(:poll_id, :title, :question, :proposal_id, :valid_answers, :video_url,
documents_attributes: [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy])
end

View File

@@ -29,7 +29,7 @@ class Admin::Poll::ShiftsController < Admin::Poll::BaseController
end
def search_officers
@officers = User.search(params[:search]).order(username: :asc)
@officers = User.search(params[:search]).order(username: :asc).select { |o| o.poll_officer? == true }
end
private

View File

@@ -5,15 +5,6 @@ class Polls::QuestionsController < ApplicationController
has_orders %w{most_voted newest oldest}, only: :show
def show
@commentable = @question.proposal.present? ? @question.proposal : @question
@comment_tree = CommentTree.new(@commentable, params[:page], @current_order)
set_comment_flags(@comment_tree.comments)
question_answer = @question.answers.where(author_id: current_user.try(:id)).first
@answers_by_question_id = {@question.id => question_answer.try(:answer)}
end
def answer
answer = @question.answers.find_or_initialize_by(author: current_user)

View File

@@ -23,7 +23,6 @@ class Poll::Question < ActiveRecord::Base
validates :poll_id, presence: true
validates :title, length: { minimum: 4 }
validates :description, length: { maximum: Poll::Question.description_max_length }
scope :by_poll_id, ->(poll_id) { where(poll_id: poll_id) }
@@ -40,15 +39,10 @@ class Poll::Question < ActiveRecord::Base
def searchable_values
{ title => 'A',
proposal.try(:title) => 'A',
description => 'B',
author.username => 'C',
author_visible_name => 'C' }
end
def description
super.try :html_safe
end
def valid_answers
(super.try(:split, ',').compact || []).map(&:strip)
end
@@ -59,7 +53,6 @@ class Poll::Question < ActiveRecord::Base
self.author_visible_name = proposal.author.name
self.proposal_id = proposal.id
self.title = proposal.title
self.description = proposal.description
self.valid_answers = I18n.t('poll_questions.default_valid_answers')
end
end

View File

@@ -2,4 +2,6 @@
<h2><%= t("admin.polls.edit.title") %></h2>
<%= render "form" %>
<div class="polls-form">
<%= render "form" %>
</div>

View File

@@ -2,4 +2,6 @@
<h2><%= t("admin.polls.new.title") %></h2>
<%= render "form" %>
<div class="polls-form">
<%= render "form" %>
</div>

View File

@@ -20,12 +20,6 @@
<p class="help-text" id="valid-answers-help-text"><%= t("admin.questions.new.valid_answers_note") %></p>
<%= f.text_field :valid_answers, label: false, aria: {describedby: "valid-answers-help-text"} %>
<div class="ckeditor">
<%= f.cktext_area :description,
maxlength: Poll::Question.description_max_length,
ckeditor: { language: I18n.locale } %>
</div>
<div class="documents small-12">
<%= render 'documents/nested_documents', documentable: @question, f: f %>
</div>

View File

@@ -34,12 +34,6 @@
</span>
<% end %>
<p>
<strong><%= t("admin.questions.show.description") %></strong>
<br>
<%= @question.description %>
</p>
<% if @question.video_url.present? %>
<p>
<strong><%= t("admin.questions.show.video_url") %></strong>

View File

@@ -41,7 +41,7 @@
parent_class: "budget_investment" %>
</div>
<% end %>
<% end %>
<div class="small-12 column">
<%= f.text_field :location %>

View File

@@ -1,8 +1,8 @@
<div id="<%= dom_id(investment) %>" class="budget-investment clear">
<div class="panel">
<div class="panel with-image">
<div class="row" data-equalizer>
<div class="small-12 medium-3 large-2 column">
<div class="small-12 medium-3 large-2 column text-center">
<div data-equalizer-watch>
<% if investment.image.present? %>
<%= image_tag investment.image_url(:thumb), alt: investment.image.title %>

View File

@@ -0,0 +1,46 @@
<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">
<span class="icon-search-plus"></span>
<span class="show-for-sr"><%= t("polls.show.zoom_plus") %></span>
</a>
<ul class="orbit-container">
<li>
<button class="orbit-previous">
<span class="show-for-sr"><%= t("shared.orbit.previous_slide") %></span>&#9664;&#xFE0E;
</button>
</li>
<li>
<button class="orbit-next">
<span class="show-for-sr"><%= t("shared.orbit.next_slide") %></span>&#9654;&#xFE0E;
</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>
</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>
</nav>
</div>

View File

@@ -1,5 +1,5 @@
<% poll_group.each do |poll| %>
<div class="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",
@@ -34,10 +34,14 @@
</div>
<% end %>
<div class="row" data-equalizer>
<div class="small-12 medium-3 column" data-equalizer-watch>
<!-- PENDING TO REPLACE THIS BLOCK WITH POLL MAIN IMAGE -->
<div style="background: #eee; width: 100%; height: 100%; display: block; margin: -12px;">&nbsp;</div>
<!-- /. PENDING TO REPLACE THIS BLOCK WITH POLL MAIN IMAGE -->
<div class="small-12 medium-3 column">
<div class="image-container" data-equalizer-watch>
<% if poll.image.present? %>
<%= image_tag poll.image_url(:large), alt: poll.image.title %>
<% else %>
<div class="no-image"></div>
<% end %>
</div>
</div>
<div class="small-12 medium-6 column" data-equalizer-watch>
<div class="dates"></div>
@@ -51,7 +55,7 @@
<%= poll_dates(poll) %>
<ul class="margin-top">
<% poll.questions.each do |question| %>
<li><%= link_to question.title, question_path(question) %></li>
<li><%= question.title %></li>
<% end %>
</ul>
<% end %>

View File

@@ -1,31 +0,0 @@
<% cache [locale_and_user_status, @current_order, commentable_cache_key(@commentable), @comment_tree.comments, @comment_tree.comment_authors, @commentable.comments_count, @comment_flags] do %>
<section class="row-full comments">
<div class="row">
<div id="comments" class="small-12 column">
<h2>
<%= t("shared.comments.title") %>
<span class="js-comments-count">(<%= @commentable.comments_count %>)</span>
</h2>
<%= render 'shared/wide_order_selector', i18n_namespace: "comments" %>
<% if user_signed_in? %>
<%= render 'comments/form', {commentable: @commentable, parent_id: nil, toggeable: false} %>
<% else %>
<br>
<div data-alert class="callout primary">
<%= t("shared.comments.login_to_comment",
signin: link_to(t("votes.signin"), new_user_session_path),
signup: link_to(t("votes.signup"), new_user_registration_path)).html_safe %>
</div>
<% end %>
<% @comment_tree.root_comments.each do |comment| %>
<%= render 'comments/comment', comment: comment %>
<% end %>
<%= paginate @comment_tree.root_comments %>
</div>
</div>
</section>
<% end %>

View File

@@ -1,22 +0,0 @@
<div class="row">
<div class="small-12 column">
<ul class="tabs" data-tabs id="questions-tabs">
<li class="tabs-title is-active">
<%= link_to "#tab-comments" do %>
<h3>
<%= t("proposals.show.comments_tab") %>
<span class="js-comments-count">(<%= @question.comments_count %>)</span>
</h3>
<% end %>
</li>
<li class="tabs-title">
<%= link_to "#tab-documents" do %>
<h3>
<%= t("documents.tab") %>
(<%= @question.documents.count %>)
</h3>
<% end %>
</li>
</ul>
</div>
</div>

View File

@@ -1,6 +1,6 @@
<div id="<%= dom_id(question) %>" class="poll-question">
<h3>
<%= link_to question.title, question_path(question) %>
<%= question.title %>
</h3>
<div id="<%= dom_id(question) %>_answers" class="padding">

View File

@@ -1,92 +0,0 @@
<% provide :title do %><%= @question.title %><% end %>
<div class="expanded no-margin-top dark-heading">
<div class="row">
<div class="small-12 medium-9 column padding">
<%= back_link_to %>
<h1><%= @question.title %></h1>
<% if @question.proposal.present? %>
<div class="margin-bottom">
<%= link_to t('poll_questions.show.original_proposal'), @question.proposal %>
</div>
<% end %>
<% if can? :answer, @question %>
<%= link_to t('poll_questions.show.answer_this_question'),
@question.poll,
class: 'large button' %>
<% else %>
<%= render 'polls/reasons_for_not_answering', poll: @question.poll %>
<% end %>
</div>
<div class="small-12 medium-3 column info">
<p>
<span class="title">
<strong><%= t('poll_questions.show.author') %></strong>
</span>
<br>
<% if @question.author_visible_name.present? %>
<%= @question.author_visible_name %>
<% else %>
<%= link_to @question.author.name, @question.author %>
<% end %>
</p>
<p>
<span class="title">
<strong><%= t('poll_questions.show.poll') %></strong>
</span>
<br>
<%= link_to @question.poll.name, @question.poll %>
</p>
<p>
<span class="title">
<strong><%= t('poll_questions.show.dates_title') %></strong>
</span>
<br>
<%= poll_dates(@question.poll) %>
</p>
</div>
</div>
</div>
<% if @question.video_url.present? %>
<div class="row margin-top poll-question-show">
<div class="small-12 medium-9 column">
<div class="video-link">
<p>
<span class="icon-video"></span>&nbsp;
<strong><%= t('proposals.show.title_video_url') %></strong>
</p>
<%= text_with_links @question.video_url %>
</div>
</div>
</div>
<% end %>
<div class="row margin-top">
<div class="small-12 medium-9 column">
<h3><%= t('poll_questions.show.more_info') %></h3>
<%= @question.description %>
</div>
</div>
<div class="tabs-content" data-tabs-content="questions-tabs" role="tablist">
<%= render "polls/questions/filter_subnav" %>
<div class="tabs-panel is-active" id="tab-comments">
<%= render "polls/questions/comments" %>
</div>
<div class="tabs-panel" id="tab-documents">
<%= render 'documents/documents',
documents: @question.documents,
max_documents_allowed: Poll::Question.max_documents_allowed %>
</div>
</div>

View File

@@ -1,36 +1,38 @@
<% provide :title do %><%= @poll.name %><% end %>
<div class="polls-show">
<div class="expanded no-margin-top dark-heading polls-show-header">
<div class="expanded no-margin-top polls-show-header">
<div class="row">
<div class="small-12 medium-9 column padding">
<%= back_link_to polls_path %>
<%= back_link_to polls_path, t("polls.show.back") %>
<h2><%= @poll.name %></h2>
<ul class="no-bullet margin-top tags">
<% @poll.geozones.each do |g| %>
<li class="inline-block"><span><%= g.name %></span></li>
<% end %>
</ul>
<%= render "callout" %>
</div>
<div class="small-12 medium-3 column">
<div class="info">
<p>
<span class="title">
<strong><%= t("polls.show.dates_title") %></strong>
</span>
<br>
<%= poll_dates(@poll) %>
</p>
</div>
<%= safe_html_with_links simple_format(@poll.summary) %>
<% if @poll.geozones.any? %>
<ul class="no-bullet margin-top tags">
<% @poll.geozones.each do |g| %>
<li class="inline-block"><span><%= g.name %></span></li>
<% end %>
</ul>
<% end %>
</div>
<aside class="small-12 medium-3 column margin-top">
<%= render partial: 'shared/social_share', locals: {
share_title: t("shared.share"),
title: @poll.name,
url: poll_url
} %>
</aside>
</div>
</div>
<div class="row margin-top">
<div class="row margin">
<div class="small-12 medium-9 column">
<%= render "callout" %>
<% if @poll.voted_in_booth?(current_user) %>
<div class="callout warning">
<%= t("polls.show.already_voted_in_booth") %>
@@ -41,13 +43,46 @@
<% end %>
<% end %>
</div>
</div>
<div class="expanded poll-more-info">
<div class="row margin">
<div class="small-12 medium-9 column">
<h3><%= t("polls.show.more_info_title") %></h3>
<%= safe_html_with_links simple_format(@poll.description) %>
</div>
<aside class="small-12 medium-3 column">
<div class="sidebar-divider"></div>
<h2><%= t("polls.show.documents") %></h2>
</aside>
</div>
</div>
<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">
<!-- REPLACE THIS WITH answer title -->
<h3>Answer 1</h3>
<!-- /. REPLACE THIS WITH answer title -->
<!-- If Answer have images render this:
Maybe something like <%# render "gallery", gallery: answer.gallery %> -->
<%= render "gallery" %>
<!-- If Answer have images render this -->
<!-- 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>
</div>
<!-- /. EACH ANSWER DO -->
<aside class="small-12 medium-3 column">
<%= render partial: 'shared/social_share', locals: {
share_title: t("proposals.show.share"),
title: @poll.name,
url: poll_url
} %>
</aside>
</div>
</div>

View File

@@ -1,11 +1,11 @@
<div id="<%= dom_id(proposal) %>"
class="proposal clear <%= ("successful" if proposal.total_votes > Proposal.votes_needed_for_success) %>"
data-type="proposal">
<div class="panel">
<div class="panel with-image">
<div class="icon-successful"></div>
<div class="row" data-equalizer>
<div class="small-12 medium-3 large-2 column">
<div class="small-12 medium-3 large-2 column text-center">
<div data-equalizer-watch>
<% if proposal.image.present? %>
<%= image_tag proposal.image_url(:thumb), alt: proposal.image.title %>

View File

@@ -154,6 +154,7 @@ ignore_unused:
- 'users.show.filters.*'
- 'polls.index.filters.*'
- 'polls.index.section_header.*'
- 'polls.index.orders.*'
- 'debates.index.select_order'
- 'debates.index.orders.*'
- 'debates.index.section_header.*'

View File

@@ -593,7 +593,6 @@ en:
author: Author
title: Title
valid_answers: Valid answers
description: Description
video_url: External video
documents: Documents (1)
recounts:
@@ -607,7 +606,7 @@ en:
index:
title: "Results"
no_results: "There are no results"
table_whites: "Blank ballots"
table_whites: "Totally blank ballots"
table_nulls: "Invalid ballots"
table_total: "Total ballots"
table_answer: Answer

View File

@@ -482,7 +482,7 @@ en:
help_text_2: "To participate in the next vote you have to sign up on %{org} and verify your account. All registered voters in the city over 16 years old can vote. The results of all votes are binding on the government."
show:
already_voted_in_booth: "You have already participated in a booth for this poll."
dates_title: "Participation dates"
back: Back to voting
cant_answer_not_logged_in: "You must %{signin} or %{signup} to participate."
signin: Sign in
signup: Sign up
@@ -490,15 +490,13 @@ en:
verify_link: "verify your account"
cant_answer_incoming: "This poll has not yet started."
cant_answer_expired: "This poll has finished."
more_info_title: "More information"
documents: Documents
zoom_plus: Expand image
poll_questions:
create_question: "Create question"
default_valid_answers: "Yes, No"
show:
answer_this_question: "Go to voting page"
original_proposal: "Original proposal"
author: "Created by"
dates_title: "Participation dates"
more_info: "More information"
not_logged_in: "You must %{signin} or %{signup} to participate."
signin: Sign in
signup: Sign up
@@ -509,7 +507,6 @@ en:
cant_answer_wrong_geozone: "This question is not available on your geozone."
vote_answer: "Vote %{answer}"
voted: "You have voted %{answer}"
poll: "Poll"
proposal_notifications:
new:
title: "Send message"
@@ -524,9 +521,6 @@ en:
edit: 'Edit'
save: 'Save'
delete: 'Delete'
comments:
title: 'Comments'
login_to_comment: 'You must %{signin} or %{signup} to leave a comment.'
"yes": "Yes"
"no": "No"
search_results: "Search results"
@@ -607,6 +601,10 @@ en:
budget: Participatory budget
searcher: Searcher
go_to_page: "Go to page of "
share: Share
orbit:
previous_slide: Previous Slide
next_slide: Next Slide
social:
blog: "%{org} Blog"
facebook: "%{org} Facebook"

View File

@@ -29,7 +29,7 @@ en:
date: "Date"
select_booth: "Select booth"
select_date: "Select date"
ballots_white: "Blank ballots"
ballots_white: "Totally blank ballots"
ballots_null: "Invalid ballots"
ballots_total: "Total ballots"
submit: "Save"
@@ -40,7 +40,7 @@ en:
results: Results
table_answer: Answer
table_votes: Votes
table_whites: "Blank ballots"
table_whites: "Totally blank ballots"
table_nulls: "Invalid ballots"
table_total: "Total ballots"
residence:

View File

@@ -593,7 +593,6 @@ es:
author: Autor
title: Título
valid_answers: Respuestas válidas
description: Descripción
video_url: Video externo
documents: Documentos (1)
recounts:
@@ -607,7 +606,7 @@ es:
index:
title: "Resultados"
no_results: "No hay resultados"
table_whites: Papeletas en blanco
table_whites: Papeletas totalmente en blanco
table_nulls: Papeletas nulas
table_total: Papeletas totales
table_answer: Respuesta

View File

@@ -482,7 +482,7 @@ es:
help_text_2: "Para participar en la próxima votación tienes que registrarte en %{org} y verificar tu cuenta. Pueden votar todas las personas empadronadas en la ciudad mayores de 16 años. Los resultados de todas las votaciones serán vinculantes para el gobierno."
show:
already_voted_in_booth: "Ya has participado en esta votación en una urna."
dates_title: "Fechas de participación"
back: Volver a votaciones
cant_answer_not_logged_in: "Necesitas %{signin} o %{signup} para participar."
signin: iniciar sesión
signup: registrarte
@@ -490,15 +490,13 @@ es:
verify_link: "verifica tu cuenta"
cant_answer_incoming: "Esta votación todavía no ha comenzado."
cant_answer_expired: "Esta votación ha terminado."
more_info_title: "Más información"
documents: Documentación
zoom_plus: Ampliar imagen
poll_questions:
create_question: "Crear pregunta para votación"
default_valid_answers: "Sí, No"
show:
answer_this_question: "Responder a esta pregunta"
original_proposal: "Propuesta original"
author: "Creado por"
dates_title: "Fechas de participación"
more_info: "Más información"
not_logged_in: "Necesitas %{signin} o %{signup} para participar."
signin: iniciar sesión
signup: registrarte
@@ -509,7 +507,6 @@ es:
cant_answer_wrong_geozone: "Esta votación no está disponible en tu zona."
vote_answer: "Votar %{answer}"
voted: "Has votado %{answer}"
poll: "Votación"
proposal_notifications:
new:
title: "Enviar mensaje"
@@ -524,9 +521,6 @@ es:
edit: 'Editar'
save: 'Guardar'
delete: 'Borrar'
comments:
title: 'Comentarios'
login_to_comment: 'Necesitas %{signin} o %{signup} para comentar.'
"yes": "Sí"
"no": "No"
search_results: "Resultados de búsqueda"
@@ -607,6 +601,10 @@ es:
budget: Presupuestos participativos
searcher: Buscador
go_to_page: "Ir a la página de "
share: Compartir
orbit:
previous_slide: Imagen anterior
next_slide: Siguiente imagen
social:
blog: "Blog de %{org}"
facebook: "Facebook de %{org}"

View File

@@ -29,7 +29,7 @@ es:
date: "Día"
select_booth: "Elige urna"
select_date: "Elige día"
ballots_white: "Papeletas en blanco"
ballots_white: "Papeletas totalmente en blanco"
ballots_null: "Papeletas nulas"
ballots_total: "Papeletas totales"
submit: "Guardar"
@@ -40,7 +40,7 @@ es:
results: "Resultados"
table_answer: Respuesta
table_votes: Votos
table_whites: Papeletas en blanco
table_whites: Papeletas totalmente en blanco
table_nulls: Papeletas nulas
table_total: Papeletas totales
residence:

View File

@@ -113,7 +113,7 @@ Rails.application.routes.draw do
end
resources :polls, only: [:show, :index] do
resources :questions, only: [:show], controller: 'polls/questions', shallow: true do
resources :questions, controller: 'polls/questions', shallow: true do
post :answer, on: :member
end
end

View File

@@ -0,0 +1,5 @@
class RemoveDescriptionFromPollQuestions < ActiveRecord::Migration
def change
remove_column :poll_questions, :description
end
end

View File

@@ -675,7 +675,6 @@ ActiveRecord::Schema.define(version: 20171003223152) do
t.string "author_visible_name"
t.string "title"
t.string "valid_answers"
t.text "description"
t.integer "comments_count"
t.datetime "hidden_at"
t.datetime "created_at"

View File

@@ -498,7 +498,6 @@ FactoryGirl.define do
poll
association :author, factory: :user
sequence(:title) { |n| "Question title #{n}" }
sequence(:description) { |n| "Question description #{n}" }
valid_answers { Faker::Lorem.words(3).join(', ') }
end

View File

@@ -24,7 +24,6 @@ feature 'Admin poll questions' do
visit admin_question_path(question)
expect(page).to have_content(question.title)
expect(page).to have_content(question.description)
expect(page).to have_content(question.author.name)
expect(page).to have_content(question.valid_answers.join(" "))
end
@@ -45,13 +44,11 @@ feature 'Admin poll questions' do
select 'Movies', from: 'poll_question_poll_id'
fill_in 'poll_question_title', with: title
fill_in 'poll_question_description', with: description
fill_in 'poll_question_video_url', with: video_url
click_button 'Save'
expect(page).to have_content(title)
expect(page).to have_content(description)
expect(page).to have_content(video_url)
end
@@ -64,7 +61,6 @@ feature 'Admin poll questions' do
expect(current_path).to eq(new_admin_question_path)
expect(page).to have_field('poll_question_title', with: proposal.title)
expect(page).to have_field('poll_question_description', with: proposal.description)
expect(page).to have_field('poll_question_valid_answers', with: "Yes, No")
select 'Proposals', from: 'poll_question_poll_id'
@@ -72,7 +68,6 @@ feature 'Admin poll questions' do
click_button 'Save'
expect(page).to have_content(proposal.title)
expect(page).to have_content(proposal.description)
expect(page).to have_link(proposal.title, href: proposal_path(proposal))
expect(page).to have_link(proposal.author.name, href: user_path(proposal.author))
end

View File

@@ -11,121 +11,4 @@ feature 'Poll Questions' do
expect(proposal_question.title).to appear_before(normal_question.title)
end
scenario 'shows the author visible name instead of a link to the author' do
poll = create(:poll)
question_with_author = create(:poll_question, poll: poll)
question_with_author_visible_name = create(:poll_question, poll: poll, author_visible_name: 'potato')
visit question_path(question_with_author)
expect(page).to have_link(question_with_author.author.name)
visit question_path(question_with_author_visible_name)
expect(page).to_not have_link(question_with_author_visible_name.author.name)
expect(page).to have_content(question_with_author_visible_name.author_visible_name)
end
scenario '#show view has video_url present' do
poll = create(:poll)
normal_question = create(:poll_question, poll: poll, video_url: "https://puppyvideos.com")
visit question_path(normal_question)
expect(page).to have_link(normal_question.video_url)
end
scenario '#show view has document present' do
poll = create(:poll)
normal_question = create(:poll_question, poll: poll)
document = create(:document, documentable: normal_question)
visit question_path(normal_question)
expect(page).to have_content(document.title)
end
context 'Answering' do
let(:geozone) { create(:geozone) }
let(:poll) { create(:poll, geozone_restricted: true, geozone_ids: [geozone.id]) }
scenario 'Non-logged in users' do
question = create(:poll_question, valid_answers: 'Han Solo, Chewbacca')
visit question_path(question)
expect(page).to have_content('You must Sign in or Sign up to participate')
end
scenario 'Level 1 users' do
question = create(:poll_question, poll: poll, valid_answers: 'Han Solo, Chewbacca')
login_as(create(:user, geozone: geozone))
visit question_path(question)
expect(page).to have_content('You must verify your account in order to answer')
end
scenario 'Level 2 users in an poll question for a geozone which is not theirs' do
other_poll = create(:poll, geozone_restricted: true, geozone_ids: [create(:geozone).id])
question = create(:poll_question, poll: other_poll, valid_answers: 'Vader, Palpatine')
login_as(create(:user, :level_two, geozone: geozone))
visit question_path(question)
expect(page).to have_content('This question is not available on your geozone')
end
scenario 'Level 2 users who can answer' do
question = create(:poll_question, poll: poll, valid_answers: 'Han Solo, Chewbacca')
login_as(create(:user, :level_two, geozone: geozone))
visit question_path(question)
expect(page).to have_link('Go to voting page')
end
scenario 'Level 2 users who have already answered' do
question = create(:poll_question, poll: poll, valid_answers: 'Han Solo, Chewbacca')
user = create(:user, :level_two, geozone: geozone)
create(:poll_answer, question: question, author: user, answer: 'Chewbacca')
login_as user
visit question_path(question)
expect(page).to have_link('Go to voting page')
end
scenario 'Level 2 users answering', :js do
question = create(:poll_question, poll: poll, valid_answers: 'Han Solo, Chewbacca')
user = create(:user, :level_two, geozone: geozone)
login_as user
visit question_path(question)
expect(page).to have_link('Go to voting page')
end
scenario 'Records participation', :js do
question = create(:poll_question, poll: poll, valid_answers: 'Han Solo, Chewbacca')
user = create(:user, :level_two, geozone: geozone, gender: 'female', date_of_birth: 33.years.ago)
login_as user
visit question_path(question)
click_link 'Go to voting page'
click_link 'Han Solo'
expect(page).to_not have_link('Han Solo')
voter = poll.voters.first
expect(voter.document_number).to eq(user.document_number)
expect(voter.geozone_id).to eq(user.geozone_id)
expect(voter.gender).to eq(user.gender)
expect(voter.age).to eq(33)
expect(voter.poll_id).to eq(poll.id)
end
end
end

View File

@@ -10,12 +10,13 @@ feature "Voter" do
user = create(:user, :level_two)
login_as user
visit question_path(question)
visit poll_path(poll)
click_link 'Go to voting page'
click_link 'Yes'
within("#poll_question_#{question.id}_answers") do
click_link 'Yes'
expect(page).to_not have_link('Yes')
end
expect(page).to_not have_link('Yes')
expect(Poll::Voter.count).to eq(1)
expect(Poll::Voter.first.origin).to eq("web")
end
@@ -56,7 +57,7 @@ feature "Voter" do
scenario "Trying to vote in web and then in booth", :js do
login_as user
vote_for_poll_via_web
vote_for_poll_via_web(poll, question)
click_link "Sign out"
@@ -79,9 +80,7 @@ feature "Voter" do
click_link "Sign out"
login_as user
visit question_path(question)
click_link 'Go to voting page'
visit poll_path(poll)
expect(page).to_not have_link('Yes')
expect(page).to have_content "You have already participated in a booth for this poll."

View File

@@ -322,5 +322,4 @@ end
def documentable_fill_new_valid_poll_question
page.select documentable.poll.name, from: 'poll_question_poll_id'
fill_in 'poll_question_title', with: "Star Wars: Episode IV - A New Hope"
fill_in_ckeditor "poll_question_description", with: "Description"
end

View File

@@ -298,13 +298,14 @@ module CommonActions
end
end
def vote_for_poll_via_web
visit question_path(question)
def vote_for_poll_via_web(poll, question)
visit poll_path(poll)
click_link 'Go to voting page'
click_link 'Yes'
within("#poll_question_#{question.id}_answers") do
click_link 'Yes'
expect(page).to_not have_link('Yes')
end
expect(page).to_not have_link('Yes')
expect(Poll::Voter.count).to eq(1)
end