mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2025-01-18 09:05:15 +01:00
Add right to left option for users
This commit is contained in:
parent
0572c0a91d
commit
6c6d9d00ab
@ -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": {
|
||||||
|
@ -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")
|
||||||
|
@ -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 -->
|
||||||
|
@ -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>
|
||||||
|
16
app/migrations/20241012_user_lang_direction.py
Normal file
16
app/migrations/20241012_user_lang_direction.py
Normal 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.
|
||||||
|
"""
|
Loading…
x
Reference in New Issue
Block a user