feat(demarche): enable revisions for all
This commit is contained in:
parent
885d4ea997
commit
a760e0a698
7 changed files with 2 additions and 32 deletions
|
@ -6,10 +6,6 @@ class Procedure::Card::AnnotationsComponent < ApplicationComponent
|
|||
|
||||
private
|
||||
|
||||
def render?
|
||||
!@procedure.locked? || @procedure.feature_enabled?(:procedure_revisions)
|
||||
end
|
||||
|
||||
def error_messages
|
||||
@procedure.errors.messages_for(:draft_types_de_champ_private).to_sentence
|
||||
end
|
||||
|
|
|
@ -6,10 +6,6 @@ class Procedure::Card::ChampsComponent < ApplicationComponent
|
|||
|
||||
private
|
||||
|
||||
def render?
|
||||
!@procedure.locked? || @procedure.feature_enabled?(:procedure_revisions)
|
||||
end
|
||||
|
||||
def error_messages
|
||||
[
|
||||
@procedure.errors.messages_for(:draft_types_de_champ_public),
|
||||
|
|
|
@ -15,13 +15,6 @@ class AdminController < ApplicationController
|
|||
redirect_to admin_procedures_path, status: 404
|
||||
end
|
||||
|
||||
def procedure_locked?
|
||||
if @procedure.locked?
|
||||
flash.alert = 'Démarche verrouillée'
|
||||
redirect_to admin_procedure_path(id: @procedure.id)
|
||||
end
|
||||
end
|
||||
|
||||
def reset_procedure
|
||||
if @procedure.brouillon?
|
||||
@procedure.reset!
|
||||
|
|
|
@ -12,20 +12,6 @@ module Administrateurs
|
|||
redirect_to admin_procedures_path, status: 404
|
||||
end
|
||||
|
||||
def procedure_locked?
|
||||
if @procedure.locked?
|
||||
flash.alert = 'Démarche verrouillée'
|
||||
redirect_to admin_procedure_path(@procedure)
|
||||
end
|
||||
end
|
||||
|
||||
def procedure_revisable?
|
||||
if @procedure.locked? && !@procedure.feature_enabled?(:procedure_revisions)
|
||||
flash.alert = 'Démarche verrouillée'
|
||||
redirect_to admin_procedure_path(@procedure)
|
||||
end
|
||||
end
|
||||
|
||||
def reset_procedure
|
||||
if @procedure.brouillon? || @procedure.draft_changed?
|
||||
@procedure.reset!
|
||||
|
|
|
@ -3,7 +3,6 @@ module Administrateurs
|
|||
layout 'all', only: [:all, :administrateurs]
|
||||
|
||||
before_action :retrieve_procedure, only: [:champs, :annotations, :modifications, :edit, :zones, :monavis, :update_monavis, :jeton, :update_jeton, :publication, :publish, :transfert, :close, :allow_expert_review, :experts_require_administrateur_invitation, :reset_draft]
|
||||
before_action :procedure_revisable?, only: [:champs, :annotations, :modifications, :reset_draft]
|
||||
before_action :draft_valid?, only: [:apercu]
|
||||
|
||||
ITEMS_PER_PAGE = 25
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module Administrateurs
|
||||
class TypesDeChampController < AdministrateurController
|
||||
before_action :retrieve_procedure, :procedure_revisable?
|
||||
before_action :retrieve_procedure
|
||||
|
||||
def create
|
||||
type_de_champ = draft.add_type_de_champ(type_de_champ_create_params)
|
||||
|
|
|
@ -681,7 +681,7 @@ class Procedure < ApplicationRecord
|
|||
end
|
||||
|
||||
def revised?
|
||||
feature_enabled?(:procedure_revisions) && revisions.size > 2
|
||||
revisions.size > 2
|
||||
end
|
||||
|
||||
def revisions_count
|
||||
|
|
Loading…
Reference in a new issue