feedback PR - prettier url and other style improvement
This commit is contained in:
parent
507ea70398
commit
9595730fde
6 changed files with 33 additions and 21 deletions
|
@ -1,5 +1,5 @@
|
||||||
.fr-col-6.fr-col-md-4.fr-col-lg-3
|
.fr-col-6.fr-col-md-4.fr-col-lg-3
|
||||||
= link_to admin_procedure_procedure_labels_path(@procedure), class: 'fr-tile fr-enlarge-link' do
|
= link_to [:admin, @procedure, :procedure_labels], class: 'fr-tile fr-enlarge-link' do
|
||||||
.fr-tile__body.flex.column.align-center.justify-between
|
.fr-tile__body.flex.column.align-center.justify-between
|
||||||
- if @procedure.procedure_labels.present?
|
- if @procedure.procedure_labels.present?
|
||||||
%p.fr-badge.fr-badge--info
|
%p.fr-badge.fr-badge--info
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
module Administrateurs
|
module Administrateurs
|
||||||
class ProcedureLabelsController < AdministrateurController
|
class ProcedureLabelsController < AdministrateurController
|
||||||
before_action :retrieve_procedure
|
before_action :retrieve_procedure
|
||||||
|
before_action :retrieve_label, only: [:edit, :update, :destroy]
|
||||||
before_action :set_colors_collection, only: [:edit, :new, :create, :update]
|
before_action :set_colors_collection, only: [:edit, :new, :create, :update]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
@ -10,7 +11,6 @@ module Administrateurs
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
@label = label
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
|
@ -22,7 +22,7 @@ module Administrateurs
|
||||||
|
|
||||||
if @label.save
|
if @label.save
|
||||||
flash.notice = 'Le label a bien été créé'
|
flash.notice = 'Le label a bien été créé'
|
||||||
redirect_to admin_procedure_procedure_labels_path(@procedure)
|
redirect_to [:admin, @procedure, :procedure_labels]
|
||||||
else
|
else
|
||||||
flash.alert = @label.errors.full_messages
|
flash.alert = @label.errors.full_messages
|
||||||
render :new
|
render :new
|
||||||
|
@ -30,12 +30,9 @@ module Administrateurs
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@label = label
|
if @label.update(procedure_label_params)
|
||||||
@label.update(procedure_label_params)
|
|
||||||
|
|
||||||
if @label.valid?
|
|
||||||
flash.notice = 'Le label a bien été modifié'
|
flash.notice = 'Le label a bien été modifié'
|
||||||
redirect_to admin_procedure_procedure_labels_path(@procedure)
|
redirect_to [:admin, @procedure, :procedure_labels]
|
||||||
else
|
else
|
||||||
flash.alert = @label.errors.full_messages
|
flash.alert = @label.errors.full_messages
|
||||||
render :edit
|
render :edit
|
||||||
|
@ -43,10 +40,9 @@ module Administrateurs
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
@label = label
|
|
||||||
@label.destroy!
|
@label.destroy!
|
||||||
flash.notice = 'Le label a bien été supprimé'
|
flash.notice = 'Le label a bien été supprimé'
|
||||||
redirect_to admin_procedure_procedure_labels_path(@procedure)
|
redirect_to [:admin, @procedure, :procedure_labels]
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
@ -55,8 +51,8 @@ module Administrateurs
|
||||||
params.require(:procedure_label).permit(:name, :color)
|
params.require(:procedure_label).permit(:name, :color)
|
||||||
end
|
end
|
||||||
|
|
||||||
def label
|
def retrieve_label
|
||||||
@procedure.procedure_labels.find(params[:id])
|
@label = @procedure.procedure_labels.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_colors_collection
|
def set_colors_collection
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
= form_with model: label, url: admin_procedure_procedure_labels_path(@procedure, id: @label.id), local: true do |f|
|
= form_with model: label, url: [:admin, @procedure, @label], local: true do |f|
|
||||||
= render Dsfr::InputComponent.new(form: f, attribute: :name, input_type: :text_field, opts: { maxlength: ProcedureLabel::NAME_MAX_LENGTH})
|
= render Dsfr::InputComponent.new(form: f, attribute: :name, input_type: :text_field, opts: { maxlength: ProcedureLabel::NAME_MAX_LENGTH})
|
||||||
|
|
||||||
%fieldset.fr-fieldset
|
%fieldset.fr-fieldset
|
||||||
%legend.fr-fieldset__legend.fr-fieldset__legend--regular
|
%legend.fr-fieldset__legend.fr-fieldset__legend--regular
|
||||||
= t('activerecord.attributes.procedure_label.color')
|
= t('activerecord.attributes.procedure_label.color')
|
||||||
= render EditableChamp::AsteriskMandatoryComponent.new
|
= asterisk
|
||||||
|
|
||||||
.grid-tags
|
.grid-tags
|
||||||
- @colors_collection.each do |color|
|
- @colors_collection.each do |color|
|
||||||
|
|
|
@ -1,13 +1,17 @@
|
||||||
|
- content_for :title, "Modifier le label"
|
||||||
|
|
||||||
= render partial: 'administrateurs/breadcrumbs',
|
= render partial: 'administrateurs/breadcrumbs',
|
||||||
locals: { steps: [['Démarches', admin_procedures_path],
|
locals: { steps: [['Démarches', admin_procedures_path],
|
||||||
[@procedure.libelle.truncate_words(10), admin_procedure_path(@procedure)],
|
[@procedure.libelle.truncate_words(10), admin_procedure_path(@procedure)],
|
||||||
['gestion des labels', admin_procedure_procedure_labels_path(procedure_id: @procedure.id)],
|
['gestion des labels', [:admin, @procedure, :procedure_labels]],
|
||||||
['Modifier le label']] }
|
['Modifier le label']] }
|
||||||
|
|
||||||
|
|
||||||
.fr-container
|
.fr-container
|
||||||
.fr-mb-3w
|
.fr-mb-3w
|
||||||
= link_to "Liste de tous les labels", admin_procedure_procedure_labels_path(procedure_id: @procedure.id), class: "fr-link fr-icon-arrow-left-line fr-link--icon-left"
|
= link_to "Liste de tous les labels",
|
||||||
|
[:admin, @procedure, :procedure_labels],
|
||||||
|
class: "fr-link fr-icon-arrow-left-line fr-link--icon-left"
|
||||||
|
|
||||||
%h1.fr-h2
|
%h1.fr-h2
|
||||||
Modifier le label
|
Modifier le label
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
- content_for :title, "Labels"
|
||||||
|
|
||||||
= render partial: 'administrateurs/breadcrumbs',
|
= render partial: 'administrateurs/breadcrumbs',
|
||||||
locals: { steps: [['Démarches', admin_procedures_path],
|
locals: { steps: [['Démarches', admin_procedures_path],
|
||||||
[@procedure.libelle.truncate_words(10), admin_procedure_path(@procedure)],
|
[@procedure.libelle.truncate_words(10), admin_procedure_path(@procedure)],
|
||||||
|
@ -6,7 +8,9 @@
|
||||||
.fr-container
|
.fr-container
|
||||||
%h1.fr-h2 Labels
|
%h1.fr-h2 Labels
|
||||||
|
|
||||||
= link_to "Nouveau label", new_admin_procedure_procedure_label_path(procedure_id: @procedure.id), class: "fr-btn fr-btn--primary fr-btn--icon-left fr-icon-add-circle-line mb-3"
|
= link_to "Nouveau label",
|
||||||
|
[:new, :admin, @procedure, :procedure_label],
|
||||||
|
class: "fr-btn fr-btn--primary fr-btn--icon-left fr-icon-add-circle-line mb-3"
|
||||||
|
|
||||||
- if @procedure.procedure_labels.present?
|
- if @procedure.procedure_labels.present?
|
||||||
.fr-table.fr-table--layout-fixed.fr-table--bordered
|
.fr-table.fr-table--layout-fixed.fr-table--bordered
|
||||||
|
@ -25,9 +29,13 @@
|
||||||
%td
|
%td
|
||||||
= tag_label(label.name, label.color)
|
= tag_label(label.name, label.color)
|
||||||
%td.change
|
%td.change
|
||||||
= link_to('Modifier', edit_admin_procedure_procedure_label_path(procedure_id: @procedure.id, id: label.id), class: 'fr-btn fr-btn--sm fr-btn--secondary fr-btn--icon-left fr-icon-pencil-line')
|
|
||||||
|
= link_to 'Modifier',
|
||||||
|
[:edit, :admin, @procedure, label],
|
||||||
|
class: 'fr-btn fr-btn--sm fr-btn--secondary fr-btn--icon-left fr-icon-pencil-line'
|
||||||
|
|
||||||
= link_to 'Supprimer',
|
= link_to 'Supprimer',
|
||||||
admin_procedure_procedure_label_path(procedure_id: @procedure.id, id: label.id),
|
[:admin, @procedure, label],
|
||||||
method: :delete,
|
method: :delete,
|
||||||
data: { confirm: "Confirmez vous la suppression de #{label.name}" },
|
data: { confirm: "Confirmez vous la suppression de #{label.name}" },
|
||||||
class: 'fr-btn fr-btn--sm fr-btn--secondary fr-btn--icon-left fr-icon-delete-line fr-ml-1w'
|
class: 'fr-btn fr-btn--sm fr-btn--secondary fr-btn--icon-left fr-icon-delete-line fr-ml-1w'
|
||||||
|
|
|
@ -1,13 +1,17 @@
|
||||||
|
- content_for :title, "Nouveau label"
|
||||||
|
|
||||||
= render partial: 'administrateurs/breadcrumbs',
|
= render partial: 'administrateurs/breadcrumbs',
|
||||||
locals: { steps: [['Démarches', admin_procedures_path],
|
locals: { steps: [['Démarches', admin_procedures_path],
|
||||||
[@procedure.libelle.truncate_words(10), admin_procedure_path(@procedure)],
|
[@procedure.libelle.truncate_words(10), admin_procedure_path(@procedure)],
|
||||||
['gestion des labels', admin_procedure_procedure_labels_path(procedure_id: @procedure.id)],
|
['gestion des labels', [:admin, @procedure, :procedure_labels]],
|
||||||
['Nouveau label']] }
|
['Nouveau label']] }
|
||||||
|
|
||||||
|
|
||||||
.fr-container
|
.fr-container
|
||||||
.fr-mb-3w
|
.fr-mb-3w
|
||||||
= link_to "Liste de tous les labels", admin_procedure_procedure_labels_path(procedure_id: @procedure.id), class: "fr-link fr-icon-arrow-left-line fr-link--icon-left"
|
= link_to "Liste de tous les labels",
|
||||||
|
[:admin, @procedure, :procedure_labels],
|
||||||
|
class: "fr-link fr-icon-arrow-left-line fr-link--icon-left"
|
||||||
|
|
||||||
%h1.fr-h2
|
%h1.fr-h2
|
||||||
Créer un nouveau label
|
Créer un nouveau label
|
||||||
|
|
Loading…
Reference in a new issue