Added a theme selector to the new config page
This commit is contained in:
parent
00ab249476
commit
a386d1b893
@ -16,6 +16,39 @@ class ConfigHelper
|
||||
];
|
||||
}
|
||||
|
||||
public function allowedThemeNames()
|
||||
{
|
||||
$results = [];
|
||||
|
||||
$directoryIterator = new \FilesystemIterator(dirname(dirname(__DIR__)) . '/resources/views/themes', \FilesystemIterator::SKIP_DOTS);
|
||||
|
||||
/** @var \SplFileInfo $fileInfo */
|
||||
foreach ($directoryIterator as $fileInfo)
|
||||
{
|
||||
if (!$fileInfo->isDir() || strtolower($fileInfo->getFilename()) == 'base')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$themeName = strtolower($fileInfo->getFilename());
|
||||
$themeDisplayName = $themeName;
|
||||
|
||||
$themeInfoFilename = sprintf('%s/theme.json', $fileInfo->getPathname());
|
||||
if (file_exists($themeInfoFilename))
|
||||
{
|
||||
$themeInfo = json_decode(file_get_contents($themeInfoFilename));
|
||||
if ($themeInfo !== false && isset($themeInfo->name))
|
||||
{
|
||||
$themeDisplayName = $themeInfo->name;
|
||||
}
|
||||
}
|
||||
|
||||
$results[$themeName] = $themeDisplayName;
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
public function defaults()
|
||||
{
|
||||
return array(
|
||||
|
@ -29,7 +29,8 @@ class DefaultController extends Controller
|
||||
{
|
||||
$updateKeys = [
|
||||
'app_name',
|
||||
'date_format'
|
||||
'date_format',
|
||||
'theme'
|
||||
];
|
||||
|
||||
foreach ($updateKeys as $key)
|
||||
@ -58,10 +59,13 @@ class DefaultController extends Controller
|
||||
$dateFormatsLookup[$dateFormat] = date($dateFormat);
|
||||
}
|
||||
|
||||
$themeNamesLookup = UserConfig::allowedThemeNames();
|
||||
|
||||
return Theme::render('admin.settings', [
|
||||
'config' => $config,
|
||||
'date_formats' => $dateFormatsLookup,
|
||||
'success' => $request->session()->get('success')
|
||||
'success' => $request->session()->get('success'),
|
||||
'theme_names' => $themeNamesLookup
|
||||
]);
|
||||
}
|
||||
}
|
1
public/themes/bootstrap3-light/theme.css
vendored
Normal file
1
public/themes/bootstrap3-light/theme.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
@import url('../bootstrap3/theme.css');
|
@ -32,6 +32,15 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-4">
|
||||
<div class="form-group">
|
||||
{!! Form::label('theme', 'Theme:', ['class' => 'control-label']) !!}
|
||||
{!! Form::select('theme', $theme_names, old('theme'), ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user