mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 11:26:56 -08:00
rework settings ui, scaffold blocks managment
This commit is contained in:
parent
93155e40da
commit
e2c2d9b503
4 changed files with 219 additions and 5 deletions
79
app/templates/user/edit_profile2.html
Normal file
79
app/templates/user/edit_profile2.html
Normal file
|
@ -0,0 +1,79 @@
|
|||
{% if theme() and file_exists('app/templates/themes/' + theme() + '/base.html') %}
|
||||
{% extends 'themes/' + theme() + '/base.html' %}
|
||||
{% else %}
|
||||
{% extends "base.html" %}
|
||||
{% endif %} %}
|
||||
{% set active_child = 'edit_profile' %}
|
||||
{% from 'bootstrap/form.html' import render_field %}
|
||||
|
||||
{% block app_content %}
|
||||
<div class="card" style="max-width:unset;">
|
||||
<div class="card-header">
|
||||
<nav aria-label="breadcrumb" id="breadcrumb_nav" title="Navigation">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="/">{{ _('Home') }}</a></li>
|
||||
<li class="breadcrumb-item"><a href="/u/{{ user.link() }}">{{ user.display_name() }}</a></li>
|
||||
<li class="breadcrumb-item active">{{ _('Edit profile') }}</li>
|
||||
</ol>
|
||||
</nav>
|
||||
<ul class="nav nav-tabs card-header-tabs">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/user/settings">Basic</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/user/settings/filters">Blocks & Filters</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" href="/u/{{ current_user.user_name }}/profile">Profile</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link disabled" href="#">Other</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<h1>{{ _('Edit profile of %(name)s', name=user.user_name) }}</h1>
|
||||
<p class="card-text"></p>
|
||||
<form method='post' enctype="multipart/form-data" role="form" autocomplete="off">
|
||||
{{ form.csrf_token() }}
|
||||
|
||||
{{ render_field(form.email) }}
|
||||
{{ render_field(form.password_field) }}
|
||||
<h5> Profile Data </h5>
|
||||
{{ render_field(form.title) }}
|
||||
{{ render_field(form.about) }}
|
||||
{% if not low_bandwidth %}
|
||||
{% if markdown_editor %}
|
||||
<script nonce="{{ session['nonce'] }}">
|
||||
window.addEventListener("load", function () {
|
||||
var downarea = new DownArea({
|
||||
elem: document.querySelector('#about'),
|
||||
resize: DownArea.RESIZE_VERTICAL,
|
||||
hide: ['heading', 'bold-italic'],
|
||||
value: {{ form.about.data | tojson | safe }}
|
||||
});
|
||||
setupAutoResize('about');
|
||||
});
|
||||
</script>
|
||||
{% else %}
|
||||
<a href="#" aria-hidden="true" class="markdown_editor_enabler create_post_markdown_editor_enabler" data-id="about">{{ _('Enable markdown editor') }}</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{{ render_field(form.bot) }}
|
||||
{{ render_field(form.matrixuserid) }}
|
||||
<small class="field_hint">e.g. @something:matrix.org. Include leading @ and use : before server</small>
|
||||
<h5> Profile Images </h5>
|
||||
{{ render_field(form.profile_file) }}
|
||||
<small class="field_hint">Provide a square image that looks good when small.</small>
|
||||
{{ render_field(form.banner_file) }}
|
||||
<small class="field_hint">Provide a wide image - letterbox orientation.</small>
|
||||
{{ render_field(form.submit) }}
|
||||
</form>
|
||||
<p class="mt-4 pt-4">
|
||||
<a class="btn btn-warning" href="{{ url_for('user.delete_account') }}">{{ _('Delete account') }}</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
61
app/templates/user/edit_settings2.html
Normal file
61
app/templates/user/edit_settings2.html
Normal file
|
@ -0,0 +1,61 @@
|
|||
{% if theme() and file_exists('app/templates/themes/' + theme() + '/base.html') %}
|
||||
{% extends 'themes/' + theme() + '/base.html' %}
|
||||
{% else %}
|
||||
{% extends "base.html" %}
|
||||
{% endif %} %}
|
||||
{% from 'bootstrap/form.html' import render_field %}
|
||||
{% set active_child = 'settings' %}
|
||||
|
||||
{% block app_content %}
|
||||
|
||||
<div class="card" style="max-width:unset;">
|
||||
<div class="card-header">
|
||||
<nav aria-label="breadcrumb" id="breadcrumb_nav" title="Navigation">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="/">{{ _('Home') }}</a></li>
|
||||
<li class="breadcrumb-item"><a href="/u/{{ user.link() }}">{{ user.display_name() }}</a></li>
|
||||
<li class="breadcrumb-item active">{{ _('Change settings') }}</li>
|
||||
</ol>
|
||||
</nav>
|
||||
<ul class="nav nav-tabs card-header-tabs">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" href="/user/settings">Basic</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/user/settings/filters">Blocks & Filters</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/u/{{ current_user.user_name }}/profile">Profile</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link disabled" href="#">Other</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<h1>{{ _('Change settings') }}</h1>
|
||||
<p class="card-text">Change your basic settings and preferences </p>
|
||||
<form method='post' enctype="multipart/form-data" role="form">
|
||||
{{ form.csrf_token() }}
|
||||
<h5> Mail Settings </h5>
|
||||
{{ render_field(form.newsletter) }}
|
||||
{{ render_field(form.email_unread) }}
|
||||
<h5> Visibility </h5>
|
||||
{{ render_field(form.ignore_bots) }}
|
||||
{{ render_field(form.nsfw) }}
|
||||
{{ render_field(form.nsfl) }}
|
||||
{{ render_field(form.searchable) }}
|
||||
{{ render_field(form.indexable) }}
|
||||
<h5> Preferences </h5>
|
||||
{{ render_field(form.markdown_editor) }}
|
||||
{{ render_field(form.default_sort) }}
|
||||
{{ render_field(form.theme) }}
|
||||
<h5>Import</h5>
|
||||
{{ render_field(form.import_file) }}
|
||||
{{ render_field(form.submit) }}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
76
app/templates/user/filters2.html
Normal file
76
app/templates/user/filters2.html
Normal file
|
@ -0,0 +1,76 @@
|
|||
{% if theme() and file_exists('app/templates/themes/' + theme() + '/base.html') %}
|
||||
{% extends 'themes/' + theme() + '/base.html' %}
|
||||
{% else %}
|
||||
{% extends "base.html" %}
|
||||
{% endif %} %}
|
||||
{% from 'bootstrap/form.html' import render_field %}
|
||||
{% set active_child = 'filters' %}
|
||||
|
||||
{% block app_content %}
|
||||
<div class="card" style="max-width:unset;">
|
||||
<div class="card-header">
|
||||
<nav aria-label="breadcrumb" id="breadcrumb_nav" title="Navigation">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="/">{{ _('Home') }}</a></li>
|
||||
<li class="breadcrumb-item"><a href="/u/{{ user.link() }}">{{ user.display_name() }}</a></li>
|
||||
<li class="breadcrumb-item active"><a href="/user/settings">{{ _('Settings') }}</a></li>
|
||||
<li class="breadcrumb-item active">{{ _('Filters') }}</li>
|
||||
</ol>
|
||||
</nav>
|
||||
<ul class="nav nav-tabs card-header-tabs">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/user/settings">Basic</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" href="/user/settings/filters">Blocks & Filters</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/u/{{ current_user.user_name }}/profile">Profile</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link disabled" href="#">Other</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="rh_action_buttons">
|
||||
<a class="btn btn-primary" href="{{ url_for('user.user_settings_filters_add') }}">{{ _('Add filter') }}</a>
|
||||
</div>
|
||||
<h1>{{ _('Filters') }}</h1>
|
||||
<p class="card-text">{{ _('Filters can hide posts that contain keywords you specify, either by making them less noticeable or invisible.') }}</p>
|
||||
{% if filters %}
|
||||
<table class="table table-striped" role="table">
|
||||
<tr>
|
||||
<th>{{ _('Name') }}</th>
|
||||
<th>{{ _('Keywords') }}</th>
|
||||
<th>{{ _('Action') }}</th>
|
||||
<th>{{ _('Expires') }}</th>
|
||||
<th> </th>
|
||||
</tr>
|
||||
{% for filter in filters %}
|
||||
<tr>
|
||||
<td>{{ filter.title }}</td>
|
||||
<td>{{ filter.keywords_string()|shorten(30) }}</td>
|
||||
<td>{{ _('Invisible') if filter.hide_type == 1 else _('Semi-transparent') }}</td>
|
||||
<td>{{ filter.expire_after if filter.expire_after }}</td>
|
||||
<td>
|
||||
<a href="{{ url_for('user.user_settings_filters_edit', filter_id=filter.id) }}">Edit</a> |
|
||||
<a href="{{ url_for('user.user_settings_filters_delete', filter_id=filter.id) }}" class="confirm_first">Delete</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% else %}
|
||||
<p>{{ _('No filters defined yet.') }}</p>
|
||||
{% endif %}
|
||||
<h1>Blocks</h5>
|
||||
<p class="card-text">Manage what users, communities, domains or instances you want to block. Blocking them means you will no longer see any posts associated with them.</p>
|
||||
<a class="btn btn-primary" href="">Manage User Blocks</a>
|
||||
<a class="btn btn-primary" href="">Manage Communities Blocks</a>
|
||||
<a class="btn btn-primary" href="">Manage Domain Blocks</a>
|
||||
<a class="btn btn-primary" href="">Manage Instance Blocks</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -142,7 +142,7 @@ def edit_profile(actor):
|
|||
form.matrixuserid.data = current_user.matrix_user_id
|
||||
form.password_field.data = ''
|
||||
|
||||
return render_template('user/edit_profile.html', title=_('Edit profile'), form=form, user=current_user,
|
||||
return render_template('user/edit_profile2.html', title=_('Edit profile'), form=form, user=current_user,
|
||||
markdown_editor=current_user.markdown_editor,
|
||||
moderating_communities=moderating_communities(current_user.get_id()),
|
||||
joined_communities=joined_communities(current_user.get_id())
|
||||
|
@ -202,12 +202,11 @@ def change_settings():
|
|||
form.theme.data = current_user.theme
|
||||
form.markdown_editor.data = current_user.markdown_editor
|
||||
|
||||
return render_template('user/edit_settings.html', title=_('Edit profile'), form=form, user=current_user,
|
||||
return render_template('user/edit_settings2.html', title=_('Edit profile'), form=form, user=current_user,
|
||||
moderating_communities=moderating_communities(current_user.get_id()),
|
||||
joined_communities=joined_communities(current_user.get_id())
|
||||
)
|
||||
|
||||
|
||||
@bp.route('/u/<actor>/ban', methods=['GET'])
|
||||
@login_required
|
||||
def ban_profile(actor):
|
||||
|
@ -615,12 +614,11 @@ def import_settings_task(user_id, filename):
|
|||
@login_required
|
||||
def user_settings_filters():
|
||||
filters = Filter.query.filter_by(user_id=current_user.id).order_by(Filter.title).all()
|
||||
return render_template('user/filters.html', filters=filters, user=current_user,
|
||||
return render_template('user/filters2.html', filters=filters, user=current_user,
|
||||
moderating_communities=moderating_communities(current_user.get_id()),
|
||||
joined_communities=joined_communities(current_user.get_id())
|
||||
)
|
||||
|
||||
|
||||
@bp.route('/user/settings/filters/add', methods=['GET', 'POST'])
|
||||
@login_required
|
||||
def user_settings_filters_add():
|
||||
|
|
Loading…
Reference in a new issue