Display membership
This commit is contained in:
1 parent
4a6ca8b569
commit
491457c50e
4 files changed
+86
-6
No files matched your search
+1
-1
@@ -23,7 +23,7 @@ class Netig
|
||||
password_label "Mot de passe"
|
||||
login_button "Se connecter"
|
||||
|
||||
login_notice_flash "Vous êtes maintenant connecté."
|
||||
login_notice_flash nil
|
||||
login_error_flash "La connexion a échoué."
|
||||
|
||||
attempt_to_login_to_unverified_account_error_flash(
|
||||
|
||||
@@ -305,9 +305,14 @@ summary:focus-visible {
|
||||
display: inline-block;
|
||||
padding: 10px 16px;
|
||||
border: 2px solid var(--color-accent);
|
||||
border-radius: 0;
|
||||
background: var(--color-accent);
|
||||
color: var(--color-background);
|
||||
font: inherit;
|
||||
font-weight: 700;
|
||||
line-height: 1.4;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
transition: filter 0.2s ease;
|
||||
}
|
||||
|
||||
|
||||
+34
-2
@@ -2,15 +2,47 @@ class Netig
|
||||
hash_branch "account" do |r|
|
||||
rodauth.require_account
|
||||
|
||||
member = DB[:members]
|
||||
.where(account_id: rodauth.session_value)
|
||||
.first
|
||||
|
||||
r.halt [404, {}, ["Fiche membre introuvable."]] unless member
|
||||
|
||||
@page_title = "Mon espace — NETig"
|
||||
@page_description = "Gérez vos informations personnelles, suivez votre adhésion et retrouvez les services NETig accessibles."
|
||||
@page_description = "Consultez vos informations personnelles et suivez votre adhésion à l'association NETig."
|
||||
@canonical_url = "https://netig.net/account"
|
||||
|
||||
r.is do
|
||||
r.get do
|
||||
@membership = DB[:memberships]
|
||||
.where(member_id: member[:id])
|
||||
.order(Sequel.desc(:requested_at), Sequel.desc(:id))
|
||||
.first
|
||||
|
||||
view "account"
|
||||
end
|
||||
end
|
||||
|
||||
r.post "membership" do
|
||||
active_membership = DB[:memberships]
|
||||
.where(
|
||||
member_id: member[:id],
|
||||
status: %w[pending accepted]
|
||||
)
|
||||
.first
|
||||
|
||||
if active_membership
|
||||
flash["error"] = "Une demande d'adhésion est déjà en cours ou acceptée."
|
||||
else
|
||||
begin
|
||||
DB[:memberships].insert(member_id: member[:id])
|
||||
flash["notice"] = "Votre demande d'adhésion a été transmise au Noyau."
|
||||
rescue Sequel::UniqueConstraintViolation
|
||||
flash["error"] = "Une demande d'adhésion est déjà en cours."
|
||||
end
|
||||
end
|
||||
|
||||
r.redirect "/account"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
+46
-3
@@ -1,7 +1,48 @@
|
||||
<section class="page-section">
|
||||
<div class="content">
|
||||
<div class="content page-panel">
|
||||
<h1>Mon espace</h1>
|
||||
<p>Retrouvez vos informations personnelles et gérez votre adhésion.</p>
|
||||
|
||||
<% if flash["notice"] || flash["error"] %>
|
||||
<div class="flash-container">
|
||||
<% if notice = flash["notice"] %>
|
||||
<p class="flash flash--notice" role="status"><%= notice %></p>
|
||||
<% end %>
|
||||
|
||||
<% if error = flash["error"] %>
|
||||
<p class="flash flash--error" role="alert"><%= error %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<p>
|
||||
Retrouvez vos informations personnelles et suivez votre adhésion.
|
||||
</p>
|
||||
|
||||
<section aria-labelledby="membership-heading">
|
||||
<h2 id="membership-heading">Mon adhésion</h2>
|
||||
|
||||
<% if @membership.nil? %>
|
||||
<p>Vous n'avez pas encore demandé à adhérer à NETig.</p>
|
||||
|
||||
<% elsif @membership[:status] == "pending" %>
|
||||
<p>Votre demande d'adhésion est en cours d'examen par le Noyau.</p>
|
||||
|
||||
<% elsif @membership[:status] == "accepted" %>
|
||||
<p>Votre adhésion à NETig est acceptée.</p>
|
||||
|
||||
<% elsif @membership[:status] == "rejected" %>
|
||||
<p>Votre demande d'adhésion a été refusée.</p>
|
||||
<% end %>
|
||||
|
||||
<% if @membership.nil? || @membership[:status] == "rejected" %>
|
||||
<form action="/account/membership" method="post">
|
||||
<%== rodauth.csrf_tag %>
|
||||
<button class="button" type="submit">
|
||||
Demander à adhérer
|
||||
</button>
|
||||
</form>
|
||||
<% end %>
|
||||
</section>
|
||||
|
||||
<% if core_member? %>
|
||||
<section aria-labelledby="core-heading">
|
||||
@@ -11,7 +52,9 @@
|
||||
Accédez aux outils de gestion et de travail collectif du Noyau.
|
||||
</p>
|
||||
|
||||
<a href="/noyau">Espace du Noyau →</a>
|
||||
<a class="button button--secondary" href="/noyau">
|
||||
Espace du Noyau →
|
||||
</a>
|
||||
</section>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user