added "create user" functionality (#37)

* added "create user" functionality #5
* improved user admin views
* added Role constraint and validator
This commit is contained in:
Kevin Papst
2018-01-06 18:33:01 +01:00
committed by GitHub
parent 3270ce7560
commit 56c994c46b
9 changed files with 245 additions and 39 deletions

View File

@@ -1,35 +1,12 @@
<?xml version="1.0"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" target-language="de" datatype="plaintext" original="file.ext">
<file source-language="en" target-language="de" datatype="plaintext" original="not.available">
<body>
<trans-unit id="post.blank_summary">
<source>post.blank_summary</source>
<target>Gib deinem Beitrag eine Zusammenfassung!</target>
</trans-unit>
<trans-unit id="post.blank_content">
<source>post.blank_content</source>
<target>Dein Beitrag sollte einen Inhalt haben!</target>
</trans-unit>
<trans-unit id="post.too_short_content">
<source>post.too_short_content</source>
<target>Der Beitragsinhalt ist zu kurz (mindestens {{ limit }} Zeichen)</target>
</trans-unit>
<trans-unit id="comment.blank">
<source>comment.blank</source>
<target>Bitte gib einen Kommentar ein!</target>
</trans-unit>
<trans-unit id="comment.too_short">
<source>comment.too_short</source>
<target>Der Kommentar ist zu kurz (mindestens {{ limit }} Zeichen)</target>
</trans-unit>
<trans-unit id="comment.too_long">
<source>comment.too_long</source>
<target>Der Kommentar ist zu lang (maximal {{ limit }} Zeichen)</target>
</trans-unit>
<trans-unit id="comment.is_spam">
<source>comment.is_spam</source>
<target>Der Inhalt des Kommentars wird als Spam eingestuft.</target>
</trans-unit>
<trans-unit id="This value is not a valid role.">
<source>This value is not a valid role.</source>
<target>Dieser Wert ist keine gültige Rolle.</target>
</trans-unit>
</body>
</file>
</xliff>

View File

@@ -17,17 +17,21 @@
'label.active': '',
'label.roles': '',
'label.actions': '',
}) }}
}, null, {'plus-square': path('admin_user_create')}) }}
{% for entry in entries %}
<tr>
<td class="hidden-xs">{{ entry.id }}</td>
<td>{{ entry.alias }}</td>
<td>{{ entry.alias|default(entry.username) }}</td>
<td class="hidden-xs">{{ entry.username }}</td>
<td class="hidden-xs hidden-sm">{{ entry.email }}</td>
<td class="hidden-xs">{{ entry.title }}</td>
<td>{{ widgets.label_visible(entry.active) }}</td>
<td>{{ entry.roles|join(',')|trans }}</td>
<td>
{% for role in entry.roles %}
{{ widgets.label_role(role) }}
{% endfor %}
</td>
<td>
{{ widgets.button_group({
'edit': path('user_profile', {'username' : entry.username}),

View File

@@ -0,0 +1,12 @@
{% extends 'base.html.twig' %}
{% block page_title %}{{ 'admin_user.title'|trans }}{% endblock %}
{% block page_subtitle %}{{ 'admin_user.subtitle'|trans }}{% endblock %}
{% block main %}
{{ include('default/_form.html.twig', {
'title': 'create'|trans,
'form': form,
'back': path('admin_user')
}) }}
{% endblock %}

View File

@@ -12,6 +12,11 @@
{% endif %}
{% endmacro %}
{% macro label_role(role) %}
{% import _self as macro %}
{{ macro.label(role, 'primary') }}
{% endmacro %}
{% macro label_project(project) %}
{% import _self as macro %}
{{ macro.label(project.name, 'primary') }}