mirror of
https://github.com/flarum/framework.git
synced 2024-12-11 21:43:38 +08:00
Move theme config to database
This commit is contained in:
parent
6e1bf0d3de
commit
6b7632cda3
|
@ -1,5 +1,3 @@
|
|||
@import "@{lib-path}/config.less";
|
||||
|
||||
@lib-path: "../lib";
|
||||
|
||||
@import "@{lib-path}/bootstrap.less";
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
// ---------------------------------
|
||||
// CONFIG
|
||||
|
||||
// Color palette:
|
||||
// #8F3B3B #9E5541 #99793F #8F8A49 #778F53 #638F53 #537F8F #536F90 #76538F #8F5373 #797979
|
||||
|
||||
@fl-primary-color: #536F90;
|
||||
@fl-secondary-color: #536F90;
|
||||
|
||||
@fl-dark-mode: false;
|
||||
@fl-colored-hdr: false;
|
|
@ -1,3 +1,8 @@
|
|||
@fl-primary-color: #536F90;
|
||||
@fl-secondary-color: #536F90;
|
||||
@fl-dark-mode: false;
|
||||
@fl-colored-hdr: false;
|
||||
|
||||
// ---------------------------------
|
||||
// HELPERS
|
||||
|
||||
|
@ -22,7 +27,7 @@
|
|||
@fl-shadow-color: rgba(0, 0, 0, 0.35);
|
||||
}
|
||||
.define-body-variables(true) {
|
||||
@fl-body-primary-color: mix(@fl-primary-color, #000);
|
||||
@fl-body-primary-color: mix(@fl-primary-color, #000, 80%);
|
||||
@fl-body-secondary-color: hsl(@fl-secondary-hue, min(20%, @fl-secondary-sat), 13%);
|
||||
|
||||
@fl-body-bg: hsl(@fl-secondary-hue, min(20%, @fl-secondary-sat), 10%);
|
||||
|
|
|
@ -14,12 +14,16 @@ class ConfigTableSeeder extends Seeder
|
|||
public function run()
|
||||
{
|
||||
$config = [
|
||||
'api_url' => 'http://flarum.dev/api',
|
||||
'base_url' => 'http://flarum.dev',
|
||||
'forum_title' => 'Flarum Demo Forum',
|
||||
'welcome_message' => 'Flarum is now at a point where you can have basic conversations, so here is a little demo for you to break.',
|
||||
'welcome_title' => 'Welcome to Flarum Demo Forum',
|
||||
'extensions_enabled' => '[]',
|
||||
'api_url' => 'http://flarum.dev/api',
|
||||
'base_url' => 'http://flarum.dev',
|
||||
'forum_title' => 'Flarum Demo Forum',
|
||||
'welcome_message' => 'Flarum is now at a point where you can have basic conversations, so here is a little demo for you to break.',
|
||||
'welcome_title' => 'Welcome to Flarum Demo Forum',
|
||||
'extensions_enabled' => '[]',
|
||||
'theme_primary_color' => '#536F90',
|
||||
'theme_secondary_color' => '#536F90',
|
||||
'theme_dark_mode' => false,
|
||||
'theme_colored_header' => false,
|
||||
];
|
||||
|
||||
DB::table('config')->insert(array_map(function ($key, $value) {
|
||||
|
|
|
@ -9,6 +9,7 @@ use View;
|
|||
use DB;
|
||||
use Flarum\Forum\Events\RenderView;
|
||||
use Flarum\Api\Request as ApiRequest;
|
||||
use Flarum\Core;
|
||||
|
||||
class IndexAction extends BaseAction
|
||||
{
|
||||
|
@ -36,7 +37,7 @@ class IndexAction extends BaseAction
|
|||
}
|
||||
|
||||
$view = View::make('flarum.forum::index')
|
||||
->with('title', Config::get('flarum::forum_title', 'Flarum Demo Forum'))
|
||||
->with('title', Core::config('forum_title'))
|
||||
->with('config', $config)
|
||||
->with('layout', 'flarum.forum::forum')
|
||||
->with('data', $data)
|
||||
|
@ -49,6 +50,12 @@ class IndexAction extends BaseAction
|
|||
$root.'/js/forum/dist/app.js',
|
||||
$root.'/less/forum/app.less'
|
||||
]);
|
||||
$assetManager->addLess('
|
||||
@fl-primary-color: '.Core::config('theme_primary_color').';
|
||||
@fl-secondary-color: '.Core::config('theme_secondary_color').';
|
||||
@fl-dark-mode: '.(Core::config('theme_dark_mode') ? 'true' : 'false').';
|
||||
@fl-colored_header: '.(Core::config('theme_colored_header') ? 'true' : 'false').';
|
||||
');
|
||||
|
||||
event(new RenderView($view, $assetManager, $this));
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user