Remove collaborative legislation summary
This feature wasn't properly tested nor reviewed, and after reviewing
several pull requests with a similar status and considering this pull
request is related to the public area of the web, we've decided to
remove it before releasing version 1.1.
This commit reverts commit 4f50e67a.
This commit is contained in:
2
Gemfile
2
Gemfile
@@ -8,8 +8,6 @@ gem "ahoy_matey", "~> 1.6.0"
|
|||||||
gem "ancestry", "~> 3.0.7"
|
gem "ancestry", "~> 3.0.7"
|
||||||
gem "audited", "~> 4.9.0"
|
gem "audited", "~> 4.9.0"
|
||||||
gem "autoprefixer-rails", "~> 8.2.0"
|
gem "autoprefixer-rails", "~> 8.2.0"
|
||||||
gem "axlsx", "~> 3.0.0.pre"
|
|
||||||
gem "axlsx_rails", "~> 0.5.2"
|
|
||||||
gem "browser", "~> 2.5.3"
|
gem "browser", "~> 2.5.3"
|
||||||
gem "cancancan", "~> 2.3.0"
|
gem "cancancan", "~> 2.3.0"
|
||||||
gem "ckeditor", "~> 4.2.3"
|
gem "ckeditor", "~> 4.2.3"
|
||||||
|
|||||||
10
Gemfile.lock
10
Gemfile.lock
@@ -76,14 +76,6 @@ GEM
|
|||||||
activerecord (>= 4.2, < 6.1)
|
activerecord (>= 4.2, < 6.1)
|
||||||
autoprefixer-rails (8.2.0)
|
autoprefixer-rails (8.2.0)
|
||||||
execjs
|
execjs
|
||||||
axlsx (3.0.0.pre)
|
|
||||||
htmlentities (~> 4.3, >= 4.3.4)
|
|
||||||
mimemagic (~> 0.3)
|
|
||||||
nokogiri (~> 1.8, >= 1.8.2)
|
|
||||||
rubyzip (~> 1.2, >= 1.2.1)
|
|
||||||
axlsx_rails (0.5.2)
|
|
||||||
actionpack (>= 3.1)
|
|
||||||
axlsx (>= 2.0.1)
|
|
||||||
babel-source (5.8.35)
|
babel-source (5.8.35)
|
||||||
babel-transpiler (0.7.0)
|
babel-transpiler (0.7.0)
|
||||||
babel-source (>= 4.0, < 6)
|
babel-source (>= 4.0, < 6)
|
||||||
@@ -592,8 +584,6 @@ DEPENDENCIES
|
|||||||
ancestry (~> 3.0.7)
|
ancestry (~> 3.0.7)
|
||||||
audited (~> 4.9.0)
|
audited (~> 4.9.0)
|
||||||
autoprefixer-rails (~> 8.2.0)
|
autoprefixer-rails (~> 8.2.0)
|
||||||
axlsx (~> 3.0.0.pre)
|
|
||||||
axlsx_rails (~> 0.5.2)
|
|
||||||
browser (~> 2.5.3)
|
browser (~> 2.5.3)
|
||||||
bullet (~> 5.7.0)
|
bullet (~> 5.7.0)
|
||||||
byebug (~> 10.0.0)
|
byebug (~> 10.0.0)
|
||||||
|
|||||||
@@ -1006,39 +1006,3 @@
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 10. Legislation resumes
|
|
||||||
// -------------------------
|
|
||||||
.resume_title {
|
|
||||||
padding-left: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.panel_resume {
|
|
||||||
margin-left: rem-calc(16);
|
|
||||||
}
|
|
||||||
|
|
||||||
.question_title {
|
|
||||||
margin-bottom: 1.5%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comment_box {
|
|
||||||
border-radius: rem-calc(10);
|
|
||||||
padding: 1.5%;
|
|
||||||
background-color: rgba(217, 216, 243, 0.2);
|
|
||||||
margin-bottom: 1%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.centered_votes {
|
|
||||||
padding: rem-calc(10);
|
|
||||||
}
|
|
||||||
|
|
||||||
.annotation_text {
|
|
||||||
border: 1px solid $black;
|
|
||||||
padding: rem-calc(10);
|
|
||||||
}
|
|
||||||
|
|
||||||
.download-button {
|
|
||||||
position: absolute;
|
|
||||||
margin-top: rem-calc(25);
|
|
||||||
margin-left: 85%;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ class Legislation::ProcessesController < Legislation::BaseController
|
|||||||
load_and_authorize_resource
|
load_and_authorize_resource
|
||||||
|
|
||||||
before_action :set_random_seed, only: :proposals
|
before_action :set_random_seed, only: :proposals
|
||||||
before_action :check_past, only: :resume
|
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@current_filter ||= "open"
|
@current_filter ||= "open"
|
||||||
@@ -98,21 +97,6 @@ class Legislation::ProcessesController < Legislation::BaseController
|
|||||||
@phase = :milestones
|
@phase = :milestones
|
||||||
end
|
end
|
||||||
|
|
||||||
def resume
|
|
||||||
@phase = :resume
|
|
||||||
respond_to do |format|
|
|
||||||
format.html
|
|
||||||
format.xlsx { render xlsx: "resume_to_xlsx", filename: ("resume-" + Date.current.to_s + ".xlsx") }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def check_past
|
|
||||||
set_process
|
|
||||||
if !@process.past?
|
|
||||||
redirect_to legislation_process_path
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def proposals
|
def proposals
|
||||||
set_process
|
set_process
|
||||||
@phase = :proposals_phase
|
@phase = :proposals_phase
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ module Abilities
|
|||||||
can :new, DirectMessage
|
can :new, DirectMessage
|
||||||
can [:read, :debate, :draft_publication, :allegations, :result_publication,
|
can [:read, :debate, :draft_publication, :allegations, :result_publication,
|
||||||
:proposals, :milestones], Legislation::Process, published: true
|
:proposals, :milestones], Legislation::Process, published: true
|
||||||
can :resume, Legislation::Process, &:past?
|
|
||||||
can [:read, :changes, :go_to_version], Legislation::DraftVersion
|
can [:read, :changes, :go_to_version], Legislation::DraftVersion
|
||||||
can [:read], Legislation::Question
|
can [:read], Legislation::Question
|
||||||
can [:read, :map, :share], Legislation::Proposal
|
can [:read, :map, :share], Legislation::Proposal
|
||||||
|
|||||||
@@ -65,10 +65,6 @@ class Legislation::Process < ApplicationRecord
|
|||||||
draft_end_date < ?))", Date.current, Date.current)
|
draft_end_date < ?))", Date.current, Date.current)
|
||||||
end
|
end
|
||||||
|
|
||||||
def past?
|
|
||||||
end_date < Date.current
|
|
||||||
end
|
|
||||||
|
|
||||||
def homepage_phase
|
def homepage_phase
|
||||||
Legislation::Process::Phase.new(start_date, end_date, homepage_enabled)
|
Legislation::Process::Phase.new(start_date, end_date, homepage_enabled)
|
||||||
end
|
end
|
||||||
@@ -123,20 +119,6 @@ class Legislation::Process < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_last_draft_version
|
|
||||||
Legislation::DraftVersion.where(process: self, status: "published").last
|
|
||||||
end
|
|
||||||
|
|
||||||
def get_annotations_from_draft
|
|
||||||
Legislation::Annotation.where(legislation_draft_version_id: get_last_draft_version)
|
|
||||||
end
|
|
||||||
|
|
||||||
def get_best_annotation_comments
|
|
||||||
Comment.where(commentable_id: get_annotations_from_draft,
|
|
||||||
commentable_type: "Legislation::Annotation", ancestry: nil)
|
|
||||||
.order("cached_votes_up - cached_votes_down DESC")
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def valid_date_ranges
|
def valid_date_ranges
|
||||||
|
|||||||
@@ -44,11 +44,4 @@ class Legislation::Question < ApplicationRecord
|
|||||||
def comments_open?
|
def comments_open?
|
||||||
process.debate_phase.open?
|
process.debate_phase.open?
|
||||||
end
|
end
|
||||||
|
|
||||||
def best_comments(number)
|
|
||||||
Comment.where(commentable_id: id)
|
|
||||||
.where(commentable_type: "Legislation::Question")
|
|
||||||
.order("cached_votes_up - cached_votes_down DESC")
|
|
||||||
.take(number)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
<div class="row">
|
|
||||||
<div class="debate-chooser">
|
|
||||||
<div class="resume_title small-12 medium-9 column">
|
|
||||||
<h3><%= t("legislation.summary.debates_phase") %></h3>
|
|
||||||
</div>
|
|
||||||
<div class="small-12 medium-3 column">
|
|
||||||
<h3><%= t("legislation.questions.question.total", count: @process.questions.count) %></h3>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="small-12 medium-11 column">
|
|
||||||
<div class="debate-list">
|
|
||||||
<% if @process.questions.empty? %>
|
|
||||||
<div class="callout primary">
|
|
||||||
<p><%= t("legislation.processes.debate.empty_questions") %></p>
|
|
||||||
</div>
|
|
||||||
<% else %>
|
|
||||||
<%= render "resume_questions", process: @process %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@@ -52,15 +52,6 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if process.result_publication.enabled? && process.end_date <= Date.current %>
|
|
||||||
<li <%= "class=is-active" if phase == :resume %>>
|
|
||||||
<%= link_to resume_legislation_process_path(process) do %>
|
|
||||||
<h4><%= t("legislation.summary.title") %></h4>
|
|
||||||
<span><%= format_date(process.result_publication_date) %></span>
|
|
||||||
<% end %>
|
|
||||||
</li>
|
|
||||||
<% end %>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
<div class="row">
|
|
||||||
<div class="debate-chooser">
|
|
||||||
<div class="resume_title small-12 medium-9 column">
|
|
||||||
<h3><%= t("legislation.summary.proposal_phase") %></h3>
|
|
||||||
</div>
|
|
||||||
<div class="small-12 medium-3 column">
|
|
||||||
<h3><%= t("legislation.proposals.total", count: Legislation::Proposal.where(legislation_process_id: @process).where(selected: true).count) %></h3>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="small-12 medium-11 column">
|
|
||||||
<div class="debate-list">
|
|
||||||
<% if Legislation::Proposal.where(legislation_process_id: @process).where(selected: true).empty? %>
|
|
||||||
<div class="callout primary">
|
|
||||||
<p><%= t("legislation.processes.proposals.empty_proposals") %></p>
|
|
||||||
</div>
|
|
||||||
<% else %>
|
|
||||||
<%= render "resume_proposal", process: @process %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
<% Legislation::Proposal.where(legislation_process_id: @process)
|
|
||||||
.where(selected: true).order("cached_votes_score desc").each do |proposal| %>
|
|
||||||
<div class="row">
|
|
||||||
<div class="proposal">
|
|
||||||
<div class="panel panel_resume" style="min-height: 5rem;">
|
|
||||||
<div class="small-12 medium-9 column">
|
|
||||||
<h3>
|
|
||||||
<%= link_to proposal.title, legislation_process_proposal_path(proposal.legislation_process_id, proposal) %>
|
|
||||||
</h3>
|
|
||||||
</div>
|
|
||||||
<div id="<%= dom_id(proposal) %>_votes" class="small-12 medium-3 column">
|
|
||||||
<p class="centered_votes"> <%= proposal.cached_votes_total - proposal.cached_votes_down %> <%= t("legislation.summary.votes") %> </p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
<% @process.questions.each do |question| %>
|
|
||||||
<div class="row">
|
|
||||||
<div class="proposal">
|
|
||||||
<div class="panel panel_resume" style="min-height: 5rem;">
|
|
||||||
<div class="row question_title">
|
|
||||||
<div class="small-12 medium-9 column">
|
|
||||||
<div>
|
|
||||||
<h4><%= link_to question.title, legislation_process_question_path(question.process, question) %></h4>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="<%= dom_id(question) %>_votes" class="small-12 medium-3 column">
|
|
||||||
<span class="icon-comments" aria-hidden="true"></span>
|
|
||||||
<span class="debate-comments">
|
|
||||||
<%= link_to t("legislation.summary.comments", count: question.comments.count), legislation_process_question_path(question.process, question) %>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% if question.comments.count > 0 %>
|
|
||||||
<span><%= t("legislation.summary.most_voted_comments") %> </span>
|
|
||||||
<% end %>
|
|
||||||
<div class="row">
|
|
||||||
<% question.best_comments(3).each do |comment| %>
|
|
||||||
<div class="small-12 medium-9 column">
|
|
||||||
<p class="comment_box"> <%= link_to comment.body, comment_path(comment) %></p>
|
|
||||||
</div>
|
|
||||||
<div class="small-12 medium-3 column">
|
|
||||||
<p class="centered_votes"> <%= comment.cached_votes_up - comment.cached_votes_down %> <%= t("legislation.summary.votes") %></p>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
<% @process.get_best_annotation_comments.take(10).each do |comment| %>
|
|
||||||
<div class="row">
|
|
||||||
<div class="proposal">
|
|
||||||
<div class="panel panel_resume" style="min-height: 5rem;">
|
|
||||||
<div class="row">
|
|
||||||
<div class="small-12 medium-9 column">
|
|
||||||
<span><%= t("legislation.annotations.index.comment_about") %> </span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row question_title">
|
|
||||||
<div class="small-12 medium-9 column">
|
|
||||||
<div class="annotation_text question_title">
|
|
||||||
<span> "<%= Legislation::Annotation.find_by(id: comment.commentable_id).quote %>" </span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="small-12 medium-3 column">
|
|
||||||
<span> <%= comment.cached_votes_up - comment.cached_votes_down %> <%= t("legislation.summary.votes") %> </span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<span><%= t("legislation.annotations.show.title") %>:</span>
|
|
||||||
<div class="row">
|
|
||||||
<div class="small-12 medium-9 column">
|
|
||||||
<p class="comment_box"> <%= link_to comment.body, comment_path(comment) %></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
<div class="row">
|
|
||||||
<div class="debate-chooser">
|
|
||||||
<div class="small-12 medium-9 column resume_title">
|
|
||||||
<h3><%= t("legislation.summary.comments_phase") %>
|
|
||||||
<% if !@process.get_last_draft_version.nil? %>
|
|
||||||
(<%= t("legislation.summary.version") %> <%= @process.get_last_draft_version.title %>)</h3>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
<div class="small-12 medium-3 column">
|
|
||||||
<h3><%= t("legislation.annotations.index.comments_count", count: @process.get_best_annotation_comments.count) %></h3>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="small-12 medium-11 column">
|
|
||||||
<div class="debate-list">
|
|
||||||
<% if !@process.get_last_draft_version.nil? %>
|
|
||||||
<% if @process.get_last_draft_version.annotations.empty? %>
|
|
||||||
<div class="callout primary">
|
|
||||||
<p><%= t("legislation.summary.no_allegation") %></p>
|
|
||||||
</div>
|
|
||||||
<% else %>
|
|
||||||
<%= render "resume_text", process: @process %>
|
|
||||||
<% end %>
|
|
||||||
<% else %>
|
|
||||||
<div class="callout primary">
|
|
||||||
<p><%= t("legislation.summary.no_allegation") %></p>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
<% provide(:title) { @process.title } %>
|
|
||||||
|
|
||||||
<%= render "legislation/processes/header", process: @process, header: :full %>
|
|
||||||
|
|
||||||
<%= render "key_dates", process: @process, phase: @phase %>
|
|
||||||
|
|
||||||
<% if !@process.debate_phase.enabled? && !@process.proposals_phase.enabled? && !@process.allegations_phase.enabled? %>
|
|
||||||
<div class="callout primary">
|
|
||||||
<p><%= t("legislation.summary.process_empty") %></p>
|
|
||||||
</div>
|
|
||||||
<% else %>
|
|
||||||
<button class="button hollow download-button">
|
|
||||||
<%= link_to "Download", resume_legislation_process_path(format: :xlsx) %>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<% if @process.debate_phase.enabled? %>
|
|
||||||
<%= render "debate_phase", process: @process %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if @process.proposals_phase.enabled? %>
|
|
||||||
<%= render "proposal_phase", process: @process %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if @process.allegations_phase.enabled? %>
|
|
||||||
<%= render "text_comment_phase", process: @process %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% end %>
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
wb = xlsx_package.workbook
|
|
||||||
space = " "
|
|
||||||
wb.add_worksheet(name: "Resume") do |sheet|
|
|
||||||
if @process.debate_phase.enabled? && !@process.questions.empty?
|
|
||||||
sheet.add_row [t("legislation.summary.debates_phase"), t("legislation.questions.question.total", count: @process.questions.count)]
|
|
||||||
@process.questions.each do |question|
|
|
||||||
sheet.add_row [question.title, t("legislation.summary.comments", count: question.comments.count)]
|
|
||||||
sheet.add_hyperlink location: legislation_process_question_url(question.process, question), ref: sheet.rows.last.cells.first
|
|
||||||
question.best_comments(3).each do |comment|
|
|
||||||
sheet.add_row [comment.body, (comment.cached_votes_up - comment.cached_votes_down).to_s + space + t("legislation.summary.votes")]
|
|
||||||
sheet.add_hyperlink location: comment_url(comment), ref: sheet.rows.last.cells.first
|
|
||||||
end
|
|
||||||
sheet.add_row ["", ""]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if @process.proposals_phase.enabled? && !Legislation::Proposal.where(legislation_process_id: @process).where(selected: true).empty?
|
|
||||||
sheet.add_row [t("legislation.summary.proposal_phase"), t("legislation.proposals.total", count: Legislation::Proposal.where(legislation_process_id: @process).where(selected: true).count)]
|
|
||||||
Legislation::Proposal.where(legislation_process_id: @process).where(selected: true).order("cached_votes_score desc").each do |proposal|
|
|
||||||
sheet.add_row [proposal.title,
|
|
||||||
(proposal.cached_votes_total - proposal.cached_votes_down).to_s + space + t("legislation.summary.votes")]
|
|
||||||
sheet.add_hyperlink location: legislation_process_proposal_url(proposal.legislation_process_id, proposal), ref: sheet.rows.last.cells.first
|
|
||||||
end
|
|
||||||
sheet.add_row ["", ""]
|
|
||||||
end
|
|
||||||
|
|
||||||
if @process.allegations_phase.enabled? && !@process.get_last_draft_version.nil? && !@process.get_last_draft_version.annotations.empty?
|
|
||||||
sheet.add_row [t("legislation.summary.comments_phase") + " (" + t("legislation.summary.version") + @process.get_last_draft_version.title + ")",
|
|
||||||
t("legislation.annotations.index.comments_count", count: @process.get_best_annotation_comments.count)]
|
|
||||||
@process.get_best_annotation_comments.take(10).each do |comment|
|
|
||||||
sheet.add_row [Legislation::Annotation.find_by(id: comment.commentable_id).quote, ""]
|
|
||||||
sheet.add_row [comment.body, (comment.cached_votes_up - comment.cached_votes_down).to_s + space + t("legislation.summary.votes")]
|
|
||||||
sheet.add_hyperlink location: comment_url(comment), ref: sheet.rows.last.cells.first
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -17,10 +17,8 @@ en:
|
|||||||
index:
|
index:
|
||||||
title: Comments
|
title: Comments
|
||||||
comments_about: Comments about
|
comments_about: Comments about
|
||||||
comment_about: "Comment about:"
|
|
||||||
see_in_context: See in context
|
see_in_context: See in context
|
||||||
comments_count:
|
comments_count:
|
||||||
zero: No comments
|
|
||||||
one: "%{count} comment"
|
one: "%{count} comment"
|
||||||
other: "%{count} comments"
|
other: "%{count} comments"
|
||||||
show:
|
show:
|
||||||
@@ -95,10 +93,6 @@ en:
|
|||||||
form:
|
form:
|
||||||
leave_comment: Leave your answer
|
leave_comment: Leave your answer
|
||||||
question:
|
question:
|
||||||
total:
|
|
||||||
zero: No debates
|
|
||||||
one: "%{count} debate"
|
|
||||||
other: "%{count} debates"
|
|
||||||
comments:
|
comments:
|
||||||
zero: No comments
|
zero: No comments
|
||||||
one: "%{count} comment"
|
one: "%{count} comment"
|
||||||
@@ -124,21 +118,3 @@ en:
|
|||||||
tags_label: "Categories"
|
tags_label: "Categories"
|
||||||
not_verified: "For vote proposals %{verify_account}."
|
not_verified: "For vote proposals %{verify_account}."
|
||||||
process_title: Collaborative legislation process
|
process_title: Collaborative legislation process
|
||||||
total:
|
|
||||||
zero: No proposals
|
|
||||||
one: "%{count} proposal"
|
|
||||||
other: "%{count} proposals"
|
|
||||||
summary:
|
|
||||||
title: Resume
|
|
||||||
votes: votes
|
|
||||||
debates_phase: Debates phase
|
|
||||||
proposal_phase: Proposal phase
|
|
||||||
comments_phase: Text comment phase
|
|
||||||
comments:
|
|
||||||
zero: No comments
|
|
||||||
one: "%{count} comment"
|
|
||||||
other: "%{count} comments"
|
|
||||||
most_voted_comments: "Most voted comments: "
|
|
||||||
no_allegation: There are no text comments
|
|
||||||
version: version
|
|
||||||
process_empty: The process have no phases.
|
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ es:
|
|||||||
index:
|
index:
|
||||||
title: Comentarios
|
title: Comentarios
|
||||||
comments_about: Comentarios sobre
|
comments_about: Comentarios sobre
|
||||||
comment_about: "Comentario sobre:"
|
|
||||||
see_in_context: Ver en contexto
|
see_in_context: Ver en contexto
|
||||||
comments_count:
|
comments_count:
|
||||||
one: "%{count} comentario"
|
one: "%{count} comentario"
|
||||||
@@ -94,10 +93,6 @@ es:
|
|||||||
form:
|
form:
|
||||||
leave_comment: Deja tu respuesta
|
leave_comment: Deja tu respuesta
|
||||||
question:
|
question:
|
||||||
total:
|
|
||||||
zero: No hay debates
|
|
||||||
one: "%{count} debate"
|
|
||||||
other: "%{count} debates"
|
|
||||||
comments:
|
comments:
|
||||||
zero: Sin comentarios
|
zero: Sin comentarios
|
||||||
one: "%{count} comentario"
|
one: "%{count} comentario"
|
||||||
@@ -123,21 +118,3 @@ es:
|
|||||||
tags_label: "Categorías"
|
tags_label: "Categorías"
|
||||||
not_verified: "Para votar propuestas %{verify_account}."
|
not_verified: "Para votar propuestas %{verify_account}."
|
||||||
process_title: Proceso de legislación colaborativa
|
process_title: Proceso de legislación colaborativa
|
||||||
total:
|
|
||||||
zero: No hay propuestas
|
|
||||||
one: "%{count} propuesta"
|
|
||||||
other: "%{count} propuestas"
|
|
||||||
summary:
|
|
||||||
title: Resumen
|
|
||||||
votes: votos
|
|
||||||
debates_phase: Fase de debates
|
|
||||||
proposal_phase: Fase de propuestas
|
|
||||||
comments_phase: Fase de comentarios de texto
|
|
||||||
comments:
|
|
||||||
zero: No hay comentarios
|
|
||||||
one: "%{count} comentario"
|
|
||||||
other: "%{count} comentarios"
|
|
||||||
most_voted_comments: "Comentarios más votados:"
|
|
||||||
no_allegation: No hay comentarios de texto.
|
|
||||||
version: versión
|
|
||||||
process_empty: The proces have no phases.
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ namespace :legislation do
|
|||||||
get :result_publication
|
get :result_publication
|
||||||
get :proposals
|
get :proposals
|
||||||
get :milestones
|
get :milestones
|
||||||
get :resume
|
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :questions, only: [:show] do
|
resources :questions, only: [:show] do
|
||||||
|
|||||||
@@ -1,244 +0,0 @@
|
|||||||
require "rails_helper"
|
|
||||||
|
|
||||||
describe "Legislation" do
|
|
||||||
context "process resume page" do
|
|
||||||
scenario "resume tab not show" do
|
|
||||||
process = create(:legislation_process, :open)
|
|
||||||
visit legislation_process_path(process)
|
|
||||||
expect(page).not_to have_content("Resume")
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "resume tab show" do
|
|
||||||
process = create(:legislation_process, :past)
|
|
||||||
visit legislation_process_path(process)
|
|
||||||
expect(page).to have_content("Resume")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "process empty" do
|
|
||||||
let(:process) { create(:legislation_process, :empty, end_date: Date.current - 1.day) }
|
|
||||||
|
|
||||||
scenario "warning empty" do
|
|
||||||
visit resume_legislation_process_path(process)
|
|
||||||
expect(page).to have_content("The process have no phases.")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "phases empty" do
|
|
||||||
let(:process) { create(:legislation_process, end_date: Date.current - 1.day) }
|
|
||||||
|
|
||||||
scenario "debates empty" do
|
|
||||||
visit resume_legislation_process_path(process)
|
|
||||||
expect(page).to have_content("Debates phase")
|
|
||||||
expect(page).to have_content("No debates")
|
|
||||||
expect(page).to have_content("There aren't any questions")
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "proposals empty" do
|
|
||||||
visit resume_legislation_process_path(process)
|
|
||||||
expect(page).to have_content("Proposal phase")
|
|
||||||
expect(page).to have_content("No proposals")
|
|
||||||
expect(page).to have_content("There are no proposals")
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "text comments empty" do
|
|
||||||
visit resume_legislation_process_path(process)
|
|
||||||
expect(page).to have_content("Text comment phase")
|
|
||||||
expect(page).to have_content("No comments")
|
|
||||||
expect(page).to have_content("There are no text comments")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "process empty" do
|
|
||||||
let(:process) { create(:legislation_process, :empty, end_date: Date.current - 1.day) }
|
|
||||||
|
|
||||||
scenario "warning empty" do
|
|
||||||
visit resume_legislation_process_path(process)
|
|
||||||
expect(page).to have_content("The process have no phases.")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "only debates exist" do
|
|
||||||
let(:process) { create(:legislation_process, end_date: Date.current - 1.day) }
|
|
||||||
|
|
||||||
before do
|
|
||||||
user = create(:user, :level_two)
|
|
||||||
|
|
||||||
create(:legislation_question, process: process, title: "Question 1") do |question|
|
|
||||||
create(:comment, user: user, commentable: question, body: "Answer 1")
|
|
||||||
create(:comment, user: user, commentable: question, body: "Answer 2")
|
|
||||||
end
|
|
||||||
|
|
||||||
create(:legislation_question, process: process, title: "Question 2") do |question|
|
|
||||||
create(:comment, user: user, commentable: question, body: "Answer 3")
|
|
||||||
create(:comment, user: user, commentable: question, body: "Answer 4")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "show debates list" do
|
|
||||||
visit resume_legislation_process_path(process)
|
|
||||||
expect(page).to have_content("Debates phase")
|
|
||||||
expect(page).to have_content("2 debates")
|
|
||||||
|
|
||||||
expect(page).to have_content("Question 1")
|
|
||||||
expect(page).to have_content("Answer 1")
|
|
||||||
expect(page).to have_content("Answer 2")
|
|
||||||
expect(page).to have_content("Question 2")
|
|
||||||
expect(page).to have_content("Answer 3")
|
|
||||||
expect(page).to have_content("Answer 4")
|
|
||||||
|
|
||||||
click_link "Question 1"
|
|
||||||
expect(page).to have_content("Question 1")
|
|
||||||
expect(page).to have_content("Answer 1")
|
|
||||||
expect(page).to have_content("Answer 2")
|
|
||||||
expect(page).not_to have_content("Answer 3")
|
|
||||||
expect(page).not_to have_content("Answer 4")
|
|
||||||
|
|
||||||
visit resume_legislation_process_path(process)
|
|
||||||
click_link "Question 2"
|
|
||||||
expect(page).to have_content("Question 2")
|
|
||||||
expect(page).not_to have_content("Answer 1")
|
|
||||||
expect(page).not_to have_content("Answer 2")
|
|
||||||
expect(page).to have_content("Answer 3")
|
|
||||||
expect(page).to have_content("Answer 4")
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "proposals empty" do
|
|
||||||
visit resume_legislation_process_path(process)
|
|
||||||
expect(page).to have_content("Proposal phase")
|
|
||||||
expect(page).to have_content("No proposals")
|
|
||||||
expect(page).to have_content("There are no proposals")
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "text comments empty" do
|
|
||||||
visit resume_legislation_process_path(process)
|
|
||||||
expect(page).to have_content("Text comment phase")
|
|
||||||
expect(page).to have_content("No comments")
|
|
||||||
expect(page).to have_content("There are no text comments")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "only proposals exist" do
|
|
||||||
let(:process) { create(:legislation_process, end_date: Date.current - 1.day) }
|
|
||||||
|
|
||||||
before do
|
|
||||||
create(:legislation_proposal, legislation_process_id: process.id,
|
|
||||||
title: "Legislation proposal 1", selected: true)
|
|
||||||
create(:legislation_proposal, legislation_process_id: process.id,
|
|
||||||
title: "Legislation proposal 2", selected: false)
|
|
||||||
create(:legislation_proposal, legislation_process_id: process.id,
|
|
||||||
title: "Legislation proposal 3", selected: true)
|
|
||||||
create(:legislation_proposal, legislation_process_id: process.id,
|
|
||||||
title: "Legislation proposal 4", selected: false)
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "debates empty" do
|
|
||||||
visit resume_legislation_process_path(process)
|
|
||||||
expect(page).to have_content("Debates phase")
|
|
||||||
expect(page).to have_content("No debates")
|
|
||||||
expect(page).to have_content("There aren't any questions")
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "proposals empty" do
|
|
||||||
visit resume_legislation_process_path(process)
|
|
||||||
expect(page).to have_content("Proposal phase")
|
|
||||||
expect(page).to have_content("2 proposals")
|
|
||||||
|
|
||||||
expect(page).to have_content("Legislation proposal 1")
|
|
||||||
expect(page).not_to have_content("Legislation proposal 2")
|
|
||||||
expect(page).to have_content("Legislation proposal 3")
|
|
||||||
expect(page).not_to have_content("Legislation proposal 4")
|
|
||||||
|
|
||||||
click_link "Legislation proposal 1"
|
|
||||||
expect(page).to have_content("Legislation proposal 1")
|
|
||||||
|
|
||||||
visit resume_legislation_process_path(process)
|
|
||||||
click_link "Legislation proposal 3"
|
|
||||||
expect(page).to have_content("Legislation proposal 3")
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "text comments empty" do
|
|
||||||
visit resume_legislation_process_path(process)
|
|
||||||
expect(page).to have_content("Text comment phase")
|
|
||||||
expect(page).to have_content("No comments")
|
|
||||||
expect(page).to have_content("There are no text comments")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "only text comments exist" do
|
|
||||||
let(:process) { create(:legislation_process, end_date: Date.current - 1.day) }
|
|
||||||
|
|
||||||
before do
|
|
||||||
user = create(:user, :level_two)
|
|
||||||
draft_version_1 = create(:legislation_draft_version, process: process,
|
|
||||||
title: "Version 1", body: "Body of the first version",
|
|
||||||
status: "published")
|
|
||||||
draft_version_2 = create(:legislation_draft_version, process: process,
|
|
||||||
title: "Version 2", body: "Body of the second version and that's it all of it",
|
|
||||||
status: "published")
|
|
||||||
annotation0 = create(:legislation_annotation,
|
|
||||||
draft_version: draft_version_1, text: "my annotation123",
|
|
||||||
ranges: [{ "start" => "/p[1]", "startOffset" => 5, "end" => "/p[1]", "endOffset" => 10 }])
|
|
||||||
annotation1 = create(:legislation_annotation,
|
|
||||||
draft_version: draft_version_2, text: "hola",
|
|
||||||
ranges: [{ "start" => "/p[1]", "startOffset" => 5, "end" => "/p[1]", "endOffset" => 10 }])
|
|
||||||
annotation2 = create(:legislation_annotation,
|
|
||||||
draft_version: draft_version_2,
|
|
||||||
ranges: [{ "start" => "/p[1]", "startOffset" => 12, "end" => "/p[1]", "endOffset" => 19 }])
|
|
||||||
|
|
||||||
create(:comment, user: user, commentable: annotation0, body: "Comment 0")
|
|
||||||
create(:comment, user: user, commentable: annotation1, body: "Comment 1")
|
|
||||||
create(:comment, user: user, commentable: annotation2, body: "Comment 2")
|
|
||||||
create(:comment, user: user, commentable: annotation2, body: "Comment 3")
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "debates empty" do
|
|
||||||
visit resume_legislation_process_path(process)
|
|
||||||
expect(page).to have_content("Debates phase")
|
|
||||||
expect(page).to have_content("No debates")
|
|
||||||
expect(page).to have_content("There aren't any questions")
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "proposals empty" do
|
|
||||||
visit resume_legislation_process_path(process)
|
|
||||||
expect(page).to have_content("Proposal phase")
|
|
||||||
expect(page).to have_content("No proposals")
|
|
||||||
expect(page).to have_content("There are no proposals")
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "text comments empty" do
|
|
||||||
visit resume_legislation_process_path(process)
|
|
||||||
expect(page).to have_content("Text comment phase (version Version 2")
|
|
||||||
expect(page).to have_content("5 comments")
|
|
||||||
expect(page).not_to have_content("Comment 0")
|
|
||||||
expect(page).to have_content("Comment 1")
|
|
||||||
expect(page).to have_content("Comment 2")
|
|
||||||
expect(page).to have_content("Comment 3")
|
|
||||||
|
|
||||||
click_link "Comment 2"
|
|
||||||
expect(page).to have_content("Comment 2")
|
|
||||||
end
|
|
||||||
|
|
||||||
# scenario "excel download" do
|
|
||||||
# visit resume_legislation_process_path(process)
|
|
||||||
# click_link "Download"
|
|
||||||
# page.response_headers['Content-Type'].should eq "application/xlsx"
|
|
||||||
# end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe Legislation::ProcessesController, type: :controller do
|
|
||||||
let(:legislation_process) { create(:legislation_process, end_date: Date.current - 1.day) }
|
|
||||||
|
|
||||||
before do
|
|
||||||
user = create(:user, :level_two)
|
|
||||||
debate = create(:legislation_question, process: legislation_process, title: "Question 1")
|
|
||||||
create(:comment, user: user, commentable: debate, body: "Answer 1")
|
|
||||||
create(:comment, user: user, commentable: debate, body: "Answer 2")
|
|
||||||
end
|
|
||||||
|
|
||||||
it "download execl file test" do
|
|
||||||
get :resume, params: { id: legislation_process, format: :xlsx }
|
|
||||||
expect(response).to be_success
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
Reference in New Issue
Block a user