diff --git a/app/assets/fonts/icons.eot b/app/assets/fonts/icons.eot index 5f29191f7..5564a5c62 100644 Binary files a/app/assets/fonts/icons.eot and b/app/assets/fonts/icons.eot differ diff --git a/app/assets/fonts/icons.svg b/app/assets/fonts/icons.svg index 2b884a912..0d94e5751 100644 --- a/app/assets/fonts/icons.svg +++ b/app/assets/fonts/icons.svg @@ -63,4 +63,6 @@ + + diff --git a/app/assets/fonts/icons.ttf b/app/assets/fonts/icons.ttf index 252457611..6af0797fb 100644 Binary files a/app/assets/fonts/icons.ttf and b/app/assets/fonts/icons.ttf differ diff --git a/app/assets/fonts/icons.woff b/app/assets/fonts/icons.woff index 2cf6dc4b7..7f8f3c95e 100644 Binary files a/app/assets/fonts/icons.woff and b/app/assets/fonts/icons.woff differ diff --git a/app/assets/images/custom/example_horizontal.jpg b/app/assets/images/custom/example_horizontal.jpg new file mode 100644 index 000000000..634e432ac Binary files /dev/null and b/app/assets/images/custom/example_horizontal.jpg differ diff --git a/app/assets/images/custom/example_vertical.jpg b/app/assets/images/custom/example_vertical.jpg new file mode 100644 index 000000000..11743cc18 Binary files /dev/null and b/app/assets/images/custom/example_vertical.jpg differ diff --git a/app/assets/stylesheets/_consul_settings.scss b/app/assets/stylesheets/_consul_settings.scss index 0844f861f..1f03c9be7 100644 --- a/app/assets/stylesheets/_consul_settings.scss +++ b/app/assets/stylesheets/_consul_settings.scss @@ -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; diff --git a/app/assets/stylesheets/_settings.scss b/app/assets/stylesheets/_settings.scss index a38071a05..33800fed5 100644 --- a/app/assets/stylesheets/_settings.scss +++ b/app/assets/stylesheets/_settings.scss @@ -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; diff --git a/app/assets/stylesheets/foundation_and_overrides.scss b/app/assets/stylesheets/foundation_and_overrides.scss index 0bead10ae..66640f3f2 100644 --- a/app/assets/stylesheets/foundation_and_overrides.scss +++ b/app/assets/stylesheets/foundation_and_overrides.scss @@ -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; diff --git a/app/assets/stylesheets/icons.scss b/app/assets/stylesheets/icons.scss index 135b9fe12..96eb10a0d 100644 --- a/app/assets/stylesheets/icons.scss +++ b/app/assets/stylesheets/icons.scss @@ -260,3 +260,11 @@ .icon-image::before { content: '\33'; } + +.icon-search-plus::before { + content: '\34'; +} + +.icon-search-minus::before { + content: '\35'; +} diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index 44b450779..efa0454db 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -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 { diff --git a/app/assets/stylesheets/mixins.scss b/app/assets/stylesheets/mixins.scss index 1aa51d1a6..ac3c0a923 100644 --- a/app/assets/stylesheets/mixins.scss +++ b/app/assets/stylesheets/mixins.scss @@ -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; } - } diff --git a/app/assets/stylesheets/participation.scss b/app/assets/stylesheets/participation.scss index 8b7390191..15b984f17 100644 --- a/app/assets/stylesheets/participation.scss +++ b/app/assets/stylesheets/participation.scss @@ -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, diff --git a/app/controllers/admin/poll/questions_controller.rb b/app/controllers/admin/poll/questions_controller.rb index 97b301d43..107c06740 100644 --- a/app/controllers/admin/poll/questions_controller.rb +++ b/app/controllers/admin/poll/questions_controller.rb @@ -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 diff --git a/app/controllers/admin/poll/shifts_controller.rb b/app/controllers/admin/poll/shifts_controller.rb index 1a5d23f04..1f60b2b4e 100644 --- a/app/controllers/admin/poll/shifts_controller.rb +++ b/app/controllers/admin/poll/shifts_controller.rb @@ -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 diff --git a/app/controllers/polls/questions_controller.rb b/app/controllers/polls/questions_controller.rb index 1849dff97..74266a6fc 100644 --- a/app/controllers/polls/questions_controller.rb +++ b/app/controllers/polls/questions_controller.rb @@ -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) diff --git a/app/models/poll/question.rb b/app/models/poll/question.rb index a46f28a8c..55396fd3b 100644 --- a/app/models/poll/question.rb +++ b/app/models/poll/question.rb @@ -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 diff --git a/app/views/admin/poll/polls/edit.html.erb b/app/views/admin/poll/polls/edit.html.erb index 1ba88359e..f7bd93212 100644 --- a/app/views/admin/poll/polls/edit.html.erb +++ b/app/views/admin/poll/polls/edit.html.erb @@ -2,4 +2,6 @@

