]> Raphaël G. Git Repositories - userbundle/commitdiff
Add user bundle templates
authorRaphaël Gertz <git@rapsys.eu>
Thu, 31 Oct 2024 06:05:07 +0000 (07:05 +0100)
committerRaphaël Gertz <git@rapsys.eu>
Thu, 31 Oct 2024 06:05:07 +0000 (07:05 +0100)
templates/_footer.html.twig [new file with mode: 0644]
templates/_message.html.twig [new file with mode: 0644]
templates/base.html.twig [new file with mode: 0644]
templates/index.html.twig [new file with mode: 0644]
templates/login.html.twig [new file with mode: 0644]
templates/recover.html.twig [new file with mode: 0644]
templates/register.html.twig [new file with mode: 0644]

diff --git a/templates/_footer.html.twig b/templates/_footer.html.twig
new file mode 100644 (file)
index 0000000..8df1ba8
--- /dev/null
@@ -0,0 +1,17 @@
+<footer id="rapsysuser_footer">
+       {% if alternates is defined and alternates %}
+               {% set langs = alternates|keys|filter(v => v|length == 5) %}
+               {% if langs|length > 1 %}
+                       <ul>
+                               {% for lang in langs %}
+                                       <li><a href="{{ alternates[lang].relative }}" hreflang="{{ lang|replace({'_': '-'}) }}" title="{{ alternates[lang].title }}">{{ alternates[lang].translated }}</a></li>
+                               {% endfor %}
+                       </ul>
+               {% else %}
+                       {% set lang = langs|first %}
+                       <a href="{{ alternates[lang].relative }}" hreflang="{{ lang|replace({'_': '-'}) }}" title="{{ alternates[lang].title }}">{{ alternates[lang].translated }}</a>
+               {% endif %}
+       {% else %}
+               <span>&nbsp;</span>
+       {% endif %}
+</footer>
diff --git a/templates/_message.html.twig b/templates/_message.html.twig
new file mode 100644 (file)
index 0000000..525992c
--- /dev/null
@@ -0,0 +1,12 @@
+{# pass an array argument to get the messages of those types (['warning', 'error']) #}
+{% for label, messages in app.flashes %}
+       {% if messages %}
+               <section class="message {{label}}">
+                       <ul>
+                               {% for message in messages %}
+                                       <li>{{ message }}</li>
+                               {% endfor %}
+                       </ul>
+               </section>
+       {% endif %}
+{% endfor %}
diff --git a/templates/base.html.twig b/templates/base.html.twig
new file mode 100644 (file)
index 0000000..f6e912c
--- /dev/null
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <meta charset="UTF-8">
+        <title>{% block title %}{{ title }} - {{ site }}{% endblock %}</title>
+        <link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><circle cx=%2264%22 cy=%2264%22 r=%2264%22 fill=%22%2300c3f9%22 /><text y=%2294%22 x=%2214%22 font-size=%22120%22 fill=%22%23139%22>ru</text></svg>">
+        {% block stylesheets %}{% endblock %}
+        {% block javascripts %}{% endblock %}
+    </head>
+    <body>
+        {% block body %}
+                       <section id="rapsysuser_body">
+                               <header>
+                                       <h1><a href="{{ home_url }}">{{ site }}</a></h1>
+                               </header>
+                               {{ include('@RapsysUser/_message.html.twig') }}
+                               {% block content %}{% endblock %}
+                               {{ include('@RapsysUser/_footer.html.twig') }}
+                       </section>
+               {% endblock %}
+    </body>
+</html>
diff --git a/templates/index.html.twig b/templates/index.html.twig
new file mode 100644 (file)
index 0000000..2369d00
--- /dev/null
@@ -0,0 +1,24 @@
+{% extends '@RapsysUser/base.html.twig' %}
+{% block content %}
+       <section>
+               <header>
+                       <h2><a href="{{ self_url }}">{{ title }}</a></h2>
+               </header>
+               {% if groups is defined and groups %}
+                       {% for group, users in groups %}
+                               <article id="rapsysuser_index_{{ group|lower }}">
+                                       <header>
+                                               <h3>{{ group }}</h3>
+                                       </header>
+                                       {% if users is defined and users %}
+                                               <ul>
+                                                       {% for id, user in users %}
+                                                               <li><a href="{{ user.edit }}">{{ [user.forename, user.surname]|filter(v => v)|join(' ') }} &lt;{{ user.mail }}&gt;</a></li>
+                                                       {% endfor %}
+                                               </ul>
+                                       {% endif %}
+                               </article>
+                       {% endfor %}
+               {% endif %}
+       </section>
+{% endblock %}
diff --git a/templates/login.html.twig b/templates/login.html.twig
new file mode 100644 (file)
index 0000000..c57fd6e
--- /dev/null
@@ -0,0 +1,37 @@
+{% extends '@RapsysUser/base.html.twig' %}
+{% block content %}
+       <section id="rapsysuser_login">
+               <header>
+                       <h2><a href="{{ self_url }}">{{ title }}</a></h2>
+               </header>
+               {{ form_start(login) }}
+                       <div>
+                               {{ form_row(login.mail) }}
+
+                               {{ form_row(login.password) }}
+
+                               {{ form_row(login.submit) }}
+                       </div>
+
+                       {# Render CSRF token etc .#}
+                       <footer style="display:none">{{ form_rest(login) }}</footer>
+               {{ form_end(login) }}
+       </section>
+       {% if recover is defined %}
+               <section id="rapsysuser_recover">
+                       <header>
+                               <h2><a href="{{ recover_url }}">{% trans from "rapsysuser" %}Recover{% endtrans %}</a></h2>
+                       </header>
+                       {{ form_start(recover) }}
+                               <div>
+                                       {{ form_row(recover.mail) }}
+
+                                       {{ form_row(recover.submit) }}
+                               </div>
+
+                               {# Render CSRF token etc .#}
+                               <footer style="display:none">{{ form_rest(recover) }}</footer>
+                       {{ form_end(recover) }}
+               </section>
+       {% endif %}
+{% endblock %}
diff --git a/templates/recover.html.twig b/templates/recover.html.twig
new file mode 100644 (file)
index 0000000..3b7dab9
--- /dev/null
@@ -0,0 +1,28 @@
+{% extends '@RapsysUser/base.html.twig' %}
+{% block content %}
+       <section id="rapsysuser_recover">
+               <header>
+                       <h2><a href="{{ self_url }}">{{ title }}</a></h2>
+               </header>
+               {% if sent %}
+                       <p class="message notice">{% trans from "rapsysuser" %}Your recover account message has been sent{% endtrans %}</p>
+               {% else %}
+                       {{ form_start(recover) }}
+                               <div>
+                                       {% if recover.mail is defined %}
+                                               {{ form_row(recover.mail) }}
+                                       {% endif %}
+
+                                       {% if recover.password is defined %}
+                                               {{ form_row(recover.password) }}
+                                       {% endif %}
+
+                                       {{ form_row(recover.submit) }}
+                               </div>
+
+                               {# Render CSRF token etc .#}
+                               <footer style="display:none">{{ form_rest(recover) }}</footer>
+                       {{ form_end(recover) }}
+               {% endif %}
+       </section>
+{% endblock %}
diff --git a/templates/register.html.twig b/templates/register.html.twig
new file mode 100644 (file)
index 0000000..222c90c
--- /dev/null
@@ -0,0 +1,49 @@
+{% extends '@RapsysUser/base.html.twig' %}
+{% block content %}
+       <section id="rapsysuser_register">
+               <header>
+                       <h2><a href="{{ self_url }}">{{ title }}</a></h2>
+               </header>
+               {% if disabled is defined and disabled %}
+                       <p class="message error">{% trans from "rapsysuser" %}Your account has been disabled{% endtrans %}</p>
+               {% elseif sent is defined and sent %}
+                       <p class="message notice">{% trans from "rapsysuser" %}Your verification mail has been sent, to activate your account you must follow the confirmation link inside{% endtrans %}</p>
+                       <p class="message warning">{% trans from "rapsysuser" %}If you did not receive a verification mail, check your Spam or Junk mail folders{% endtrans %}</p>
+               {% else %}
+                       {{ form_start(register) }}
+                               {% if register.mail is defined %}
+                                       {{ form_row(register.mail) }}
+                               {% endif %}
+
+                               {% if register.password is defined %}
+                                       {{ form_row(register.password) }}
+                               {% endif %}
+
+                               {% if register.civility is defined %}
+                                       {{ form_row(register.civility) }}
+                               {% endif %}
+
+                               {% if register.forename is defined %}
+                                       {{ form_row(register.forename) }}
+                               {% endif %}
+
+                               {% if register.surname is defined %}
+                                       {{ form_row(register.surname) }}
+                               {% endif %}
+
+                               {% if register.phone is defined %}
+                                       {{ form_row(register.phone) }}
+                               {% endif %}
+
+                               {% if register.captcha is defined %}
+                                       {{ form_row(register.captcha) }}
+                               {% endif %}
+
+                               {{ form_row(register.submit) }}
+
+                               {# Render CSRF token etc .#}
+                               <footer style="display:none">{{ form_rest(register) }}</footer>
+                       {{ form_end(register) }}
+               {% endif %}
+       </section>
+{% endblock %}