Replace old open_phase? method for new phase/publication open? on Legislative Process

This commit is contained in:
Bertocq
2017-06-13 20:33:41 +02:00
parent 12dc7a4790
commit 523988a291
8 changed files with 9 additions and 9 deletions

View File

@@ -29,7 +29,7 @@ class Legislation::AnnotationsController < ApplicationController
end
def create
if !@process.open_phase?(:allegations) || @draft_version.final_version?
if !@process.allegations_phase.open? || @draft_version.final_version?
render json: {}, status: :not_found and return
end

View File

@@ -9,7 +9,7 @@ class Legislation::AnswersController < Legislation::BaseController
respond_to :html, :js
def create
if @process.open_phase?(:debate)
if @process.debate_phase.open?
@answer.user = current_user
@answer.save
track_event

View File

@@ -37,6 +37,6 @@ class Legislation::Question < ActiveRecord::Base
end
def comments_open?
process.open_phase?(:debate)
process.debate_phase.open?
end
end

View File

@@ -15,12 +15,12 @@
<% end %>
<% end %>
<% if @process.open_phase?(:allegations) %>
<% if @process.allegations_phase.open? %>
<a class="button publish-comment" href="#"><strong><%= t('legislation.annotations.comments.publish_comment') %></strong></a>
&nbsp;
<% end %>
<% if @process.open_phase?(:allegations) %>
<% if @process.allegations_phase.open? %>
<% if user_signed_in? %>
<% css_id = parent_or_commentable_dom_id(nil, annotation) %>
<div id="js-comment-form-annotation-<%= annotation.id %>" style="display:none" class="comment-form js-comment-form-annotation">

View File

@@ -6,7 +6,7 @@
<div class="comments-wrapper">
<div class="comment-input">
<% if !@process.open_phase?(:allegations) %>
<% if !@process.allegations_phase.open? %>
<div data-alert class="callout primary">
<%= t("legislation.annotations.form.phase_not_open") %>
</div>

View File

@@ -60,7 +60,7 @@
<section class="legislation-annotatable"
data-legislation-draft-version-id="<%= @draft_version.id %>"
data-legislation-annotatable-base-url="<%= legislation_process_draft_version_path(@process, @draft_version) %>"
data-legislation-open-phase="<%= @process.open_phase?(:allegations) %>"
data-legislation-open-phase="<%= @process.allegations_phase.open? %>"
>
<% end %>
<%= @draft_version.body_html.html_safe %>

View File

@@ -1,5 +1,5 @@
<% if question.question_options.any? %>
<% if process.open_phase?(:debate) && !answer.persisted? %>
<% if process.debate_phase.open? && !answer.persisted? %>
<%= form_for answer, url: legislation_process_question_answers_path(process, question, answer), remote: true , html: { class: "controls-stacked"} do |f| %>
<% question.question_options.each do |question_option| %>

View File

@@ -17,7 +17,7 @@
signin: link_to(t("legislation.questions.participation.signin"), new_user_session_path),
signup: link_to(t("legislation.questions.participation.signup"), new_user_registration_path)).html_safe %>
</div>
<% elsif !@process.open_phase?(:debate) %>
<% elsif !@process.debate_phase.open? %>
<div class="participation-not-allowed" style='display:none' aria-hidden="false">
<%= t("legislation.questions.participation.debate_phase_not_open") %>
</div>