forked from demarches-simplifiees/demarches-simplifiees.fr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request demarches-simplifiees#9664 from adullact/feature-o…
…uidou/admin_creation_delegation_follow_commentaire ETQ gestionnaire, j'ai un suivi des messages au sein de mes groupes
- Loading branch information
Showing
35 changed files
with
412 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.fr-groupe_gestionnaire_cards { | ||
.fr-h6 { | ||
padding-left: 20px; | ||
padding-right: 20px; | ||
position: relative; | ||
} | ||
|
||
.notifications { | ||
top: 3px; | ||
right: 3px; | ||
} | ||
} |
3 changes: 2 additions & 1 deletion
3
app/components/groupe_gestionnaire/card/administrateurs_component.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
class GroupeGestionnaire::Card::AdministrateursComponent < ApplicationComponent | ||
def initialize(groupe_gestionnaire:, path:) | ||
def initialize(groupe_gestionnaire:, path:, is_gestionnaire: true) | ||
@groupe_gestionnaire = groupe_gestionnaire | ||
@path = path | ||
@is_gestionnaire = is_gestionnaire | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
app/components/groupe_gestionnaire/card/commentaires_component.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
...mponents/groupe_gestionnaire/card/commentaires_component/commentaires_component.html.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
.fr-col-6.fr-col-md-4.fr-col-lg-3 | ||
= link_to @path, id: 'administrateurs', class: 'fr-tile fr-enlarge-link' do | ||
= link_to @path, id: 'commentaires', class: 'fr-tile fr-enlarge-link' do | ||
.fr-tile__body.flex.column.align-center.justify-between | ||
%p.fr-badge.fr-badge--success Validé | ||
%div | ||
.line-count.fr-my-1w | ||
%p.fr-tag= number_commentaires | ||
%h3.fr-h6 | ||
- if @unread_commentaires | ||
%span.notifications{ 'aria-label': 'notifications' } | ||
= t('.title', count: number_commentaires) | ||
%p.fr-btn.fr-btn--tertiary= t('views.shared.actions.see') |
3 changes: 2 additions & 1 deletion
3
app/components/groupe_gestionnaire/card/gestionnaires_component.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
class GroupeGestionnaire::Card::GestionnairesComponent < ApplicationComponent | ||
def initialize(groupe_gestionnaire:, path:) | ||
def initialize(groupe_gestionnaire:, path:, is_gestionnaire: true) | ||
@groupe_gestionnaire = groupe_gestionnaire | ||
@path = path | ||
@is_gestionnaire = is_gestionnaire | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
...oupe_gestionnaire_list_commentaires/commentaire_component/commentaire_component.html.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
%tr{ id: dom_id(@commentaire) } | ||
%td= email | ||
%td | ||
- if highlight? | ||
%span.notifications{ 'aria-label': 'notifications' } | ||
%td= created_at | ||
%td= see_button |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
class Gestionnaires::ActivateController < ApplicationController | ||
include TrustedDeviceConcern | ||
|
||
def new | ||
@token = params[:token] | ||
|
||
user = User.with_reset_password_token(@token) | ||
@gestionnaire = user&.gestionnaire | ||
|
||
if @gestionnaire | ||
# the gestionnaire activates its account from an email | ||
trust_device(Time.zone.now) | ||
else | ||
flash.alert = "Le lien de validation de gestionnaire a expiré, #{helpers.contact_link('contactez-nous', tags: 'lien expiré')} pour obtenir un nouveau lien." | ||
redirect_to root_path | ||
end | ||
end | ||
|
||
def create | ||
password = update_gestionnaire_params[:password] | ||
|
||
user = User.reset_password_by_token({ | ||
password: password, | ||
password_confirmation: password, | ||
reset_password_token: update_gestionnaire_params[:reset_password_token] | ||
}) | ||
|
||
if user&.errors&.empty? | ||
sign_in(user, scope: :user) | ||
|
||
flash.notice = "Mot de passe enregistré" | ||
redirect_to gestionnaire_groupe_gestionnaires_path | ||
else | ||
flash.alert = user.errors.full_messages | ||
redirect_to gestionnaires_activate_path(token: update_gestionnaire_params[:reset_password_token]) | ||
end | ||
end | ||
|
||
private | ||
|
||
def update_gestionnaire_params | ||
params.require(:gestionnaire).permit(:reset_password_token, :password) | ||
end | ||
|
||
def try_to_authenticate(klass, email, password) | ||
resource = klass.find_for_database_authentication(email: email) | ||
|
||
if resource&.valid_password?(password) | ||
sign_in resource | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class FollowCommentaireGroupeGestionnaire < ApplicationRecord | ||
belongs_to :gestionnaire | ||
belongs_to :groupe_gestionnaire | ||
belongs_to :sender, polymorphic: true, optional: true | ||
|
||
validates :gestionnaire_id, uniqueness: { scope: [:groupe_gestionnaire_id, :sender_id, :sender_type, :unfollowed_at] } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
- content_for(:title, t('.title')) | ||
|
||
- content_for :footer do | ||
= render partial: "root/footer" | ||
|
||
.fr-container.fr-my-5w | ||
.fr-grid-row.fr-grid-row--center | ||
.fr-col-lg-6 | ||
= form_for @gestionnaire, url: { controller: 'gestionnaires/activate', action: :create } do |f| | ||
= f.hidden_field :reset_password_token, value: @token | ||
|
||
%fieldset.fr-mb-0.fr-fieldset{ aria: { labelledby: 'edit-password-legend' } } | ||
%legend.fr-fieldset__legend#edit-password-legend | ||
%h1.fr-h2= t('.title') | ||
|
||
.fr-fieldset__element | ||
= render Dsfr::InputComponent.new(form: f, attribute: :email, opts: { disabled: true }) | ||
|
||
.fr-fieldset__element | ||
= render Dsfr::InputComponent.new(form: f, attribute: :password, input_type: :password_field, | ||
opts: { autofocus: 'true', autocomplete: 'new-password', data: { controller: 'turbo-input', turbo_input_url_value: show_password_complexity_path }}) | ||
|
||
#password_complexity | ||
= render PasswordComplexityComponent.new | ||
|
||
= f.submit t('.continue'), id: 'submit-password', class: "fr-btn fr-btn--lg fr-mt-2w", data: { disable_with: t('views.users.passwords.edit.submit_loading') } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.