4.1 Beta...ish #12

Merged
timw4mail merged 88 commits from develop into master 2018-11-05 13:15:59 -05:00
6 changed files with 45 additions and 49 deletions
Showing only changes of commit e4110f089e - Show all commits

View File

@ -19,16 +19,20 @@ $nestedPrefix = 'config';
<form action="<?= $url->generate('settings-post') ?>" method="POST"> <form action="<?= $url->generate('settings-post') ?>" method="POST">
<main class='form'> <main class='form'>
<button type="submit">Save Changes</button> <button type="submit">Save Changes</button>
<br /> <div class="tabs">
<?php foreach ($form as $section => $fields): ?> <?php $i = 0; ?>
<fieldset class="box">
<legend><?= $sectionMapping[$section] ?></legend>
<section class='form'>
<?php require __DIR__ . '/_form.php' ?>
</section>
</fieldset>
<?php endforeach ?>
<?php foreach ($form as $section => $fields): ?>
<input <?= $i === 0 ? 'checked="checked"' : '' ?> type="radio" id="settings-tab<?= $i ?>"
name="settings-tabs"
/>
<label for="settings-tab<?= $i ?>"><h3><?= $sectionMapping[$section] ?></h3></label>
<section class="content">
<?php require __DIR__ . '/_form.php' ?>
</section>
<?php $i++; ?>
<?php endforeach ?>
</div>
<hr /> <hr />
<?php foreach ($hiddenFields as $field): ?> <?php foreach ($hiddenFields as $field): ?>
<?= $field ?> <?= $field ?>

View File

@ -55,7 +55,7 @@ $overrideConfig = file_exists($overrideFile)
? loadTomlFile($overrideFile) ? loadTomlFile($overrideFile)
: []; : [];
$configArray = array_merge($baseConfig, $config, $overrideConfig); $configArray = array_replace_recursive($baseConfig, $config, $overrideConfig);
$checkedConfig = (new ConfigType($configArray))->toArray(); $checkedConfig = (new ConfigType($configArray))->toArray();
$container = $di($checkedConfig); $container = $di($checkedConfig);

File diff suppressed because one or more lines are too long

View File

@ -861,7 +861,7 @@ CSS Tabs
margin-top: 1.5em; margin-top: 1.5em;
} }
.tabs label { .tabs > label {
border: 1px solid #e5e5e5; border: 1px solid #e5e5e5;
width: 100%; width: 100%;
padding: 20px 30px; padding: 20px 30px;
@ -874,31 +874,31 @@ CSS Tabs
/* margin-left: 4em; */ /* margin-left: 4em; */
} }
.tabs label:hover { .tabs > label:hover {
background: #d8d8d8; background: #d8d8d8;
} }
.tabs label:active { .tabs > label:active {
background: #ccc; background: #ccc;
} }
.tabs [type=radio]:focus + label { .tabs > [type=radio]:focus + label {
box-shadow: inset 0px 0px 0px 3px #2aa1c0; box-shadow: inset 0px 0px 0px 3px #2aa1c0;
z-index: 1; z-index: 1;
} }
.tabs [type=radio] { .tabs > [type=radio] {
position: absolute; position: absolute;
opacity: 0; opacity: 0;
} }
.tabs [type=radio]:checked + label { .tabs > [type=radio]:checked + label {
border-bottom: 1px solid #fff; border-bottom: 1px solid #fff;
background: #fff; background: #fff;
color: #000; color: #000;
} }
.tabs [type=radio]:checked + label + .content { .tabs > [type=radio]:checked + label + .content {
border: 1px solid #e5e5e5; border: 1px solid #e5e5e5;
border-top: 0; border-top: 0;
display: block; display: block;
@ -912,7 +912,7 @@ CSS Tabs
} }
@media (min-width: 600px) { @media (min-width: 600px) {
.tabs label { .tabs > label {
width: auto; width: auto;
} }
@ -921,23 +921,3 @@ CSS Tabs
} }
} }
/* ----------------------------------------------------------------------------
Settings page forms
-----------------------------------------------------------------------------*/
fieldset.box {
display: inline-block;
vertical-align:top;
width:40%;
margin: 2em;
}
fieldset.box section {
margin: 0 auto;
text-align:center;
}
fieldset.box article {
margin: auto;
text-align:left;
}

