Skip to content

Commit 8cc0026

Browse files
committed
chore: group and org pages
1 parent 9539909 commit 8cc0026

37 files changed

+1053
-147
lines changed
Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,16 @@
1-
{% extends "_layout.html" %}
1+
{% extends "group/read_base.html" %}
2+
3+
{%- block subtitle %}{{ _('About') }} {{ g.template_title_delimiter }} {{ super() }}{% endblock %}
4+
5+
{%- block primary_content_inner %}
6+
<h1>{% block page_heading %}{{ group_dict.display_name }}{% endblock %}</h1>
7+
{%- block group_description %}
8+
{%- if group_dict.description %}
9+
{{ h.render_markdown(group_dict.description) }}
10+
{%- endif %}
11+
{%- endblock %}
12+
13+
{%- block group_extras %}
14+
{{ ui.snippet('snippets/additional_info.html', extras=h.sorted_extras(group_dict.extras)) }}
15+
{%- endblock %}
16+
{%- endblock %}
Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,15 @@
1-
{% extends "_layout.html" %}
1+
{% extends "group/read_base.html" %}
2+
3+
{%- block subtitle %}{{ _('Activity Stream') }} {{ g.template_title_delimiter }} {{ super() }}{% endblock %}
4+
5+
{%- block primary_content_inner %}
6+
{{ ui.snippet('snippets/activity_stream.html',
7+
activity_stream=activity_stream,
8+
id=id,
9+
object_type='group',
10+
group_type=group_type,
11+
activity_types=activity_types,
12+
blueprint='activity.group_activity',
13+
newer_activities_url=newer_activities_url,
14+
older_activities_url=older_activities_url) }}
15+
{%- endblock %}
Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
1-
{% extends "_layout.html" %}
1+
{% extends "group/read_base.html" %}
2+
3+
{%- block subtitle %}{{ _('Administrators') }} {{ g.template_title_delimiter }} {{ group_dict.title or group_dict.name }}{% endblock %}
4+
5+
{%- block primary_content_inner %}
6+
{{ ui.heading(_('Administrators'), level=1, attrs={"class": "hide-heading"}) }}
7+
{%- block admins_list %}
8+
{{ ui.snippet("user/snippets/followers.html", followers=admins) }}
9+
{%- endblock %}
10+
{%- endblock %}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{% extends "group/_base.html" %}
2+
3+
{%- block primary_content_inner %}
4+
{{ ui.heading(h.humanize_entity_type('group', group_type, 'form label') or _('Group Form'), level=1) }}
5+
{%- block form %}
6+
{{ form | safe }}
7+
{%- endblock %}
8+
{%- endblock %}
Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,23 @@
1-
{% extends "_layout.html" %}
1+
{% extends "_page.html" %}
2+
3+
{%- block subtitle %}{{ _("Confirm Delete") }}{% endblock %}
4+
5+
{%- block primary_content_inner %}
6+
{{ ui.heading(_("Confirm Delete"), level=1) }}
7+
8+
<div class="module">
9+
<div class="module-content">
10+
{{ ui.text(_('Are you sure you want to delete group - {name}?').format(name=group_dict.name)) }}
11+
12+
<div class="form-actions">
13+
{{ ui.form_block("POST", action=h.url_for(group_dict.type ~ '.delete', id=group_dict.name)) }}
14+
{{ h.csrf_input() }}
15+
16+
{{ ui.button(_('Cancel'), type="submit", name="cancel", style="danger") }}
17+
{{ ui.button(_('Confirm Delete'), type="submit", name="delete", style="primary") }}
18+
19+
{{ ui.form_end() }}
20+
</div>
21+
</div>
22+
</div>
23+
{%- endblock %}
Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,19 @@
1-
{% extends "_layout.html" %}
1+
{% extends "_page.html" %}
2+
3+
{%- block subtitle %}{{ _('Confirm Delete') }}{% endblock %}
4+
5+
{%- block primary_content_inner %}
6+
<div class="module col-md-6 col-md-offset-3">
7+
<div class="module-content">
8+
<p>{{ _('Are you sure you want to delete member - {name}?').format(name=user_dict.name) }}</p>
9+
<div class="form-actions">
10+
{{ ui.form_block("POST", action=h.url_for(group_type ~ '.member_delete', id=group_id)) }}
11+
{{ h.csrf_input() }}
12+
{{ ui.hidden_input("user", value=user_id) }}
13+
{{ ui.button(_('Cancel'), type="submit", name="cancel", style="danger") }}
14+
{{ ui.button(_('Confirm Delete'), type="submit", name="delete", style="primary") }}
15+
{{ ui.form_end() }}
16+
</div>
17+
</div>
18+
</div>
19+
{%- endblock %}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{% extends "group/_base.html" %}
2+
3+
{%- block subtitle %}{{ _('Edit') }} {{ g.template_title_delimiter }} {{ super() }}{% endblock %}
4+
5+
{%- block breadcrumb_content %}
6+
{{ super() }}
7+
{%- block breadcrumb_content_inner %}
8+
{{ ui.breadcrumb_item(group.display_name|truncate(35), h.url_for(group_type~'.read', id=group.name), title=group.display_name) }}
9+
{{ ui.breadcrumb_item(_('Manage'), h.url_for(group_type~'.edit', id=group.name), active=true) }}
10+
{%- endblock %}
11+
{%- endblock %}
12+
13+
{%- block page_heading_class %}hide-heading{% endblock %}
14+
{%- block page_heading %}{{ h.humanize_entity_type('group', group_type, 'edit label') or _('Edit Group') }}{% endblock %}
Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
1-
{% extends "_layout.html" %}
1+
{% extends "group/read_base.html" %}
2+
3+
{%- block subtitle %}{{ _('Followers') }} {{ g.template_title_delimiter }} {{ group_dict.title or group_dict.name }}{% endblock %}
4+
5+
{%- block primary_content_inner %}
6+
{{ ui.heading(_('Followers'), level=1, attrs={"class": "hide-heading"}) }}
7+
{%- block followers_list %}
8+
{{ ui.snippet("user/snippets/followers.html", followers=followers) }}
9+
{%- endblock %}
10+
{%- endblock %}
Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,45 @@
1-
{% extends "group/_base.html" %}
1+
{% extends "page.html" %}
22

