-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Amélioration de l’explication de la permission pour changer un agent de service #4903
base: production
Are you sure you want to change the base?
Changes from all commits
fffe446
3cf9d7f
ae1e066
18a6d2c
97e9d2a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,37 +4,46 @@ h1 | |
= @agent.full_name_or_email | ||
|
||
.container-fluid | ||
- if Agent::TerritoryPolicy.new(current_agent, current_territory).allow_to_manage_access_rights? | ||
.card.m-2.rounded | ||
h2.card-header | ||
= t(".agent_services_legend") | ||
= simple_form_for @agent, url: update_services_admin_territory_agent_path(current_territory, @agent) do |f| | ||
.card-body | ||
= f.input :service_ids, collection: current_territory.services, | ||
label: t(".services"), | ||
label_method: :name, | ||
input_html: { \ | ||
multiple: true, \ | ||
class: "select2-input",\ | ||
} | ||
.card-footer | ||
.row | ||
.col.text-right | ||
= f.submit class: "btn btn-primary", value: "Enregistrer les services" | ||
- can_edit_services = Agent::TerritoryPolicy.new(current_agent, current_territory).allow_to_manage_access_rights? | ||
.card.m-2.rounded | ||
h2.card-header | ||
= t(".agent_services_legend") | ||
= simple_form_for @agent, url: update_services_admin_territory_agent_path(current_territory, @agent) do |f| | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. c'est assez verbeux de mettre le formulaire en entier alors que l'agent ne peut pas s'en servir. Est-ce qu'on pourrait se contenter de mettre le texte d'info qui explique que l'agent n'a pas les permissions suffisances pour gérer les droits d'accès ? |
||
.card-body | ||
= f.input :service_ids, collection: current_territory.services, | ||
label: t(".services"), | ||
label_method: :name, | ||
input_html: { \ | ||
multiple: true, \ | ||
class: "select2-input",\ | ||
}, | ||
disabled: !can_edit_services | ||
.card-footer | ||
.row | ||
.col.text-right | ||
- if can_edit_services | ||
= f.submit class: "btn btn-primary", value: "Enregistrer les services", disabled: !can_edit_services | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. je crois que le disabled n'est plus nécessaire ici |
||
- else | ||
.fr-mb-0.fr-text--sm.text-muted | ||
| Vous n’avez pas les droits nécessaires pour modifier les services des agents | ||
|
||
- if Agent::AgentTerritorialAccessRightPolicy.new(current_agent, @agent.agent_territorial_access_rights.find_by(territory: current_territory)).edit? | ||
.card.m-2.rounded | ||
h2.card-header | ||
= t(".agent_access_rights_legend") | ||
= simple_form_for @agent.agent_territorial_access_rights.find_by(territory: current_territory), url: admin_territory_agent_territorial_access_right_path do |f| | ||
.card-body | ||
= f.input :allow_to_manage_teams, as: :boolean, hint: t(".hint_allow_to_manage_teams") | ||
= f.input :allow_to_manage_access_rights, as: :boolean, hint: t(".hint_allow_to_manage_access_rights") | ||
= f.input :allow_to_invite_agents, as: :boolean, hint: t(".hint_allow_to_invite_agents") | ||
.card-footer | ||
.row | ||
.col.text-right | ||
= f.submit class: "btn btn-primary", value: "Enregistrer les droits d'accès" | ||
- can_edit_access_rights = Agent::AgentTerritorialAccessRightPolicy.new(current_agent, @agent.agent_territorial_access_rights.find_by(territory: current_territory)).edit? | ||
.card.m-2.rounded | ||
h2.card-header | ||
= t(".agent_access_rights_legend") | ||
= simple_form_for @agent.agent_territorial_access_rights.find_by(territory: current_territory), url: admin_territory_agent_territorial_access_right_path do |f| | ||
.card-body | ||
= f.input :allow_to_manage_teams, as: :boolean, hint: t(".hint_allow_to_manage_teams"), disabled: !can_edit_access_rights | ||
= f.input :allow_to_manage_access_rights, as: :boolean, hint: t(".hint_allow_to_manage_access_rights"), disabled: !can_edit_access_rights | ||
= f.input :allow_to_invite_agents, as: :boolean, hint: t(".hint_allow_to_invite_agents"), disabled: !can_edit_access_rights | ||
.card-footer | ||
.row | ||
.col.text-right | ||
- if can_edit_access_rights | ||
= f.submit class: "btn btn-primary", value: "Enregistrer les droits d'accès", disabled: !can_edit_access_rights | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. idem |
||
- else | ||
.fr-mb-0.fr-text--sm.text-muted | ||
| Vous n’avez pas les droits nécessaires pour modifier les droits d’accès des agents | ||
|
||
- if Agent::AgentTerritorialRolePolicy.new(current_agent, AgentTerritorialRole.new(agent: @agent, territory: current_territory)).create_or_destroy? | ||
.card.m-2.rounded.agent-territorial | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c'est un joli détail d'avoir fait ce
if
😍 . Tant qu'à faire, pour rendre ce cas un petit peu plus joli on pourrait même inliner le nom du service :