Add right to left option for users

This commit is contained in:
= 2024-10-12 12:53:56 -04:00
parent 0572c0a91d
commit 6c6d9d00ab
5 changed files with 33 additions and 1 deletions

View File

@ -82,6 +82,10 @@ class UsersController:
}, },
"manager": {"type": ["integer", "null"]}, "manager": {"type": ["integer", "null"]},
"theme": {"type": "string"}, "theme": {"type": "string"},
"lang_dir": {
"type": "string",
"enum": ["ltr", "rtl"],
},
"permissions": { "permissions": {
"type": "array", "type": "array",
"items": { "items": {

View File

@ -41,6 +41,7 @@ class Users(BaseModel):
valid_tokens_from = DateTimeField(default=Helpers.get_utc_now) valid_tokens_from = DateTimeField(default=Helpers.get_utc_now)
server_order = CharField(default="") server_order = CharField(default="")
preparing = BooleanField(default=False) preparing = BooleanField(default=False)
lang_dir = CharField(default="ltr")
hints = BooleanField(default=True) hints = BooleanField(default=True)
manager = IntegerField(default=None, null=True) manager = IntegerField(default=None, null=True)
pfp = CharField(default="/static/assets/images/faces-clipart/pic-3.png") pfp = CharField(default="/static/assets/images/faces-clipart/pic-3.png")

View File

@ -1,5 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="{{ data['lang_page'] }}" class="{{data['user_data'].get('theme', 'default')}}" data-username="{{data['user_data'].get('username', None)}}"> <html lang="{{ data['lang_page'] }}" dir="{{data['user_data'].get('lang_dir', 'ltr')}}" class="{{data['user_data'].get('theme', 'default')}}" data-username="{{data['user_data'].get('username', None)}}">
<head> <head>
<!-- Required meta tags --> <!-- Required meta tags -->

View File

@ -129,6 +129,17 @@ data['lang']) }}{% end %}
{% end %} {% end %}
</select> </select>
</div> </div>
<div class="form-group">
<select class="form-select form-control form-control-lg select-css" id="lang_dir"
name="lang_dir" form="user_form">
<option value="{{data['user'].get('lang_dir', 'ltr')}}">{{data['user'].get('lang_dir', 'ltr')}}</option>
{% for dir in ["ltr", "rtl"] %}
{% if dir != data['user'].get('lang_dir', 'ltr') %}
<option value="{{dir}}">{{dir}}</option>
{% end %}
{% end %}
</select>
</div>
<div class="form-group"> <div class="form-group">
<label class="form-label" for="theme">{{ translate('userConfig', 'userTheme', data['lang']) <label class="form-label" for="theme">{{ translate('userConfig', 'userTheme', data['lang'])
}}</label> }}</label>

View File

@ -0,0 +1,16 @@
# Generated by database migrator
import peewee
def migrate(migrator, database, **kwargs):
migrator.add_columns("users", lang_dir=peewee.CharField(default="ltr"))
"""
Write your migrations here.
"""
def rollback(migrator, database, **kwargs):
migrator.drop_columns("users", ["lang_dir"])
"""
Write your rollback migrations here.
"""