Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
LibreHomework
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
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
HGEpro
LibreHomework
Commits
5cd1b20b
Commit
5cd1b20b
authored
3 years ago
by
Fabio Polanco
Browse files
Options
Downloads
Patches
Plain Diff
Added minimal settings (just language)
parent
ef47ab44
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/src/App.svelte
+10
-7
10 additions, 7 deletions
app/src/App.svelte
app/src/configmanager.js
+5
-0
5 additions, 0 deletions
app/src/configmanager.js
with
15 additions
and
7 deletions
app/src/App.svelte
+
10
−
7
View file @
5cd1b20b
...
...
@@ -4,7 +4,7 @@ import { fade, fly, slide, scale } from 'svelte/transition';
import
locales
from
"
./locales.json
"
;
import
{
ScreenLock
}
from
"
./screenlock.js
"
;
import
{
ConfigManager
}
from
'
./configmanager.js
'
;
import
{
ConfigManager
,
defaultConfig
}
from
'
./configmanager.js
'
;
import
{
Task
}
from
'
./taskmanager.js
'
;
import
{
Subject
}
from
'
./subjects.js
'
;
...
...
@@ -53,8 +53,11 @@ async function getLangs() {
window
.
getlangs
=
getLangs
;
function
saveSettings
()
{
// TO-DO: Save settings
// I need a method to save settings
let
newSettings
=
defaultConfig
;
newSettings
.
misc
.
lang
=
settings
.
lang
;
// Add other settings later
conf
.
writeConfig
(
newSettings
);
window
.
location
.
reload
();
}
...
...
@@ -327,9 +330,9 @@ function saveSettings() {
<p
class=
"empty-title h4"
in:slide=
"
{
{
delay
:
100
}
}
"
>
{
dict
.
settings
}
</p>
<form
class=
"pt-2"
style=
"width: 60%; margin-left: auto; margin-right: auto;"
>
<!--
<div class="form-group">
<div
class=
"form-group"
>
<label
class=
"form-label"
for=
"language"
>
{
dict
.
language
}
</label>
<select class="form-select" id="language" bind:value={settings.lang}>
<select
class=
"form-select"
style=
"text-align: center;"
id=
"language"
bind:value=
{
settings
.
lang
}
>
<option
selected
>
{
currentLang
}
</option>
{
#each
Object
.
keys
(
locales
)
as
lang
}
{
#if
!
(
lang
==
currentLang
)
}
...
...
@@ -337,10 +340,10 @@ function saveSettings() {
{
/if
}
{
/each
}
</select>
</div>
-->
</div>
</form>
<!--
<button class="btn btn-primary mt-2" on:click={saveSettings}>{dict.save}</button>
-->
<button
class=
"btn btn-primary mt-2"
on:click=
{
saveSettings
}
>
{
dict
.
save
}
</button>
</div>
{
/if
}
...
...
This diff is collapsed.
Click to expand it.
app/src/configmanager.js
+
5
−
0
View file @
5cd1b20b
...
...
@@ -12,4 +12,9 @@ export class ConfigManager {
return
await
invoke
(
"
read_config_file
"
);
}
async
writeConfig
(
config
)
{
// Actually this is not very safe, it might lead to a little self-XSS vuln, but anyway... 😳
return
await
invoke
(
"
write_config_file
"
,
{
"
contents
"
:
JSON
.
stringify
(
config
,
null
,
4
)});
}
}
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