3-
{%- block primary_content_inner %}
4-
{%- block page_primary_action %}
5-
{%- if h.check_access('group_create') %}
6-
{{ ui.button(_('Add Group'), href=h.url_for('group.new')) }}
7-
{%- endif %}
8-
{%- endblock %}
9-
10-
{%- block search_form %}
11-
{{ ui.form_start(method="GET", action=h.url_for('group.index'), **{"hx-boost": "true", "hx-disinherit": "hx-boost", "class": "search-form"}) }}
3+
{%- set group_type = h.default_group_type('group') %}
124

13-
<div {{ ui.util.attrs({"class": "input-group"}) }}>
14-
<input type="text" class="form-control" name="q" value="{{ q or '' }}"
15-
placeholder="{{ _('Search groups...') }}"
16-
autocomplete="off">
17-
<button type="submit" class="btn btn-primary">{{ _('Search') }}</button>
18-
</div>
5+
{%- block subtitle %}{{ h.humanize_entity_type('group', group_type, 'page title') or _('Groups') }}{% endblock %}
196

20-
<h2>
21-
{%- if page.item_count %}
22-
{{ ui.pagination_info(page.item_count, page.first_item, last_item) }}
23-
{%- else %}
24-
{{ _('No groups found') }}
25-
{%- endif %}
26-
</h2>
7+
{%- block breadcrumb_content %}
8+
{{ ui.breadcrumb_item(h.humanize_entity_type('group', group_type, 'breadcrumb') or _('Groups'), href=h.url_for(group_type ~ '.index')) }}
9+
{%- endblock %}
2710

28-
{{ ui.form_end() }}
29-
{%- endblock %}
11+
{%- block page_header %}{% endblock %}
3012

31-
{%- block group_list %}
32-
{%- if page.items %}
33-
{{ ui.group_list(ui.util.map(ui.group_item, page.items)) }}
13+
{%- block page_primary_action %}
14+
{%- if h.check_access('group_create') %}
15+
{{ ui.link(h.humanize_entity_type('group', group_type, 'add link') or _('Add Group'), href=h.url_for(group_type ~ '.new'), class_='btn btn-primary', icon='plus-square') }}
16+
{%- endif %}
17+
{%- endblock %}
3418

