Merge pull request #8133 from tchak/feat-enable-revisions-for-all

feat(demarche): enable revisions for all
This commit is contained in:
Paul Chavard 2022-11-24 17:42:06 +01:00 committed by GitHub
commit faa75298d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 2 additions and 32 deletions

View file

@ -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

View file

@ -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),

View file

@ -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!

View file

@ -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!

View file

@ -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

View file

@ -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)

View file

@ -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