Set legislation processes visibility depending on publication
This commit is contained in:
@@ -4,7 +4,7 @@ class Legislation::ProcessesController < Legislation::BaseController
|
||||
|
||||
def index
|
||||
@current_filter ||= 'open'
|
||||
@processes = ::Legislation::Process.send(@current_filter).page(params[:page])
|
||||
@processes = ::Legislation::Process.send(@current_filter).published.page(params[:page])
|
||||
end
|
||||
|
||||
def show
|
||||
|
||||
@@ -19,7 +19,7 @@ module Abilities
|
||||
can [:read, :print], Budget::Investment
|
||||
can :read_results, Budget, phase: "finished"
|
||||
can :new, DirectMessage
|
||||
can [:read, :debate, :draft_publication, :allegations, :result_publication], Legislation::Process
|
||||
can [:read, :debate, :draft_publication, :allegations, :result_publication], Legislation::Process, published: true
|
||||
can [:read, :changes, :go_to_version], Legislation::DraftVersion
|
||||
can [:read], Legislation::Question
|
||||
can [:create], Legislation::Answer
|
||||
|
||||
@@ -21,6 +21,8 @@ class Legislation::Process < ActiveRecord::Base
|
||||
scope :next, -> { where("start_date > ?", Date.current).order('id DESC') }
|
||||
scope :past, -> { where("end_date < ?", Date.current).order('id DESC') }
|
||||
|
||||
scope :published, -> { where(published: true) }
|
||||
|
||||
def debate_phase
|
||||
Legislation::Process::Phase.new(debate_start_date, debate_end_date, debate_phase_enabled)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user