35-
{%- else %}
36-
{%- if q %}
37-
<p>{{ _('There was an error while searching.') }}</p>
38-
{%- else %}
39-
<p>{{ _('No groups found.') }}</p>
19+
{%- block primary_content_inner %}
20+
{{ ui.heading(h.humanize_entity_type('group', group_type, 'page title') or _('Groups'), level=1, attrs={"class": "hide-heading"}) }}
21+
{%- block groups_search_form %}
22+
{{ ui.snippet('snippets/search_form.html', form_id='group-search-form', type=group_type, query=q, sorting_selected=sort_by_selected, count=page.item_count, placeholder=h.humanize_entity_type('group', group_type, 'search placeholder') or _('Search groups...'), show_empty=True if page.items, sorting=[(_('Name Ascending'), 'title asc'), (_('Name Descending'), 'title desc')]) }}
23+
{%- endblock %}
24+
{%- block groups_list %}
25+
{%- if page.items or request.args %}
26+
{%- if page.items %}
27+
{{ ui.snippet("group/snippets/group_list.html", groups=page.items) }}
4028
{%- endif %}
29+
{%- else %}
30+
<p class="empty">
31+
{{ h.humanize_entity_type('group', group_type, 'no any objects') or _('There are currently no groups for this site') }}.
32+
{%- if h.check_access('group_create') %}
33+
{{ ui.link(_('How about creating one?'), href=h.url_for(group_type ~ '.new')) }}
34+
{%- endif %}
35+
</p>
4136
{%- endif %}
4237
{%- endblock %}
43-
44-
{%- block pagination %}
45-
{{ ui.pagination(page.page, page.last_page, page._url_generator) }}
38+
{%- block page_pagination %}
39+
{{ page.pager(q=q or '', sort=sort_by_selected or '') }}
4640
{%- endblock %}
4741
{%- endblock %}
42+
43+
{%- block secondary_content %}
44+
{{ ui.snippet("group/snippets/helper.html", group_type=group_type) }}
45+
{%- endblock %}
Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,51 @@
1-
{% extends "_layout.html" %}
1+
{% extends "group/edit_base.html" %}
2+
3+
{%- block subtitle %}{{ _('Members') }} {{ g.template_title_delimiter }} {{ group_dict.display_name }} {{ g.template_title_delimiter }} {{ h.humanize_entity_type('group', group_type, 'page title') or _('Groups') }}{% endblock %}
4+
5+
{%- block page_primary_action %}
6+
{{ ui.link(_('Add Member'), href=h.url_for(group_type ~ '.member_new', id=group_dict.id), class_='btn btn-primary', icon='plus-square') }}
7+
{{ ui.link(_('CSV'), href=h.url_for(group_type ~ '.member_dump', id=group_dict.id), class_='btn btn-primary', icon='download') }}
8+
{%- endblock %}
9+
10+
{%- block primary_content_inner %}
11+
{{ ui.heading(_('{0} members'.format(members|length)), level=3) }}
12+
<table class="table table-header table-hover table-bordered" id="member-table">
13+
<thead>
14+
<tr>
15+
<th>{{ _('User') }}</th>
16+
<th>{{ _('Role') }}</th>
17+
<th></th>
18+
</tr>
19+
</thead>
20+
<tbody>
21+
{%- for user_id, user, role in members %}
22+
<tr>
23+
<td class="media">
24+
{{ h.linked_user(user_id, maxlength=20) }}
25+
</td>
26+
<td>{{ role }}</td>
27+
<td>
28+
<div class="btn-group pull-right">
29+
<a class="btn btn-secondary btn-sm" href="{{ h.url_for(group_type ~ '.member_new', id=group_dict.id, user=user_id) }}"
30+
aria-label="{{ _('Edit role') }}"
31+
aria-description="{{ _('Edit the role of the user within the group') }}"
32+
data-bs-title="{{ _('Edit role') }}"
33+
data-bs-toggle="tooltip">
34+
<i class="fa fa-wrench"></i>
35+
</a>
36+
<a class="btn btn-danger btn-sm" href="{{ h.url_for(group_type ~ '.member_delete', id=group_dict.id, user=user_id) }}"
37+
data-module="confirm-action"
38+
data-module-content="{{ _('Are you sure you want to delete this member?') }}"
39+
aria-label="{{ _('Delete member') }}"
40+
aria-description="{{ _('Delete this member from the group') }}"
41+
data-bs-title="{{ _('Delete member') }}"
42+
data-bs-toggle="tooltip">
43+
<i class="fa fa-times"></i>
44+
</a>
45+
</div>
46+
</td>
47+
</tr>
48+
{%- endfor %}
49+
</tbody>
50+
</table>
51+
{%- endblock %}

0 commit comments

Comments
 (0)