implement event settings

This commit is contained in:
ghost 2023-10-11 22:34:47 +03:00
parent d4fbb4b592
commit 7aa2c03abc
14 changed files with 657 additions and 171 deletions

View file

@ -33,12 +33,33 @@
<tr>
<td class="padding-y-8-px border-bottom-default text-right" colspan="2">{{ 'Common'|trans }}</td>
</tr>
{% if user.address %}
<tr>
<td class="padding-t-16-px">{{ 'Address' | trans }}</td>
<td class="padding-t-16-px">
{{ user.address }}
<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" fill="currentColor" viewBox="0 0 16 16">
<path d="M11 1a2 2 0 0 0-2 2v4a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h5V3a3 3 0 0 1 6 0v4a.5.5 0 0 1-1 0V3a2 2 0 0 0-2-2zM3 8a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V9a1 1 0 0 0-1-1H3z"/>
</svg>
<span class="opacity-0 parent-hover-opacity-09" title="{{ 'Address hidden for others'|trans }}">
<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" fill="currentColor" viewBox="0 0 16 16">
<path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"/>
</svg>
</span>
</td>
</tr>
<tr>
<td>{{ 'Joined' | trans }}</td>
<td>{{ user.added | format_ago }}</td>
</tr>
{% else %}
<tr>
<td class="padding-t-16-px">{{ 'Joined' | trans }}</td>
<td class="padding-t-16-px">{{ user.added | format_ago }}</td>
</tr>
{% endif %}
<tr>
<td class="padding-t-16-px">{{ 'Joined'|trans }}</td>
<td class="padding-t-16-px">{{ user.added | format_ago }}</td>
</tr>
<tr>
<td class="padding-y-8-px border-bottom-default text-right" colspan="2">{{ 'Access'|trans }}</td>
<td class="padding-y-8-px border-bottom-default text-right" colspan="2">{{ 'Access' | trans }}</td>
</tr>
<tr>
<td class="padding-t-16-px">
@ -121,7 +142,7 @@
<tr>
<td class="padding-y-8-px border-bottom-default text-right" colspan="2">
{% if user.owner %}
<a class="margin-r-4-px{#opacity-0 parent-hover-opacity-09#}" href="{{ path('user_profile', { userId : user.id }) }}" title="{{'Edit'|trans }}">
<a class="margin-r-4-px{#opacity-0 parent-hover-opacity-09#}" href="{{ path('user_settings', { userId : user.id }) }}" title="{{'Edit'|trans }}">
<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" fill="currentColor" viewBox="0 0 16 16">
<path d="M12.854.146a.5.5 0 0 0-.707 0L10.5 1.793 14.207 5.5l1.647-1.646a.5.5 0 0 0 0-.708l-3-3zm.646 6.061L9.793 2.5 3.293 9H3.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.207l6.5-6.5zm-7.468 7.468A.5.5 0 0 1 6 13.5V13h-.5a.5.5 0 0 1-.5-.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.5-.5V10h-.5a.499.499 0 0 1-.175-.032l-.179.178a.5.5 0 0 0-.11.168l-2 5a.5.5 0 0 0 .65.65l5-2a.5.5 0 0 0 .168-.11l.178-.178z"/>
</svg>
@ -132,37 +153,66 @@
</tr>
<tr>
<td class="padding-t-16-px">
{{ 'Interface' | trans }}
{{ 'Theme' | trans }}
</td>
<td class="padding-t-16-px">
{{ user.theme | u.title }}
</td>
</tr>
<tr>
<td>
{{ 'Interface' | trans }}
</td>
<td>
{{ user.locale | locale_name(user.locale) | u.title }}
</td>
</tr>
<tr>
<td class="width-20">{{ 'Content'|trans }}</td>
<td class="width-20">
{{ 'Languages' | trans }}
</td>
<td class="width-80 line-height-20-px">
{% for i, locale in user.locales %}{% if i > 0 %},{% endif %} {{ locale|locale_name(locale)|u.title }}{% endfor %}
{#
{% for locale in user.locales %}
<div class="padding-y-4-px">
{{ locale|locale_name(locale)|u.title }}
</div>
{% endfor %}
#}
</td>
</tr>
<tr>
<td>{{ 'Theme'|trans }}</td>
<td>{{ user.theme | u.title }}</td>
<td>
{{ 'Sensitive' | trans }}
</td>
<td>
{% if user.sensitive %}
{{ 'Yes' | trans }}
{% else %}
{{ 'No' | trans }}
{% endif %}
</td>
</tr>
<tr>
<td>{{ 'Sensitive'|trans }}</td>
<td>
{% if user.sensitive %}
{{ 'Yes'|trans }}
{% else %}
{{ 'No'|trans }}
{% endif %}
{{ 'Events subscribed' | trans }}
</td>
<td>
{% for group, event in events %}
<div class="margin-b-4-px">
<span class="text-color-night">
{{ group }}:
</span>
{% set i = 0 %}
{% for key, value in event %}{% if value in user.events %}{% if i > 0 %}, {% endif %}{{ key | lower }}{% set i = i + 1 %}{% endif %}{% endfor %}
</div>
{% endfor %}
</td>
</tr>
<tr>
<td>
{{ 'Yggdrasil filter' | trans }}
</td>
<td>
{% if user.yggdrasil %}
{{ 'Yes'|trans }}
{% else %}
{{ 'No'|trans }}
{% endif %}
</td>
</tr>
</tbody>

View file

@ -6,25 +6,38 @@
</svg>
</span>
{% else %}
<a class="padding-8-px display-block text-color-night" href="{{ path('user_dashboard') }}" title="{{ 'Home' | trans }}">
<a rel="nofollow" class="padding-8-px display-block text-color-night" href="{{ path('user_dashboard') }}" title="{{ 'Home' | trans }}">
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="currentColor" viewBox="0 0 16 16">
<path d="M6.5 14.5v-3.505c0-.245.25-.495.5-.495h2c.25 0 .5.25.5.5v3.5a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5v-7a.5.5 0 0 0-.146-.354L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293L8.354 1.146a.5.5 0 0 0-.708 0l-6 6A.5.5 0 0 0 1.5 7.5v7a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5Z"/>
</svg>
</a>
{% endif %}
{% if route == 'user_profile' %}
{% if route == 'user_info' %}
<span class="padding-8-px display-block cursor-default" title="{{ 'Profile' | trans }}">
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="currentColor" viewBox="0 0 16 16">
<path d="M3 14s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1H3Zm5-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"/>
</svg>
</span>
{% else %}
<a class="padding-8-px display-block text-color-night" href="{{ path('user_profile') }}" title="{{ 'Profile' | trans }}">
<a rel="nofollow" class="padding-8-px display-block text-color-night" href="{{ path('user_info') }}" title="{{ 'Profile' | trans }}">
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="currentColor" viewBox="0 0 16 16">
<path d="M3 14s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1H3Zm5-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"/>
</svg>
</a>
{% endif %}
{% if route == 'user_settings' %}
<span class="padding-8-px display-block cursor-default" title="{{ 'Settings' | trans }}">
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="currentColor" class="bi bi-gear-fill" viewBox="0 0 16 16">
<path d="M9.405 1.05c-.413-1.4-2.397-1.4-2.81 0l-.1.34a1.464 1.464 0 0 1-2.105.872l-.31-.17c-1.283-.698-2.686.705-1.987 1.987l.169.311c.446.82.023 1.841-.872 2.105l-.34.1c-1.4.413-1.4 2.397 0 2.81l.34.1a1.464 1.464 0 0 1 .872 2.105l-.17.31c-.698 1.283.705 2.686 1.987 1.987l.311-.169a1.464 1.464 0 0 1 2.105.872l.1.34c.413 1.4 2.397 1.4 2.81 0l.1-.34a1.464 1.464 0 0 1 2.105-.872l.31.17c1.283.698 2.686-.705 1.987-1.987l-.169-.311a1.464 1.464 0 0 1 .872-2.105l.34-.1c1.4-.413 1.4-2.397 0-2.81l-.34-.1a1.464 1.464 0 0 1-.872-2.105l.17-.31c.698-1.283-.705-2.686-1.987-1.987l-.311.169a1.464 1.464 0 0 1-2.105-.872l-.1-.34zM8 10.93a2.929 2.929 0 1 1 0-5.86 2.929 2.929 0 0 1 0 5.858z"/>
</svg>
</span>
{% else %}
<a rel="nofollow" class="padding-8-px display-block text-color-night" href="{{ path('user_settings') }}" title="{{ 'Settings' | trans }}">
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="currentColor" class="bi bi-gear-fill" viewBox="0 0 16 16">
<path d="M9.405 1.05c-.413-1.4-2.397-1.4-2.81 0l-.1.34a1.464 1.464 0 0 1-2.105.872l-.31-.17c-1.283-.698-2.686.705-1.987 1.987l.169.311c.446.82.023 1.841-.872 2.105l-.34.1c-1.4.413-1.4 2.397 0 2.81l.34.1a1.464 1.464 0 0 1 .872 2.105l-.17.31c-.698 1.283.705 2.686 1.987 1.987l.311-.169a1.464 1.464 0 0 1 2.105.872l.1.34c.413 1.4 2.397 1.4 2.81 0l.1-.34a1.464 1.464 0 0 1 2.105-.872l.31.17c1.283.698 2.686-.705 1.987-1.987l-.169-.311a1.464 1.464 0 0 1 .872-2.105l.34-.1c1.4-.413 1.4-2.397 0-2.81l-.34-.1a1.464 1.464 0 0 1-.872-2.105l.17-.31c.698-1.283-.705-2.686-1.987-1.987l-.311.169a1.464 1.464 0 0 1-2.105-.872l-.1-.34zM8 10.93a2.929 2.929 0 1 1 0-5.86 2.929 2.929 0 0 1 0 5.858z"/>
</svg>
</a>
{% endif %}
{% if route == 'article_submit' or route == 'torrent_submit' %}
<span class="padding-8-px display-block cursor-default" title="{{ 'Submit' | trans }}">
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="currentColor" viewBox="0 0 16 16">
@ -32,7 +45,7 @@
</svg>
</span>
{% else %}
<a class="padding-8-px display-block text-color-night" href="{{ path('article_submit') }}" title="{{ 'Submit' | trans }}">
<a rel="nofollow" class="padding-8-px display-block text-color-night" href="{{ path('article_submit') }}" title="{{ 'Submit' | trans }}">
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="currentColor" viewBox="0 0 16 16">
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8.5 4.5a.5.5 0 0 0-1 0v3h-3a.5.5 0 0 0 0 1h3v3a.5.5 0 0 0 1 0v-3h3a.5.5 0 0 0 0-1h-3v-3z"/>
</svg>

View file

@ -1,110 +1,14 @@
{% extends 'default/layout.html.twig' %}
{% block title %}{{ 'Profile'|trans }} - {{ name }}{% endblock %}
{% block title %}{{ 'Settings' | trans }} - {{ name }}{% endblock %}
{% block main_content %}
<div class="padding-24-px margin-y-8-px border-radius-3-px background-color-night">
<form name="profile" action="{{ path('user_profile') }}" method="post">
<div class="text-center">
<a href="{{ path('user_info', { userId : user.id }) }}">
<img class="border-radius-50 border-color-default border-width-2-px" src="{{ user.identicon }}" alt="{{ 'identicon'|trans }}" />
</a>
</div>
<h2>{{ 'Profile'|trans }}</h2>
<form name="profile" action="{{ path('user_settings') }}" method="post">
<h1>{{ 'Settings' | trans }} </h1>
<table class="width-100">
<tbody>
<tr>
<td class="padding-b-8-px border-bottom-default text-right" colspan="2">{{ 'Common'|trans }}</td>
</tr>
<tr>
<td class="padding-t-16-px">{{ 'Address'|trans }}</td>
<td class="padding-t-16-px">
{{ user.address }}
<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" fill="currentColor" viewBox="0 0 16 16">
<path d="M11 1a2 2 0 0 0-2 2v4a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h5V3a3 3 0 0 1 6 0v4a.5.5 0 0 1-1 0V3a2 2 0 0 0-2-2zM3 8a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V9a1 1 0 0 0-1-1H3z"/>
</svg>
<span class="opacity-0 parent-hover-opacity-09" title="{{ 'Address hidden for others'|trans }}">
<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" fill="currentColor" viewBox="0 0 16 16">
<path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"/>
</svg>
</span>
</td>
</tr>
<tr>
<td>{{ 'Joined' | trans }}</td>
<td>{{ user.added | format_ago }}</td>
</tr>
<tr>
<td class="padding-b-8-px border-bottom-default text-right" colspan="2">{{ 'Access'|trans }}</td>
</tr>
<tr>
<td class="padding-t-16-px">{{ 'Status'|trans }}</td>
<td class="padding-t-16-px">
{% if user.status %}
{{ 'Aactive' | trans }}
{% else %}
{{ 'Disabled' | trans }}
{% endif %}
</td>
</tr>
<tr>
<td>{{ 'Approved'|trans }}</td>
<td>
{% if user.approved %}
{{ 'Yes' | trans }}
{% else %}
{{ 'No' | trans }}
{% endif %}
</td>
</tr>
<tr>
<td>{{ 'Moderator' | trans }}</td>
<td>
{% if user.moderator %}
{{ 'Yes' | trans }}
{% else %}
{{ 'No' | trans }}
{% endif %}
</td>
</tr>
<tr>
<td class="padding-b-8-px border-bottom-default text-right" colspan="2">
{{ 'Settings' | trans }}
</td>
</tr>
<tr>
<td class="padding-t-16-px">{{ 'Interface'|trans }}</td>
<td class="padding-t-16-px">
<select name="locale">
{% for locale in locales %}
{% if locale == user.locale %}
<option value="{{ locale }}" selected="selected">
{{ locale|locale_name(locale)|u.title }}
</option>
{% else %}
<option value="{{ locale }}">
{{ locale|locale_name(locale)|u.title }}
</option>
{% endif %}
{% endfor %}
</select>
</td>
</tr>
<tr>
<td>
{{ 'Content language' | trans }}
</td>
<td>
{% for locale in locales %}
<div class="padding-y-4-px">
{% if locale in user.locales %}
<input name="locales[]" id="{{ locale }}" type="checkbox" value="{{ locale }}" checked="checked" />
{% else %}
<input name="locales[]" id="{{ locale }}" type="checkbox" value="{{ locale }}" />
{% endif %}
<label for="{{ locale }}">
{{ locale|locale_name(locale)|u.title }}
</label>
</div>
{% endfor %}
{{ 'Interface' | trans }}
</td>
</tr>
<tr>
@ -128,11 +32,53 @@
</td>
</tr>
<tr>
<td class="padding-y-8-px">
{{ 'Sensitive filter'|trans }}
<td class="padding-t-16-px">{{ 'Language' | trans }}</td>
<td class="padding-t-16-px">
<select name="locale">
{% for locale in locales %}
{% if locale == user.locale %}
<option value="{{ locale }}" selected="selected">
{{ locale|locale_name(locale)|u.title }}
</option>
{% else %}
<option value="{{ locale }}">
{{ locale|locale_name(locale)|u.title }}
</option>
{% endif %}
{% endfor %}
</select>
</td>
</tr>
<tr>
<td class="padding-b-8-px border-bottom-default text-right" colspan="2">
{{ 'Search' | trans }}
</td>
</tr>
<tr>
<td class="padding-t-16-px">
{{ 'Languages' | trans }}
</td>
<td class="padding-t-16-px">
{% for locale in locales %}
<div class="padding-y-4-px">
{% if locale in user.locales %}
<input name="locales[]" id="{{ locale }}" type="checkbox" value="{{ locale }}" checked="checked" />
{% else %}
<input name="locales[]" id="{{ locale }}" type="checkbox" value="{{ locale }}" />
{% endif %}
<label for="{{ locale }}">
{{ locale|locale_name(locale)|u.title }}
</label>
</div>
{% endfor %}
</td>
</tr>
<tr>
<td class="padding-t-8-px">
{{ 'Sensitive' | trans }}
</td>
<td>
<div class="padding-y-8-px">
<div class="padding-t-8-px">
{% if user.sensitive %}
<input name="sensitive" type="checkbox" value="true" checked="checked" />
{% else %}
@ -141,6 +87,49 @@
</div>
</td>
</tr>
<tr>
<td class="padding-b-8-px border-bottom-default text-right" colspan="2">
{{ 'Events' | trans }}
</td>
</tr>
{% for group, event in events %}
<tr>
<td class="padding-t-16-px">
{{ group }}
</td>
<td class="padding-t-16-px">
{% for key, value in event %}
<span class="margin-r-8-px">
{% if value in user.events %}
<input name="events[]" id="event-{{ value }}" type="checkbox" value="{{ value }}" checked="checked" />
{% else %}
<input name="events[]" id="event-{{ value }}" type="checkbox" value="{{ value }}" />
{% endif %}
<label for="event-{{ value }}">
{{ key }}
</label>
</span>
{% endfor %}
</td>
</tr>
{% endfor %}
<tr>
<td class="padding-b-8-px border-bottom-default text-right" colspan="2">
{{ 'Downloads' | trans }}
</td>
</tr>
<tr>
<td class="padding-y-16-px">
{{ 'Yggdrasil filter' | trans }}
</td>
<td class="padding-y-16-px">
{% if user.yggdrasil %}
<input name="yggdrasil" type="checkbox" value="true" checked="checked" />
{% else %}
<input name="yggdrasil" type="checkbox" value="true" />
{% endif %}
</td>
</tr>
</tbody>
</table>
<div class="text-right">