mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-16 22:42:16 +00:00
StV: Font Size setting
This commit is contained in:
@@ -64,6 +64,7 @@ class Config extends FHCAPI_Controller
|
||||
|
||||
$config = [];
|
||||
|
||||
#number_displayed_past_studiensemester
|
||||
$result = $this->VariableModel->getVariables(getAuthUID(), ['number_displayed_past_studiensemester']);
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
@@ -76,6 +77,21 @@ class Config extends FHCAPI_Controller
|
||||
?? $number_displayed_past_studiensemester_default
|
||||
];
|
||||
|
||||
#font_size
|
||||
$result = $this->VariableModel->getVariables(getAuthUID(), ['stv_font_size']);
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
$config['font_size'] = [
|
||||
"type" => "select",
|
||||
"label" => "Font size",
|
||||
"value" => $data['stv_font_size'] ?? "fs_normal",
|
||||
"options" => [
|
||||
"fs_small" => "klein",// TODO(chris): phrase
|
||||
"fs_normal" => "normal",// TODO(chris): phrase
|
||||
"fs_big" => "groß",// TODO(chris): phrase
|
||||
"fs_huge" => "sehr groß"// TODO(chris): phrase
|
||||
]
|
||||
];
|
||||
|
||||
// TODO(chris): Event
|
||||
|
||||
$this->terminateWithSuccess($config);
|
||||
@@ -86,7 +102,6 @@ class Config extends FHCAPI_Controller
|
||||
*/
|
||||
public function set()
|
||||
{
|
||||
// TODO(chris): rewrite to batch saving
|
||||
$this->load->model('system/Variable_model', 'VariableModel');
|
||||
$this->load->library('form_validation');
|
||||
|
||||
@@ -95,6 +110,11 @@ class Config extends FHCAPI_Controller
|
||||
"Anzahl angezeigter vergangender Studiensemester",// TODO(chris): phrase
|
||||
'required|integer'
|
||||
);
|
||||
$this->form_validation->set_rules(
|
||||
'font_size',
|
||||
"Font size",// TODO(chris): phrase
|
||||
'required|in_list[fs_small,fs_normal,fs_big,fs_huge]'
|
||||
);
|
||||
|
||||
// TODO(chris): Event
|
||||
|
||||
@@ -107,6 +127,11 @@ class Config extends FHCAPI_Controller
|
||||
'number_displayed_past_studiensemester',
|
||||
$this->input->post('number_displayed_past_studiensemester')
|
||||
);
|
||||
$this->VariableModel->setVariable(
|
||||
getAuthUID(),
|
||||
'stv_font_size',
|
||||
$this->input->post('font_size')
|
||||
);
|
||||
|
||||
// TODO(chris): Event
|
||||
|
||||
|
||||
@@ -9,6 +9,18 @@
|
||||
html {
|
||||
font-size: .875em;
|
||||
}
|
||||
html.fs_small {
|
||||
font-size: .5em;
|
||||
}
|
||||
html.fs_normal {
|
||||
font-size: .875em;
|
||||
}
|
||||
html.fs_big {
|
||||
font-size: 1em;
|
||||
}
|
||||
html.fs_huge {
|
||||
font-size: 1.4em;
|
||||
}
|
||||
|
||||
.navbar-dark .navbar-brand:focus {
|
||||
box-shadow: 0 0 0 .25rem rgba(13,110,253,.25);
|
||||
|
||||
@@ -152,6 +152,22 @@ export default {
|
||||
},
|
||||
'url_mode': function () {
|
||||
this.handlePersonUrl();
|
||||
},
|
||||
'appconfig.font_size'() {
|
||||
// add to html class
|
||||
const classList = Object.keys(this.$refs.config.setup.font_size.options);
|
||||
classList.forEach(cn => document.documentElement.classList.remove(cn));
|
||||
document.documentElement.classList.add(this.appconfig.font_size);
|
||||
// recalc Tabulator heights
|
||||
if (this.$el) {
|
||||
const tabulatorEls = this.$el.querySelectorAll('.tabulator');
|
||||
for (const el of tabulatorEls) {
|
||||
const tabulators = Tabulator.findTable(el);
|
||||
if (tabulators) {
|
||||
tabulators[0].searchRows().forEach(row => row.normalizeHeight());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -430,6 +446,6 @@ export default {
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
<stv-config v-model="appconfig"></stv-config>
|
||||
<stv-config ref="config" v-model="appconfig"></stv-config>
|
||||
</div>`
|
||||
};
|
||||
|
||||
@@ -60,10 +60,15 @@ export default {
|
||||
.then(res => {
|
||||
this.setup = {};
|
||||
Object.keys(res.data).forEach(key => {
|
||||
const conf = { ...res.data[key] };
|
||||
this.tempValues[key] = conf.value;
|
||||
delete conf.value;
|
||||
this.setup[key] = conf;
|
||||
const binding = { ...res.data[key] };
|
||||
delete binding.value;
|
||||
delete binding.options;
|
||||
const options = res.data[key].options;
|
||||
this.tempValues[key] = res.data[key].value;
|
||||
this.setup[key] = {
|
||||
binding,
|
||||
options
|
||||
};
|
||||
});
|
||||
this.$emit('update:modelValue', { ...this.tempValues });
|
||||
})
|
||||
@@ -80,11 +85,19 @@ export default {
|
||||
>
|
||||
<template #title>{{ $p.t('ui/settings') }}</template>
|
||||
<template #default>
|
||||
<form-input
|
||||
v-for="(value, key) in setup"
|
||||
v-model="tempValues[key]"
|
||||
v-bind="value"
|
||||
></form-input>
|
||||
<div class="d-flex flex-column gap-5">
|
||||
<form-input
|
||||
v-for="(value, key) in setup"
|
||||
v-model="tempValues[key]"
|
||||
v-bind="value.binding"
|
||||
>
|
||||
<option
|
||||
v-for="(label, val) in value.options"
|
||||
:key="val"
|
||||
:value="val"
|
||||
>{{ label }}</option>
|
||||
</form-input>
|
||||
</div>
|
||||
</template>
|
||||
<template #footer>
|
||||
<button class="btn btn-primary" type="submit">
|
||||
|
||||
@@ -85,6 +85,7 @@ require_once('dbupdate_3.4/66982_berufsschule.php');
|
||||
require_once('dbupdate_3.4/40314_electronic_onboarding_anbindung_ida.php');
|
||||
require_once('dbupdate_3.4/47972_pruefungsverwaltung_ects_angabe.php');
|
||||
require_once('dbupdate_3.4/67490_studstatus_suche_abort_controller_haengt.php');
|
||||
require_once('dbupdate_3.4/68744_StV_settings.php');
|
||||
|
||||
// *** Pruefung und hinzufuegen der neuen Attribute und Tabellen
|
||||
echo '<H2>Pruefe Tabellen und Attribute!</H2>';
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
if (!defined('DB_NAME')) exit('No direct script access allowed');
|
||||
|
||||
// Add new name type in public.tbl_variablenname
|
||||
if ($result = @$db->db_query("SELECT 1 FROM public.tbl_variablenname WHERE name = 'stv_font_size';"))
|
||||
{
|
||||
if ($db->db_num_rows($result) == 0)
|
||||
{
|
||||
$qry = "INSERT INTO public.tbl_variablenname(name, defaultwert) VALUES('stv_font_size', null);";
|
||||
|
||||
if (!$db->db_query($qry))
|
||||
echo '<strong>public.tbl_variablenname '.$db->db_last_error().'</strong><br>';
|
||||
else
|
||||
echo 'public.tbl_variablenname: Added name "stv_font_size"<br>';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user