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
|
||||
= 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
|
||||
- if @procedure.procedure_labels.present?
|
||||
%p.fr-badge.fr-badge--info
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
module Administrateurs
|
||||
class ProcedureLabelsController < AdministrateurController
|
||||
before_action :retrieve_procedure
|
||||
before_action :retrieve_label, only: [:edit, :update, :destroy]
|
||||
before_action :set_colors_collection, only: [:edit, :new, :create, :update]
|
||||
|
||||
def index
|
||||
|
@ -10,7 +11,6 @@ module Administrateurs
|
|||
end
|
||||
|
||||
def edit
|
||||
@label = label
|
||||
end
|
||||
|
||||
def new
|
||||
|
@ -22,7 +22,7 @@ module Administrateurs
|
|||
|
||||
if @label.save
|
||||
flash.notice = 'Le label a bien été créé'
|
||||
redirect_to admin_procedure_procedure_labels_path(@procedure)
|
||||
redirect_to [:admin, @procedure, :procedure_labels]
|
||||
else
|
||||
flash.alert = @label.errors.full_messages
|
||||
render :new
|
||||
|
@ -30,12 +30,9 @@ module Administrateurs
|
|||
end
|
||||
|
||||
def update
|
||||
@label = label
|
||||
@label.update(procedure_label_params)
|
||||
|
||||
if @label.valid?
|
||||
if @label.update(procedure_label_params)
|
||||
flash.notice = 'Le label a bien été modifié'
|
||||
redirect_to admin_procedure_procedure_labels_path(@procedure)
|
||||
redirect_to [:admin, @procedure, :procedure_labels]
|
||||
else
|
||||
flash.alert = @label.errors.full_messages
|
||||
render :edit
|
||||
|
@ -43,10 +40,9 @@ module Administrateurs
|
|||
end
|
||||
|
||||
def destroy
|
||||
@label = label
|
||||
@label.destroy!
|
||||
flash.notice = 'Le label a bien été supprimé'
|
||||
redirect_to admin_procedure_procedure_labels_path(@procedure)
|
||||
redirect_to [:admin, @procedure, :procedure_labels]
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -55,8 +51,8 @@ module Administrateurs
|
|||
params.require(:procedure_label).permit(:name, :color)
|
||||
end
|
||||
|
||||
def label
|
||||
@procedure.procedure_labels.find(params[:id])
|
||||
def retrieve_label
|
||||
@label = @procedure.procedure_labels.find(params[:id])
|
||||
end
|
||||
|
||||
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})
|
||||
|
||||
%fieldset.fr-fieldset
|
||||
%legend.fr-fieldset__legend.fr-fieldset__legend--regular
|
||||
= t('activerecord.attributes.procedure_label.color')
|
||||
= render EditableChamp::AsteriskMandatoryComponent.new
|
||||
= asterisk
|
||||
|
||||
.grid-tags
|
||||
- @colors_collection.each do |color|
|
||||
|
|
|
@ -1,13 +1,17 @@
|
|||
- content_for :title, "Modifier le label"
|
||||
|
||||
= render partial: 'administrateurs/breadcrumbs',
|
||||
locals: { steps: [['Démarches', admin_procedures_path],
|
||||
[@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']] }
|
||||
|
||||
|
||||
.fr-container
|
||||
.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
|
||||
Modifier le label
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
- content_for :title, "Labels"
|
||||
|
||||
= render partial: 'administrateurs/breadcrumbs',
|
||||
locals: { steps: [['Démarches', admin_procedures_path],
|
||||
[@procedure.libelle.truncate_words(10), admin_procedure_path(@procedure)],
|
||||
|
@ -6,7 +8,9 @@
|
|||
.fr-container
|
||||
%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?
|
||||
.fr-table.fr-table--layout-fixed.fr-table--bordered
|
||||
|
@ -25,9 +29,13 @@
|
|||
%td
|
||||
= tag_label(label.name, label.color)
|
||||
%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',
|
||||
admin_procedure_procedure_label_path(procedure_id: @procedure.id, id: label.id),
|
||||
[:admin, @procedure, label],
|
||||
method: :delete,
|
||||
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'
|
||||
|
|
|
@ -1,13 +1,17 @@
|
|||
- content_for :title, "Nouveau label"
|
||||
|
||||
= render partial: 'administrateurs/breadcrumbs',
|
||||
locals: { steps: [['Démarches', admin_procedures_path],
|
||||
[@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']] }
|
||||
|
||||
|
||||
.fr-container
|
||||
.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
|
||||
Créer un nouveau label
|
||||
|
|
Loading…
Reference in a new issue