View File

@ -164,6 +164,9 @@ final class Index extends BaseController {
{ {
$auth = $this->container->get('auth'); $auth = $this->container->get('auth');
$form = $this->settingsModel->getSettingsForm(); $form = $this->settingsModel->getSettingsForm();
// dump($this->session->getFlash('message'));
$this->outputHTML('settings', [ $this->outputHTML('settings', [
'auth' => $auth, 'auth' => $auth,
'form' => $form, 'form' => $form,

View File

@ -45,20 +45,30 @@ final class Settings {
'default' => FALSE, 'default' => FALSE,
'description' => 'Enable syncing data between Kitsu and Anilist. Requires appropriate API keys to be set in config', 'description' => 'Enable syncing data between Kitsu and Anilist. Requires appropriate API keys to be set in config',
], ],
'client_id' => [
'type' => 'string',
'title' => 'Anilist API Client ID',
'default' => '',
'description' => 'The client id for your Anilist API application',
],
'client_secret' => [
'type' => 'string',
'title' => 'Anilist API Client Secret',
'default' => '',
'description' => 'The client secret for your Anilist API application',
],
], ],
'config' => [ 'config' => [
'kitsu_username' => [ 'kitsu_username' => [
'type' => 'string', 'type' => 'string',
'title' => 'Kitsu Username', 'title' => 'Kitsu Username',
'default' => '', 'default' => '',
'readonly' => TRUE,
'description' => 'Username of the account to pull list data from.', 'description' => 'Username of the account to pull list data from.',
], ],
'whose_list' => [ 'whose_list' => [
'type' => 'string', 'type' => 'string',
'title' => 'Whose List', 'title' => 'Whose List',
'default' => 'Somebody', 'default' => 'Somebody',
'readonly' => TRUE,
'description' => 'Name of the owner of the list data.', 'description' => 'Name of the owner of the list data.',
], ],
'show_anime_collection' => [ 'show_anime_collection' => [
@ -73,11 +83,6 @@ final class Settings {
'default' => FALSE, 'default' => FALSE,
'description' => 'Should the manga collection be shown?', 'description' => 'Should the manga collection be shown?',
], ],
'asset_path' => [
'type' => 'string',
'display' => FALSE,
'description' => 'Path to public directory, where images/css/javascript are located',
],
'default_list' => [ 'default_list' => [
'type' => 'select', 'type' => 'select',
'title' => 'Default List', 'title' => 'Default List',
@ -241,17 +246,21 @@ final class Settings {
{ {
foreach($value['fields'] as $k => $field) foreach($value['fields'] as $k => $field)
{ {
$value['fields'][$k]['value'] = $values[$key][$k] ?? ''; $value['fields'][$k]['disabled'] = FALSE;
$value['fields'][$k]['display'] = TRUE; $value['fields'][$k]['display'] = TRUE;
$value['fields'][$k]['readonly'] = FALSE; $value['fields'][$k]['readonly'] = FALSE;
$value['fields'][$k]['disabled'] = FALSE; $value['fields'][$k]['value'] = $values[$key][$k] ?? '';
} }
} }
if (is_scalar($values[$key])) if (array_key_exists($key, $values) && is_scalar($values[$key]))
{ {
$value['value'] = $values[$key]; $value['value'] = $values[$key];
} }
else
{
$value['value'] = $value['default'] ?? '';
}
foreach (['readonly', 'disabled'] as $flag) foreach (['readonly', 'disabled'] as $flag)
{ {