<%= t("admin.polls.edit.title") %>

-<%= render "form" %> \ No newline at end of file +
+ <%= render "form" %> +
diff --git a/app/views/admin/poll/polls/new.html.erb b/app/views/admin/poll/polls/new.html.erb index 1203688d5..ac3ba5a4d 100644 --- a/app/views/admin/poll/polls/new.html.erb +++ b/app/views/admin/poll/polls/new.html.erb @@ -2,4 +2,6 @@

<%= t("admin.polls.new.title") %>

-<%= render "form" %> \ No newline at end of file +
+ <%= render "form" %> +
diff --git a/app/views/admin/poll/questions/_form.html.erb b/app/views/admin/poll/questions/_form.html.erb index 7881936e4..6091c024f 100644 --- a/app/views/admin/poll/questions/_form.html.erb +++ b/app/views/admin/poll/questions/_form.html.erb @@ -20,12 +20,6 @@

<%= t("admin.questions.new.valid_answers_note") %>

<%= f.text_field :valid_answers, label: false, aria: {describedby: "valid-answers-help-text"} %> -
- <%= f.cktext_area :description, - maxlength: Poll::Question.description_max_length, - ckeditor: { language: I18n.locale } %> -
-
<%= render 'documents/nested_documents', documentable: @question, f: f %>
diff --git a/app/views/admin/poll/questions/show.html.erb b/app/views/admin/poll/questions/show.html.erb index 360886b89..438ee3a40 100644 --- a/app/views/admin/poll/questions/show.html.erb +++ b/app/views/admin/poll/questions/show.html.erb @@ -34,12 +34,6 @@ <% end %> -

- <%= t("admin.questions.show.description") %> -
- <%= @question.description %> -

- <% if @question.video_url.present? %>

<%= t("admin.questions.show.video_url") %> diff --git a/app/views/budgets/investments/_form.html.erb b/app/views/budgets/investments/_form.html.erb index 8a19c188a..b3bbf4e14 100644 --- a/app/views/budgets/investments/_form.html.erb +++ b/app/views/budgets/investments/_form.html.erb @@ -41,7 +41,7 @@ parent_class: "budget_investment" %> - <% end %> + <% end %>

<%= f.text_field :location %> diff --git a/app/views/budgets/investments/_investment.html.erb b/app/views/budgets/investments/_investment.html.erb index 2c6269a3f..ecfdcb3c7 100644 --- a/app/views/budgets/investments/_investment.html.erb +++ b/app/views/budgets/investments/_investment.html.erb @@ -1,8 +1,8 @@
-
+
-
+
<% if investment.image.present? %> <%= image_tag investment.image_url(:thumb), alt: investment.image.title %> diff --git a/app/views/polls/_gallery.html.erb b/app/views/polls/_gallery.html.erb new file mode 100644 index 000000000..3354c4de7 --- /dev/null +++ b/app/views/polls/_gallery.html.erb @@ -0,0 +1,46 @@ +
+ + + <%= t("polls.show.zoom_plus") %> + + +
    +
  • + +
  • +
  • + +
  • + +
  • + <%= link_to "/assets/example_vertical.jpg", target: "_blank" do %> + <%= image_tag "example_horizontal.jpg", class: "orbit-image" %> + <% end %> + + Image title 1 + +
  • + +
  • + <%= link_to "/assets/example_vertical.jpg", target: "_blank" do %> + <%= image_tag "example_vertical.jpg", class: "orbit-image" %> + <% end %> + Image title 2 +
  • +
+ + +
diff --git a/app/views/polls/_poll_group.html.erb b/app/views/polls/_poll_group.html.erb index 9372aee17..f8c105d90 100644 --- a/app/views/polls/_poll_group.html.erb +++ b/app/views/polls/_poll_group.html.erb @@ -1,5 +1,5 @@ <% poll_group.each do |poll| %> -
+
<% if poll.answerable_by?(current_user) && poll.votable_by?(current_user) %> <%= link_to poll, class: "icon-poll-answer can-answer", @@ -34,10 +34,14 @@
<% end %>
-
- -
 
