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
|
private
|
||||||
|
|
||||||
def render?
|
|
||||||
!@procedure.locked? || @procedure.feature_enabled?(:procedure_revisions)
|
|
||||||
end
|
|
||||||
|
|
||||||
def error_messages
|
def error_messages
|
||||||
@procedure.errors.messages_for(:draft_types_de_champ_private).to_sentence
|
@procedure.errors.messages_for(:draft_types_de_champ_private).to_sentence
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,10 +6,6 @@ class Procedure::Card::ChampsComponent < ApplicationComponent
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def render?
|
|
||||||
!@procedure.locked? || @procedure.feature_enabled?(:procedure_revisions)
|
|
||||||
end
|
|
||||||
|
|
||||||
def error_messages
|
def error_messages
|
||||||
[
|
[
|
||||||
@procedure.errors.messages_for(:draft_types_de_champ_public),
|
@procedure.errors.messages_for(:draft_types_de_champ_public),
|
||||||
|
|
|
@ -15,13 +15,6 @@ class AdminController < ApplicationController
|
||||||
redirect_to admin_procedures_path, status: 404
|
redirect_to admin_procedures_path, status: 404
|
||||||
end
|
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
|
def reset_procedure
|
||||||
if @procedure.brouillon?
|
if @procedure.brouillon?
|
||||||
@procedure.reset!
|
@procedure.reset!
|
||||||
|
|
|
@ -12,20 +12,6 @@ module Administrateurs
|
||||||
redirect_to admin_procedures_path, status: 404
|
redirect_to admin_procedures_path, status: 404
|
||||||
end
|
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
|
def reset_procedure
|
||||||
if @procedure.brouillon? || @procedure.draft_changed?
|
if @procedure.brouillon? || @procedure.draft_changed?
|
||||||
@procedure.reset!
|
@procedure.reset!
|
||||||
|
|
|
@ -3,7 +3,6 @@ module Administrateurs
|
||||||
layout 'all', only: [:all, :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 :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]
|
before_action :draft_valid?, only: [:apercu]
|
||||||
|
|
||||||
ITEMS_PER_PAGE = 25
|
ITEMS_PER_PAGE = 25
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
module Administrateurs
|
module Administrateurs
|
||||||
class TypesDeChampController < AdministrateurController
|
class TypesDeChampController < AdministrateurController
|
||||||
before_action :retrieve_procedure, :procedure_revisable?
|
before_action :retrieve_procedure
|
||||||
|
|
||||||
def create
|
def create
|
||||||
type_de_champ = draft.add_type_de_champ(type_de_champ_create_params)
|
type_de_champ = draft.add_type_de_champ(type_de_champ_create_params)
|
||||||
|
|
|
@ -681,7 +681,7 @@ class Procedure < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def revised?
|
def revised?
|
||||||
feature_enabled?(:procedure_revisions) && revisions.size > 2
|
revisions.size > 2
|
||||||
end
|
end
|
||||||
|
|
||||||
def revisions_count
|
def revisions_count
|
||||||
|
|
Loading…
Reference in a new issue