Removed unnecessary parts in Legislation Proposals
This commit is contained in:
@@ -12,7 +12,7 @@ class Legislation::ProposalsController < Legislation::BaseController
|
|||||||
|
|
||||||
invisible_captcha only: [:create, :update], honeypot: :subtitle
|
invisible_captcha only: [:create, :update], honeypot: :subtitle
|
||||||
|
|
||||||
has_orders %w{hot_score confidence_score created_at relevance archival_date}, only: :index
|
has_orders %w{confidence_score created_at}, only: :index
|
||||||
has_orders %w{most_voted newest oldest}, only: :show
|
has_orders %w{most_voted newest oldest}, only: :show
|
||||||
|
|
||||||
helper_method :resource_model, :resource_name
|
helper_method :resource_model, :resource_name
|
||||||
@@ -21,7 +21,6 @@ class Legislation::ProposalsController < Legislation::BaseController
|
|||||||
def show
|
def show
|
||||||
super
|
super
|
||||||
set_legislation_proposal_votes(@process.proposals)
|
set_legislation_proposal_votes(@process.proposals)
|
||||||
@notifications = @proposal.notifications
|
|
||||||
@document = Document.new(documentable: @proposal)
|
@document = Document.new(documentable: @proposal)
|
||||||
redirect_to legislation_process_proposal_path(params[:process_id], @proposal),
|
redirect_to legislation_process_proposal_path(params[:process_id], @proposal),
|
||||||
status: :moved_permanently if request.path != legislation_process_proposal_path(params[:process_id], @proposal)
|
status: :moved_permanently if request.path != legislation_process_proposal_path(params[:process_id], @proposal)
|
||||||
@@ -39,8 +38,6 @@ class Legislation::ProposalsController < Legislation::BaseController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def index_customization
|
def index_customization
|
||||||
discard_archived
|
|
||||||
load_retired
|
|
||||||
load_successful_proposals
|
load_successful_proposals
|
||||||
load_featured unless @proposal_successful_exists
|
load_featured unless @proposal_successful_exists
|
||||||
end
|
end
|
||||||
@@ -50,28 +47,12 @@ class Legislation::ProposalsController < Legislation::BaseController
|
|||||||
set_legislation_proposal_votes(@proposal)
|
set_legislation_proposal_votes(@proposal)
|
||||||
end
|
end
|
||||||
|
|
||||||
def retire
|
|
||||||
if valid_retired_params? && @proposal.update(retired_params.merge(retired_at: Time.current))
|
|
||||||
redirect_to proposal_path(@proposal), notice: t('proposals.notice.retired')
|
|
||||||
else
|
|
||||||
render action: :retire_form
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def retire_form
|
|
||||||
end
|
|
||||||
|
|
||||||
def share
|
def share
|
||||||
if Setting['proposal_improvement_path'].present?
|
if Setting['proposal_improvement_path'].present?
|
||||||
@proposal_improvement_path = Setting['proposal_improvement_path']
|
@proposal_improvement_path = Setting['proposal_improvement_path']
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def vote_featured
|
|
||||||
@proposal.register_vote(current_user, 'yes')
|
|
||||||
set_featured_proposal_votes(@proposal)
|
|
||||||
end
|
|
||||||
|
|
||||||
def summary
|
def summary
|
||||||
@proposals = Legislation::Proposal.for_summary
|
@proposals = Legislation::Proposal.for_summary
|
||||||
@tag_cloud = tag_cloud
|
@tag_cloud = tag_cloud
|
||||||
@@ -85,16 +66,6 @@ class Legislation::ProposalsController < Legislation::BaseController
|
|||||||
documents_attributes: [:id, :title, :attachment, :cached_attachment, :user_id] )
|
documents_attributes: [:id, :title, :attachment, :cached_attachment, :user_id] )
|
||||||
end
|
end
|
||||||
|
|
||||||
def retired_params
|
|
||||||
params.require(:legislation_proposal).permit(:retired_reason, :retired_explanation)
|
|
||||||
end
|
|
||||||
|
|
||||||
def valid_retired_params?
|
|
||||||
@proposal.errors.add(:retired_reason, I18n.t('errors.messages.blank')) if params[:legislation_proposal][:retired_reason].blank?
|
|
||||||
@proposal.errors.add(:retired_explanation, I18n.t('errors.messages.blank')) if params[:legislation_proposal][:retired_explanation].blank?
|
|
||||||
@proposal.errors.empty?
|
|
||||||
end
|
|
||||||
|
|
||||||
def resource_model
|
def resource_model
|
||||||
Legislation::Proposal
|
Legislation::Proposal
|
||||||
end
|
end
|
||||||
@@ -103,32 +74,6 @@ class Legislation::ProposalsController < Legislation::BaseController
|
|||||||
'proposal'
|
'proposal'
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_featured_proposal_votes(proposals)
|
|
||||||
@featured_proposals_votes = current_user ? current_user.proposal_votes(proposals) : {}
|
|
||||||
end
|
|
||||||
|
|
||||||
def discard_archived
|
|
||||||
@resources = @resources.not_archived unless @current_order == "archival_date"
|
|
||||||
end
|
|
||||||
|
|
||||||
def load_retired
|
|
||||||
if params[:retired].present?
|
|
||||||
@resources = @resources.retired
|
|
||||||
@resources = @resources.where(retired_reason: params[:retired]) if Legislation::Proposal::RETIRE_OPTIONS.include?(params[:retired])
|
|
||||||
else
|
|
||||||
@resources = @resources.not_retired
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def load_featured
|
|
||||||
return unless !@advanced_search_terms && @search_terms.blank? && @tag_filter.blank? && params[:retired].blank?
|
|
||||||
@featured_proposals = Legislation::Proposal.not_archived.sort_by_confidence_score.limit(3)
|
|
||||||
if @featured_proposals.present?
|
|
||||||
set_featured_proposal_votes(@featured_proposals)
|
|
||||||
@resources = @resources.where('proposals.id NOT IN (?)', @featured_proposals.map(&:id))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def load_successful_proposals
|
def load_successful_proposals
|
||||||
@proposal_successful_exists = Legislation::Proposal.successful.exists?
|
@proposal_successful_exists = Legislation::Proposal.successful.exists?
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ module Abilities
|
|||||||
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 [:create], Legislation::Answer
|
can [:create], Legislation::Answer
|
||||||
can [:read, :map, :summary, :share], Legislation::Proposal
|
can [:read, :map, :share], Legislation::Proposal
|
||||||
can [:search, :comments, :read, :create, :new_comment], Legislation::Annotation
|
can [:search, :comments, :read, :create, :new_comment], Legislation::Annotation
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ class Legislation::Proposal < ActiveRecord::Base
|
|||||||
include Sanitizable
|
include Sanitizable
|
||||||
include Searchable
|
include Searchable
|
||||||
include Filterable
|
include Filterable
|
||||||
include HasPublicAuthor
|
|
||||||
include Graphqlable
|
|
||||||
include Followable
|
include Followable
|
||||||
include Communitable
|
include Communitable
|
||||||
include Documentable
|
include Documentable
|
||||||
@@ -21,13 +19,10 @@ class Legislation::Proposal < ActiveRecord::Base
|
|||||||
acts_as_votable
|
acts_as_votable
|
||||||
acts_as_paranoid column: :hidden_at
|
acts_as_paranoid column: :hidden_at
|
||||||
|
|
||||||
RETIRE_OPTIONS = %w(duplicated started unfeasible done other)
|
|
||||||
|
|
||||||
belongs_to :process, class_name: 'Legislation::Process', foreign_key: 'legislation_process_id'
|
belongs_to :process, class_name: 'Legislation::Process', foreign_key: 'legislation_process_id'
|
||||||
belongs_to :author, -> { with_hidden }, class_name: 'User', foreign_key: 'author_id'
|
belongs_to :author, -> { with_hidden }, class_name: 'User', foreign_key: 'author_id'
|
||||||
belongs_to :geozone
|
belongs_to :geozone
|
||||||
has_many :comments, as: :commentable
|
has_many :comments, as: :commentable
|
||||||
has_many :proposal_notifications
|
|
||||||
|
|
||||||
validates :title, presence: true
|
validates :title, presence: true
|
||||||
validates :question, presence: true
|
validates :question, presence: true
|
||||||
@@ -39,7 +34,6 @@ class Legislation::Proposal < ActiveRecord::Base
|
|||||||
validates :description, length: { maximum: Legislation::Proposal.description_max_length }
|
validates :description, length: { maximum: Legislation::Proposal.description_max_length }
|
||||||
validates :question, length: { in: 10..Legislation::Proposal.question_max_length }
|
validates :question, length: { in: 10..Legislation::Proposal.question_max_length }
|
||||||
validates :responsible_name, length: { in: 6..Legislation::Proposal.responsible_name_max_length }
|
validates :responsible_name, length: { in: 6..Legislation::Proposal.responsible_name_max_length }
|
||||||
validates :retired_reason, inclusion: {in: RETIRE_OPTIONS, allow_nil: true}
|
|
||||||
|
|
||||||
validates :terms_of_service, acceptance: { allow_nil: false }, on: :create
|
validates :terms_of_service, acceptance: { allow_nil: false }, on: :create
|
||||||
|
|
||||||
@@ -53,16 +47,8 @@ class Legislation::Proposal < ActiveRecord::Base
|
|||||||
scope :sort_by_created_at, -> { reorder(created_at: :desc) }
|
scope :sort_by_created_at, -> { reorder(created_at: :desc) }
|
||||||
scope :sort_by_most_commented, -> { reorder(comments_count: :desc) }
|
scope :sort_by_most_commented, -> { reorder(comments_count: :desc) }
|
||||||
scope :sort_by_random, -> { reorder("RANDOM()") }
|
scope :sort_by_random, -> { reorder("RANDOM()") }
|
||||||
scope :sort_by_relevance, -> { all }
|
|
||||||
scope :sort_by_flags, -> { order(flags_count: :desc, updated_at: :desc) }
|
scope :sort_by_flags, -> { order(flags_count: :desc, updated_at: :desc) }
|
||||||
scope :sort_by_archival_date, -> { archived.sort_by_confidence_score }
|
|
||||||
scope :archived, -> { where("proposals.created_at <= ?", Setting["months_to_archive_proposals"].to_i.months.ago) }
|
|
||||||
scope :not_archived, -> { where("proposals.created_at > ?", Setting["months_to_archive_proposals"].to_i.months.ago) }
|
|
||||||
scope :last_week, -> { where("proposals.created_at >= ?", 7.days.ago)}
|
scope :last_week, -> { where("proposals.created_at >= ?", 7.days.ago)}
|
||||||
scope :retired, -> { where.not(retired_at: nil) }
|
|
||||||
scope :not_retired, -> { where(retired_at: nil) }
|
|
||||||
scope :successful, -> { where("cached_votes_up >= ?", Legislation::Proposal.votes_needed_for_success) }
|
|
||||||
scope :public_for_api, -> { all }
|
|
||||||
|
|
||||||
def to_param
|
def to_param
|
||||||
"#{id}-#{title}".parameterize
|
"#{id}-#{title}".parameterize
|
||||||
@@ -94,18 +80,6 @@ class Legislation::Proposal < ActiveRecord::Base
|
|||||||
/\A#{Setting["proposal_code_prefix"]}-\d\d\d\d-\d\d-(\d*)\z/.match(terms)
|
/\A#{Setting["proposal_code_prefix"]}-\d\d\d\d-\d\d-(\d*)\z/.match(terms)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.for_summary
|
|
||||||
summary = {}
|
|
||||||
categories = ActsAsTaggableOn::Tag.category_names.sort
|
|
||||||
geozones = Geozone.names.sort
|
|
||||||
|
|
||||||
groups = categories + geozones
|
|
||||||
groups.each do |group|
|
|
||||||
summary[group] = search(group).last_week.sort_by_confidence_score.limit(3)
|
|
||||||
end
|
|
||||||
summary
|
|
||||||
end
|
|
||||||
|
|
||||||
def total_votes
|
def total_votes
|
||||||
cached_votes_up
|
cached_votes_up
|
||||||
end
|
end
|
||||||
@@ -126,10 +100,6 @@ class Legislation::Proposal < ActiveRecord::Base
|
|||||||
user && user.level_two_or_three_verified?
|
user && user.level_two_or_three_verified?
|
||||||
end
|
end
|
||||||
|
|
||||||
def retired?
|
|
||||||
retired_at.present?
|
|
||||||
end
|
|
||||||
|
|
||||||
def register_vote(user, vote_value)
|
def register_vote(user, vote_value)
|
||||||
if votable_by?(user) && !archived?
|
if votable_by?(user) && !archived?
|
||||||
vote_by(voter: user, vote: vote_value)
|
vote_by(voter: user, vote: vote_value)
|
||||||
@@ -163,26 +133,6 @@ class Legislation::Proposal < ActiveRecord::Base
|
|||||||
tags.each{ |t| t.increment_custom_counter_for('LegislationProposal') }
|
tags.each{ |t| t.increment_custom_counter_for('LegislationProposal') }
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.votes_needed_for_success
|
|
||||||
Setting['votes_for_proposal_success'].to_i
|
|
||||||
end
|
|
||||||
|
|
||||||
def successful?
|
|
||||||
total_votes >= Legislation::Proposal.votes_needed_for_success
|
|
||||||
end
|
|
||||||
|
|
||||||
def archived?
|
|
||||||
created_at <= Setting["months_to_archive_proposals"].to_i.months.ago
|
|
||||||
end
|
|
||||||
|
|
||||||
def notifications
|
|
||||||
proposal_notifications
|
|
||||||
end
|
|
||||||
|
|
||||||
def users_to_notify
|
|
||||||
(voters + followers).uniq
|
|
||||||
end
|
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def set_responsible_name
|
def set_responsible_name
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ class User < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def legislation_proposal_votes(proposals)
|
def legislation_proposal_votes(proposals)
|
||||||
voted = votes.for_proposals(proposals)
|
voted = votes.for_legislation_proposals(proposals)
|
||||||
voted.each_with_object({}) { |v, h| h[v.votable_id] = v.value }
|
voted.each_with_object({}) { |v, h| h[v.votable_id] = v.value }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -5,12 +5,10 @@ class Vote < ActsAsVotable::Vote
|
|||||||
scope :public_for_api, -> do
|
scope :public_for_api, -> do
|
||||||
where(%{(votes.votable_type = 'Debate' and votes.votable_id in (?)) or
|
where(%{(votes.votable_type = 'Debate' and votes.votable_id in (?)) or
|
||||||
(votes.votable_type = 'Proposal' and votes.votable_id in (?)) or
|
(votes.votable_type = 'Proposal' and votes.votable_id in (?)) or
|
||||||
(votes.votable_type = 'Comment' and votes.votable_id in (?)) or
|
(votes.votable_type = 'Comment' and votes.votable_id in (?))},
|
||||||
(votes.votable_type = 'LegislationProposal' and votes.votable_id in (?))},
|
|
||||||
Debate.public_for_api.pluck(:id),
|
Debate.public_for_api.pluck(:id),
|
||||||
Proposal.public_for_api.pluck(:id),
|
Proposal.public_for_api.pluck(:id),
|
||||||
Comment.public_for_api.pluck(:id),
|
Comment.public_for_api.pluck(:id))
|
||||||
Legislation::Proposal.public_for_api.pluck(:id))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -9,14 +9,6 @@
|
|||||||
</h3>
|
</h3>
|
||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
<li class="tabs-title">
|
|
||||||
<%= link_to "#tab-notifications" do %>
|
|
||||||
<h3>
|
|
||||||
<%= t("proposals.show.notifications_tab") %>
|
|
||||||
(<%= @notifications.count %>)
|
|
||||||
</h3>
|
|
||||||
<% end %>
|
|
||||||
</li>
|
|
||||||
<li class="tabs-title">
|
<li class="tabs-title">
|
||||||
<%= link_to "#tab-documents" do %>
|
<%= link_to "#tab-documents" do %>
|
||||||
<h3>
|
<h3>
|
||||||
|
|||||||
@@ -51,30 +51,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="<%= dom_id(proposal) %>_votes" class="small-12 medium-3 column supports-container">
|
<div id="<%= dom_id(proposal) %>_votes" class="small-12 medium-3 column supports-container">
|
||||||
<% if proposal.successful? %>
|
|
||||||
<div class="padding text-center">
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<%= t("proposals.proposal.successful",
|
|
||||||
voting: link_to(t("proposals.proposal.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="padding text-center">
|
|
||||||
<strong><%= t("proposals.proposal.supports", count: proposal.total_votes) %></strong>
|
|
||||||
<p><%= t("proposals.proposal.archived") %></p>
|
|
||||||
</div>
|
|
||||||
<% else %>
|
|
||||||
<%= render 'legislation/proposals/votes',
|
<%= render 'legislation/proposals/votes',
|
||||||
{ proposal: proposal, vote_url: vote_legislation_process_proposal_path(proposal.legislation_process_id, proposal, value: 'yes') } %>
|
{ proposal: proposal, vote_url: vote_legislation_process_proposal_path(proposal.legislation_process_id, proposal, value: 'yes') } %>
|
||||||
<% end %>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,18 +1,6 @@
|
|||||||
<div class="supports text-center">
|
<div class="supports text-center">
|
||||||
<div class="progress small-12 round">
|
|
||||||
<span class="meter" style="width: <%= progress_bar_percentage(proposal) %>%;"></span>
|
|
||||||
<span class="percentage">
|
|
||||||
<%= supports_percentage(proposal) %> / <%= t("proposals.proposal.total_percent") %>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<span class="total-supports">
|
<span class="total-supports">
|
||||||
<%= t("proposals.proposal.supports", count: proposal.total_votes) %>
|
<%= t("proposals.proposal.supports", count: proposal.total_votes) %>
|
||||||
<span>
|
|
||||||
<abbr title="<%= t("proposals.proposal.reason_for_supports_necessary") %>">
|
|
||||||
<%= t("proposals.proposal.supports_necessary", number: number_with_delimiter(Proposal.votes_needed_for_success)) %>
|
|
||||||
</abbr>
|
|
||||||
</span>
|
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<div class="in-favor">
|
<div class="in-favor">
|
||||||
|
|||||||
@@ -22,12 +22,6 @@
|
|||||||
class: 'button hollow float-right' %>
|
class: 'button hollow float-right' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if author_of?(@proposal, current_user) %>
|
|
||||||
<%= link_to t("proposals.show.send_notification"),
|
|
||||||
new_proposal_notification_path(proposal_id: @proposal.id),
|
|
||||||
class: 'button hollow float-right' %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if current_user && @proposal.editable_by?(current_user) %>
|
<% if current_user && @proposal.editable_by?(current_user) %>
|
||||||
<%= link_to edit_legislation_process_proposal_path(@proposal.legislation_process_id, @proposal), class: 'edit-proposal button hollow float-right' do %>
|
<%= link_to edit_legislation_process_proposal_path(@proposal.legislation_process_id, @proposal), class: 'edit-proposal button hollow float-right' do %>
|
||||||
<%= t("proposals.show.edit_proposal_link") %>
|
<%= t("proposals.show.edit_proposal_link") %>
|
||||||
@@ -35,14 +29,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<h1><%= @proposal.title %></h1>
|
<h1><%= @proposal.title %></h1>
|
||||||
<% if @proposal.retired? %>
|
<% if @proposal.conflictive? %>
|
||||||
<div data-alert class="callout alert margin-top proposal-retired">
|
|
||||||
<strong>
|
|
||||||
<%= t("proposals.show.retired_warning") %><br>
|
|
||||||
<%= link_to t("proposals.show.retired_warning_link_to_explanation"), "#retired_explanation" %>
|
|
||||||
</strong>
|
|
||||||
</div>
|
|
||||||
<% elsif @proposal.conflictive? %>
|
|
||||||
<div data-alert class="callout alert margin-top">
|
<div data-alert class="callout alert margin-top">
|
||||||
<strong><%= t("proposals.show.flag") %></strong>
|
<strong><%= t("proposals.show.flag") %></strong>
|
||||||
</div>
|
</div>
|
||||||
@@ -105,13 +92,6 @@
|
|||||||
|
|
||||||
<h4><%= @proposal.question %></h4>
|
<h4><%= @proposal.question %></h4>
|
||||||
|
|
||||||
<% if @proposal.retired? %>
|
|
||||||
<div id="retired_explanation" class="callout">
|
|
||||||
<h2><%= t('proposals.show.retired') %>: <%= t("proposals.retire_options.#{@proposal.retired_reason}") unless @proposal.retired_reason == 'other' %></h2>
|
|
||||||
<%= simple_format text_with_links(@proposal.retired_explanation), {}, sanitize: false %>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<%= render 'shared/tags', taggable: @proposal %>
|
<%= render 'shared/tags', taggable: @proposal %>
|
||||||
|
|
||||||
<%= render 'shared/geozone', geozonable: @proposal %>
|
<%= render 'shared/geozone', geozonable: @proposal %>
|
||||||
@@ -125,30 +105,8 @@
|
|||||||
<div class="sidebar-divider"></div>
|
<div class="sidebar-divider"></div>
|
||||||
<h2><%= t("votes.supports") %></h2>
|
<h2><%= t("votes.supports") %></h2>
|
||||||
<div id="<%= dom_id(@proposal) %>_votes">
|
<div id="<%= dom_id(@proposal) %>_votes">
|
||||||
|
|
||||||
<% if @proposal.successful? %>
|
|
||||||
<p>
|
|
||||||
<%= t("proposals.proposal.successful",
|
|
||||||
voting: link_to(t("proposals.proposal.voting"), polls_path)).html_safe %>
|
|
||||||
</p>
|
|
||||||
<% 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 expanded" %>
|
|
||||||
</p>
|
|
||||||
<% end %>
|
|
||||||
<% elsif @proposal.archived? %>
|
|
||||||
<div class="padding text-center">
|
|
||||||
<p>
|
|
||||||
<strong><%= t("proposals.proposal.supports", count: @proposal.total_votes) %></strong>
|
|
||||||
</p>
|
|
||||||
<p><%= t("proposals.proposal.archived") %></p>
|
|
||||||
</div>
|
|
||||||
<% else %>
|
|
||||||
<%= render 'votes',
|
<%= render 'votes',
|
||||||
{ proposal: @proposal, vote_url: vote_legislation_process_proposal_path(@proposal.legislation_process_id, @proposal, value: 'yes') } %>
|
{ proposal: @proposal, vote_url: vote_legislation_process_proposal_path(@proposal.legislation_process_id, @proposal, value: 'yes') } %>
|
||||||
<% end %>
|
|
||||||
</div>
|
</div>
|
||||||
<%= render partial: 'shared/social_share', locals: {
|
<%= render partial: 'shared/social_share', locals: {
|
||||||
share_title: t("proposals.show.share"),
|
share_title: t("proposals.show.share"),
|
||||||
@@ -168,11 +126,10 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<div class="tabs-content" data-tabs-content="proposals-tabs" role="tablist">
|
<div class="tabs-content" data-tabs-content="proposals-tabs" role="tablist">
|
||||||
<%= render "proposals/filter_subnav" %>
|
<%= render "legislation/proposals/filter_subnav" %>
|
||||||
<%= render "proposals/notifications" %>
|
|
||||||
|
|
||||||
<div class="tabs-panel is-active" id="tab-comments">
|
<div class="tabs-panel is-active" id="tab-comments">
|
||||||
<%= render "proposals/comments" %>
|
<%= render "legislation/proposals/comments" %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="tabs-panel" id="tab-documents">
|
<div class="tabs-panel" id="tab-documents">
|
||||||
|
|||||||
@@ -8,11 +8,10 @@ module ActsAsTaggableOn
|
|||||||
scope :public_for_api, -> do
|
scope :public_for_api, -> do
|
||||||
where(%{taggings.tag_id in (?) and
|
where(%{taggings.tag_id in (?) and
|
||||||
(taggings.taggable_type = 'Debate' and taggings.taggable_id in (?)) or
|
(taggings.taggable_type = 'Debate' and taggings.taggable_id in (?)) or
|
||||||
(taggings.taggable_type = 'Proposal' and taggings.taggable_id in (?)) or taggings.taggable_type = 'LegislationProposal' and taggings.taggable_id in (?))},
|
(taggings.taggable_type = 'Proposal' and taggings.taggable_id in (?))},
|
||||||
Tag.where('kind IS NULL or kind = ?', 'category').pluck(:id),
|
Tag.where('kind IS NULL or kind = ?', 'category').pluck(:id),
|
||||||
Debate.public_for_api.pluck(:id),
|
Debate.public_for_api.pluck(:id),
|
||||||
Proposal.public_for_api.pluck(:id),
|
Proposal.public_for_api.pluck(:id))
|
||||||
Legislation::Proposal.public_for_api.pluck(:id))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def touch_taggable
|
def touch_taggable
|
||||||
|
|||||||
@@ -9,12 +9,12 @@ ActsAsVotable::Vote.class_eval do
|
|||||||
where(votable_type: 'Proposal', votable_id: proposals)
|
where(votable_type: 'Proposal', votable_id: proposals)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.for_spending_proposals(spending_proposals)
|
def self.for_legislation_proposals(proposals)
|
||||||
where(votable_type: 'SpendingProposal', votable_id: spending_proposals)
|
where(votable_type: 'Legislation::Proposal', votable_id: proposals)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.for_spending_proposals(spending_proposals)
|
def self.for_spending_proposals(spending_proposals)
|
||||||
where(votable_type: 'LegislationProposal', votable_id: legislation_proposals)
|
where(votable_type: 'SpendingProposal', votable_id: spending_proposals)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.for_budget_investments(budget_investments)
|
def self.for_budget_investments(budget_investments)
|
||||||
|
|||||||
@@ -132,17 +132,13 @@ Rails.application.routes.draw do
|
|||||||
resources :proposals do
|
resources :proposals do
|
||||||
member do
|
member do
|
||||||
post :vote
|
post :vote
|
||||||
post :vote_featured
|
|
||||||
put :flag
|
put :flag
|
||||||
put :unflag
|
put :unflag
|
||||||
get :retire_form
|
|
||||||
get :share
|
get :share
|
||||||
patch :retire
|
|
||||||
end
|
end
|
||||||
collection do
|
collection do
|
||||||
get :map
|
get :map
|
||||||
get :suggest
|
get :suggest
|
||||||
get :summary
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
resources :draft_versions, only: [:show] do
|
resources :draft_versions, only: [:show] do
|
||||||
|
|||||||
Reference in New Issue
Block a user