- +
+
+ <% if poll.image.present? %> + <%= image_tag poll.image_url(:large), alt: poll.image.title %> + <% else %> +
+ <% end %> +
@@ -51,7 +55,7 @@ <%= poll_dates(poll) %>
    <% poll.questions.each do |question| %> -
  • <%= link_to question.title, question_path(question) %>
  • +
  • <%= question.title %>
  • <% end %>
<% end %> diff --git a/app/views/polls/questions/_comments.html.erb b/app/views/polls/questions/_comments.html.erb deleted file mode 100644 index a967406aa..000000000 --- a/app/views/polls/questions/_comments.html.erb +++ /dev/null @@ -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 %> -
-
-
-

- <%= t("shared.comments.title") %> - (<%= @commentable.comments_count %>) -

- - <%= render 'shared/wide_order_selector', i18n_namespace: "comments" %> - - <% if user_signed_in? %> - <%= render 'comments/form', {commentable: @commentable, parent_id: nil, toggeable: false} %> - <% else %> -
- -
- <%= 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 %> -
- <% end %> - - <% @comment_tree.root_comments.each do |comment| %> - <%= render 'comments/comment', comment: comment %> - <% end %> - <%= paginate @comment_tree.root_comments %> -
-
-
-<% end %> \ No newline at end of file diff --git a/app/views/polls/questions/_filter_subnav.html.erb b/app/views/polls/questions/_filter_subnav.html.erb deleted file mode 100644 index 738fc3700..000000000 --- a/app/views/polls/questions/_filter_subnav.html.erb +++ /dev/null @@ -1,22 +0,0 @@ -
-
-
    -
  • - <%= link_to "#tab-comments" do %> -

    - <%= t("proposals.show.comments_tab") %> - (<%= @question.comments_count %>) -

    - <% end %> -
  • -
  • - <%= link_to "#tab-documents" do %> -

    - <%= t("documents.tab") %> - (<%= @question.documents.count %>) -

    - <% end %> -
  • -
-
-
diff --git a/app/views/polls/questions/_question.html.erb b/app/views/polls/questions/_question.html.erb index f0958b6e4..982d0a070 100644 --- a/app/views/polls/questions/_question.html.erb +++ b/app/views/polls/questions/_question.html.erb @@ -1,6 +1,6 @@

- <%= link_to question.title, question_path(question) %> + <%= question.title %>

diff --git a/app/views/polls/questions/show.html.erb b/app/views/polls/questions/show.html.erb deleted file mode 100644 index f67633129..000000000 --- a/app/views/polls/questions/show.html.erb +++ /dev/null @@ -1,92 +0,0 @@ -<% provide :title do %><%= @question.title %><% end %> - -
-
-
- <%= back_link_to %> - -

<%= @question.title %>

- - <% if @question.proposal.present? %> -
- <%= link_to t('poll_questions.show.original_proposal'), @question.proposal %> -
- <% 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 %> -
- -
-

- - <%= t('poll_questions.show.author') %> - -
- <% if @question.author_visible_name.present? %> - <%= @question.author_visible_name %> - <% else %> - <%= link_to @question.author.name, @question.author %> - <% end %> - -

- -

- - <%= t('poll_questions.show.poll') %> - -
- <%= link_to @question.poll.name, @question.poll %> -

- -

- - <%= t('poll_questions.show.dates_title') %> - -
- <%= poll_dates(@question.poll) %> -

-
-
-
- -<% if @question.video_url.present? %> -
-
- -
-
- -<% end %> - -
-
-

<%= t('poll_questions.show.more_info') %>

- <%= @question.description %> -
-
- -
- <%= render "polls/questions/filter_subnav" %> - -
- <%= render "polls/questions/comments" %> -
- -
- <%= render 'documents/documents', - documents: @question.documents, - max_documents_allowed: Poll::Question.max_documents_allowed %> -
-
diff --git a/app/views/polls/show.html.erb b/app/views/polls/show.html.erb index 6895397de..b3a78e402 100644 --- a/app/views/polls/show.html.erb +++ b/app/views/polls/show.html.erb @@ -1,36 +1,38 @@ <% provide :title do %><%= @poll.name %><% end %>
-
+
- <%= back_link_to polls_path %> + <%= back_link_to polls_path, t("polls.show.back") %>

<%= @poll.name %>

-
    - <% @poll.geozones.each do |g| %> -
  • <%= g.name %>
  • - <% end %> -
- <%= render "callout" %> -
-
-
-

- - <%= t("polls.show.dates_title") %> - -
- <%= poll_dates(@poll) %> -

