Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
nopaque
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SFB 1288 - INF
nopaque
Commits
7cfa3bd0
Commit
7cfa3bd0
authored
4 years ago
by
Stephan Porada
Browse files
Options
Downloads
Patches
Plain Diff
Change darmode setting
parent
3a05a4d2
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/models.py
+1
-1
1 addition, 1 deletion
app/models.py
app/profile/views.py
+2
-2
2 additions, 2 deletions
app/profile/views.py
app/templates/nopaque.html.j2
+1
-1
1 addition, 1 deletion
app/templates/nopaque.html.j2
with
4 additions
and
4 deletions
app/models.py
+
1
−
1
View file @
7cfa3bd0
...
@@ -109,12 +109,12 @@ class User(UserMixin, db.Model):
...
@@ -109,12 +109,12 @@ class User(UserMixin, db.Model):
registration_date
=
db
.
Column
(
db
.
DateTime
(),
default
=
datetime
.
utcnow
)
registration_date
=
db
.
Column
(
db
.
DateTime
(),
default
=
datetime
.
utcnow
)
role_id
=
db
.
Column
(
db
.
Integer
,
db
.
ForeignKey
(
'
roles.id
'
))
role_id
=
db
.
Column
(
db
.
Integer
,
db
.
ForeignKey
(
'
roles.id
'
))
username
=
db
.
Column
(
db
.
String
(
64
),
unique
=
True
,
index
=
True
)
username
=
db
.
Column
(
db
.
String
(
64
),
unique
=
True
,
index
=
True
)
setting_dark_mode
=
db
.
Column
(
db
.
Boolean
,
default
=
False
)
# Relationships
# Relationships
corpora
=
db
.
relationship
(
'
Corpus
'
,
backref
=
'
creator
'
,
lazy
=
'
dynamic
'
,
corpora
=
db
.
relationship
(
'
Corpus
'
,
backref
=
'
creator
'
,
lazy
=
'
dynamic
'
,
cascade
=
'
save-update, merge, delete
'
)
cascade
=
'
save-update, merge, delete
'
)
jobs
=
db
.
relationship
(
'
Job
'
,
backref
=
'
creator
'
,
lazy
=
'
dynamic
'
,
jobs
=
db
.
relationship
(
'
Job
'
,
backref
=
'
creator
'
,
lazy
=
'
dynamic
'
,
cascade
=
'
save-update, merge, delete
'
)
cascade
=
'
save-update, merge, delete
'
)
is_dark
=
db
.
Column
(
db
.
Boolean
,
default
=
False
)
def
__repr__
(
self
):
def
__repr__
(
self
):
"""
"""
...
...
This diff is collapsed.
Click to expand it.
app/profile/views.py
+
2
−
2
View file @
7cfa3bd0
...
@@ -25,7 +25,7 @@ def settings():
...
@@ -25,7 +25,7 @@ def settings():
# Check if edit_settings_form is submitted and valid
# Check if edit_settings_form is submitted and valid
if
(
edit_general_settings_form
.
save_settings
.
data
if
(
edit_general_settings_form
.
save_settings
.
data
and
edit_general_settings_form
.
validate_on_submit
()):
and
edit_general_settings_form
.
validate_on_submit
()):
current_user
.
is_dark
=
edit_general_settings_form
.
dark_mode
.
data
current_user
.
setting_dark_mode
=
edit_general_settings_form
.
dark_mode
.
data
db
.
session
.
add
(
current_user
)
db
.
session
.
add
(
current_user
)
db
.
session
.
commit
()
db
.
session
.
commit
()
flash
(
'
Your settings have been updated.
'
)
flash
(
'
Your settings have been updated.
'
)
...
@@ -40,7 +40,7 @@ def settings():
...
@@ -40,7 +40,7 @@ def settings():
return
redirect
(
url_for
(
'
profile.settings
'
))
return
redirect
(
url_for
(
'
profile.settings
'
))
# If no form is submitted or valid, fill out fields with current values
# If no form is submitted or valid, fill out fields with current values
edit_email_form
.
email
.
data
=
current_user
.
email
edit_email_form
.
email
.
data
=
current_user
.
email
edit_general_settings_form
.
dark_mode
.
data
=
current_user
.
is_dark
edit_general_settings_form
.
dark_mode
.
data
=
current_user
.
setting_dark_mode
return
render_template
(
return
render_template
(
'
profile/settings.html.j2
'
,
'
profile/settings.html.j2
'
,
edit_email_form
=
edit_email_form
,
edit_email_form
=
edit_email_form
,
...
...
This diff is collapsed.
Click to expand it.
app/templates/nopaque.html.j2
+
1
−
1
View file @
7cfa3bd0
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
<script
src=
"{{ url_for('static', filename='js/nopaque.lists.js') }}"
></script>
<script
src=
"{{ url_for('static', filename='js/nopaque.lists.js') }}"
></script>
<script>
<script>
nopaque
.
user
.
isAuthenticated
=
{{
current_user
.
is_authenticated
|
tojson
}};
nopaque
.
user
.
isAuthenticated
=
{{
current_user
.
is_authenticated
|
tojson
}};
nopaque
.
user
.
settings
.
darkMode
=
{{
(
current_user
.
is_authenticated
and
current_user
.
is_dark
)
|
tojson
}};
nopaque
.
user
.
settings
.
darkMode
=
{{
(
current_user
.
is_authenticated
and
current_user
.
setting_dark_mode
)
|
tojson
}};
nopaque
.
flashedMessages
=
{{
get_flashed_messages
(
with_categories
=
true
)
|
tojson
}};
nopaque
.
flashedMessages
=
{{
get_flashed_messages
(
with_categories
=
true
)
|
tojson
}};
</script>
</script>
</head>
</head>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment