updates specs for admin poll questions
This commit is contained in:
@@ -14,13 +14,11 @@ class Poll::Question < ActiveRecord::Base
|
||||
belongs_to :proposal
|
||||
|
||||
validates :title, presence: true
|
||||
validates :question, presence: true
|
||||
validates :summary, presence: true
|
||||
validates :author, presence: true
|
||||
|
||||
validates :title, length: { in: 4..Poll::Question.title_max_length }
|
||||
validates :description, length: { maximum: Poll::Question.description_max_length }
|
||||
validates :question, length: { in: 10..Poll::Question.question_max_length }
|
||||
|
||||
scope :sort_for_list, -> { order('poll_questions.proposal_id IS NULL', :created_at)}
|
||||
scope :for_render, -> { includes(:author, :proposal) }
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
<% if @question.proposal.present? %>
|
||||
<div>
|
||||
<%= I18n.t("admin.questions.show.proposal") %>:
|
||||
<%= @question.proposal.title %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="small-12 column">
|
||||
<% if @question.proposal.present? %>
|
||||
<div>
|
||||
<%= I18n.t("admin.questions.show.proposal") %>:
|
||||
<%= link_to @question.proposal.title, proposal_path(@question.proposal) %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div>
|
||||
<%= I18n.t("admin.questions.show.title") %>:
|
||||
<%= @question.title %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= I18n.t("admin.questions.show.author") %>:
|
||||
<%= link_to @question.author.name, user_path(@question.author) %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= I18n.t("admin.questions.show.valid_answers") %>:
|
||||
<%= @question.valid_answers.join(", ") %>
|
||||
@@ -30,7 +35,7 @@
|
||||
<%= I18n.t("admin.questions.show.geozones") %>:
|
||||
<% @question.geozones.each do |geozone| %>
|
||||
<div>
|
||||
<% geozone.name %>
|
||||
<%= geozone.name %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -57,9 +57,16 @@
|
||||
<div class="message">
|
||||
<p>
|
||||
<%= t("proposal_ballots.successfull",
|
||||
voting: link_to(t("proposal_ballots.voting"), proposal_ballots_path)).html_safe %>
|
||||
voting: link_to(t("proposal_ballots.voting"), polls_path)).html_safe %>
|
||||
</p>
|
||||
</div>
|
||||
<% if can? :create, Poll::Question %>
|
||||
<p class="text-center">
|
||||
<%= link_to t('poll_questions.create_question'),
|
||||
new_admin_question_path(proposal_id: proposal.id),
|
||||
class: "button hollow" %>
|
||||
</p>
|
||||
<% end %>
|
||||
<% elsif proposal.archived? %>
|
||||
<div class="message">
|
||||
<strong><%= t("proposals.proposal.supports", count: proposal.total_votes) %></strong>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div id="next-voting" class="row featured-proposals-ballot-banner">
|
||||
<%= link_to proposal_ballots_path do %>
|
||||
<%= link_to polls_path do %>
|
||||
<div class="small-12 column padding">
|
||||
<div class="icon-successfull"></div>
|
||||
<h2><%= t("proposal_ballots.featured_title") %></h2>
|
||||
|
||||
Reference in New Issue
Block a user