-
+ <%= safe_html_with_links simple_format(@poll.summary) %> + + <% if @poll.geozones.any? %> +
    + <% @poll.geozones.each do |g| %> +
  • <%= g.name %>
  • + <% end %> +
+ <% end %>
+ +
-
+
+ <%= render "callout" %> + <% if @poll.voted_in_booth?(current_user) %>
<%= t("polls.show.already_voted_in_booth") %> @@ -41,13 +43,46 @@ <% end %> <% end %>
+
+ +
+
+
+

<%= t("polls.show.more_info_title") %>

+ <%= safe_html_with_links simple_format(@poll.description) %> +
+ + +
+
+ +
+
+ + +
+ + +

Answer 1

+ + + + <%= render "gallery" %> + + + +
+

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.

+
+ + +
+
+ -
diff --git a/app/views/proposals/_proposal.html.erb b/app/views/proposals/_proposal.html.erb index be5ac8e17..2f5c22c3c 100644 --- a/app/views/proposals/_proposal.html.erb +++ b/app/views/proposals/_proposal.html.erb @@ -1,11 +1,11 @@
Proposal.votes_needed_for_success) %>" data-type="proposal"> -
+
-
+
<% if proposal.image.present? %> <%= image_tag proposal.image_url(:thumb), alt: proposal.image.title %> diff --git a/config/i18n-tasks.yml b/config/i18n-tasks.yml index 156a38eff..427fec5ad 100644 --- a/config/i18n-tasks.yml +++ b/config/i18n-tasks.yml @@ -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.*' diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index a3751615a..eadcae62d 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -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 diff --git a/config/locales/en/general.yml b/config/locales/en/general.yml index ff8a77014..c06fe78aa 100644 --- a/config/locales/en/general.yml +++ b/config/locales/en/general.yml @@ -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" diff --git a/config/locales/en/officing.yml b/config/locales/en/officing.yml index 2dfc29ac3..378b87b15 100644 --- a/config/locales/en/officing.yml +++ b/config/locales/en/officing.yml @@ -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: diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index f95c2d39f..fc3945ddf 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -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 diff --git a/config/locales/es/general.yml b/config/locales/es/general.yml index aaa59a900..77dcdc3f7 100644 --- a/config/locales/es/general.yml +++ b/config/locales/es/general.yml @@ -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}" diff --git a/config/locales/es/officing.yml b/config/locales/es/officing.yml index 74358ab56..354b59710 100644 --- a/config/locales/es/officing.yml +++ b/config/locales/es/officing.yml @@ -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: diff --git a/config/routes.rb b/config/routes.rb index 51e1f351d..2b9c4250c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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 diff --git a/db/migrate/20171003170029_remove_description_from_poll_questions.rb b/db/migrate/20171003170029_remove_description_from_poll_questions.rb new file mode 100644 index 000000000..31e1b9578 --- /dev/null +++ b/db/migrate/20171003170029_remove_description_from_poll_questions.rb @@ -0,0 +1,5 @@ +class RemoveDescriptionFromPollQuestions < ActiveRecord::Migration + def change + remove_column :poll_questions, :description + end +end diff --git a/db/schema.rb b/db/schema.rb index a53b0c490..c0fccda89 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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" diff --git a/spec/factories.rb b/spec/factories.rb index a127d1bc9..9f1fca8ed 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -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 diff --git a/spec/features/admin/poll/questions_spec.rb b/spec/features/admin/poll/questions_spec.rb index ca3706a24..52e3783f0 100644 --- a/spec/features/admin/poll/questions_spec.rb +++ b/spec/features/admin/poll/questions_spec.rb @@ -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 diff --git a/spec/features/polls/questions_spec.rb b/spec/features/polls/questions_spec.rb index 06dd9df08..9e7efeedc 100644 --- a/spec/features/polls/questions_spec.rb +++ b/spec/features/polls/questions_spec.rb @@ -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 diff --git a/spec/features/polls/voter_spec.rb b/spec/features/polls/voter_spec.rb index c12a9f0e4..d925d3394 100644 --- a/spec/features/polls/voter_spec.rb +++ b/spec/features/polls/voter_spec.rb @@ -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." diff --git a/spec/shared/features/nested_documentable.rb b/spec/shared/features/nested_documentable.rb index 10a2c9fbf..8780936a7 100644 --- a/spec/shared/features/nested_documentable.rb +++ b/spec/shared/features/nested_documentable.rb @@ -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 diff --git a/spec/support/common_actions.rb b/spec/support/common_actions.rb index eda55986f..256b070e4 100644 --- a/spec/support/common_actions.rb +++ b/spec/support/common_actions.rb @@ -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