Split "resource" as a dedicated page
This commit is contained in:
parent
accdffa88a
commit
3366237828
|
|
@ -213,6 +213,18 @@ class AdminController extends Controller
|
||||||
Option::set('announcement_'.config('app.locale'), request('announcement'));
|
Option::set('announcement_'.config('app.locale'), request('announcement'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$meta = Option::form('meta', OptionForm::AUTO_DETECT, function ($form) {
|
||||||
|
$form->text('meta_keywords')->hint(OptionForm::AUTO_DETECT);
|
||||||
|
$form->text('meta_description')->hint(OptionForm::AUTO_DETECT);
|
||||||
|
$form->textarea('meta_extras')->rows(6);
|
||||||
|
})->handle();
|
||||||
|
|
||||||
|
return view('admin.options')
|
||||||
|
->with('forms', compact('general', 'announ', 'meta'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function resource()
|
||||||
|
{
|
||||||
$resources = Option::form('resources', OptionForm::AUTO_DETECT, function ($form) {
|
$resources = Option::form('resources', OptionForm::AUTO_DETECT, function ($form) {
|
||||||
$form->checkbox('force_ssl')->label()->hint();
|
$form->checkbox('force_ssl')->label()->hint();
|
||||||
$form->checkbox('auto_detect_asset_url')->label()->description();
|
$form->checkbox('auto_detect_asset_url')->label()->description();
|
||||||
|
|
@ -223,7 +235,7 @@ class AdminController extends Controller
|
||||||
->hint(OptionForm::AUTO_DETECT)
|
->hint(OptionForm::AUTO_DETECT)
|
||||||
->description(OptionForm::AUTO_DETECT);
|
->description(OptionForm::AUTO_DETECT);
|
||||||
})
|
})
|
||||||
->type('warning')
|
->type('primary')
|
||||||
->hint(OptionForm::AUTO_DETECT)
|
->hint(OptionForm::AUTO_DETECT)
|
||||||
->after(function () {
|
->after(function () {
|
||||||
$cdnAddress = request('cdn_address');
|
$cdnAddress = request('cdn_address');
|
||||||
|
|
@ -237,14 +249,8 @@ class AdminController extends Controller
|
||||||
})
|
})
|
||||||
->handle();
|
->handle();
|
||||||
|
|
||||||
$meta = Option::form('meta', OptionForm::AUTO_DETECT, function ($form) {
|
return view('admin.resource')
|
||||||
$form->text('meta_keywords')->hint(OptionForm::AUTO_DETECT);
|
->with('forms', compact('resources'));
|
||||||
$form->text('meta_description')->hint(OptionForm::AUTO_DETECT);
|
|
||||||
$form->textarea('meta_extras')->rows(3);
|
|
||||||
})->handle();
|
|
||||||
|
|
||||||
return view('admin.options')
|
|
||||||
->with('forms', compact('general', 'resources', 'announ', 'meta'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUserData(Request $request)
|
public function getUserData(Request $request)
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,11 @@ $menu['admin'] = [
|
||||||
['title' => 'general.player-manage', 'link' => 'admin/players', 'icon' => 'fa-gamepad'],
|
['title' => 'general.player-manage', 'link' => 'admin/players', 'icon' => 'fa-gamepad'],
|
||||||
['title' => 'general.customize', 'link' => 'admin/customize', 'icon' => 'fa-paint-brush'],
|
['title' => 'general.customize', 'link' => 'admin/customize', 'icon' => 'fa-paint-brush'],
|
||||||
['title' => 'general.score-options', 'link' => 'admin/score', 'icon' => 'fa-credit-card'],
|
['title' => 'general.score-options', 'link' => 'admin/score', 'icon' => 'fa-credit-card'],
|
||||||
|
['title' => 'general.options', 'link' => 'admin/options', 'icon' => 'fa-cog'],
|
||||||
|
['title' => 'general.res-options', 'link' => 'admin/resource', 'icon' => 'fa-atom'],
|
||||||
['title' => 'general.plugin-market', 'link' => 'admin/plugins/market', 'icon' => 'fa-shopping-bag'],
|
['title' => 'general.plugin-market', 'link' => 'admin/plugins/market', 'icon' => 'fa-shopping-bag'],
|
||||||
['title' => 'general.plugin-manage', 'link' => 'admin/plugins/manage', 'icon' => 'fa-plug'],
|
['title' => 'general.plugin-manage', 'link' => 'admin/plugins/manage', 'icon' => 'fa-plug'],
|
||||||
['title' => 'general.plugin-configs', 'id' => 'plugin-configs', 'icon' => 'fa-cogs', 'children' => []],
|
['title' => 'general.plugin-configs', 'id' => 'plugin-configs', 'icon' => 'fa-cogs', 'children' => []],
|
||||||
['title' => 'general.options', 'link' => 'admin/options', 'icon' => 'fa-cog'],
|
|
||||||
['title' => 'general.check-update', 'link' => 'admin/update', 'icon' => 'fa-arrow-up'],
|
['title' => 'general.check-update', 'link' => 'admin/update', 'icon' => 'fa-arrow-up'],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ plugin-configs: Plugin Configs
|
||||||
customize: Customize
|
customize: Customize
|
||||||
options: Options
|
options: Options
|
||||||
score-options: Score Options
|
score-options: Score Options
|
||||||
|
res-options: Resource Options
|
||||||
check-update: Check Update
|
check-update: Check Update
|
||||||
download-update: Download Updates
|
download-update: Download Updates
|
||||||
close: Close
|
close: Close
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ plugin-configs: 插件配置
|
||||||
customize: 个性化
|
customize: 个性化
|
||||||
options: 站点配置
|
options: 站点配置
|
||||||
score-options: 积分配置
|
score-options: 积分配置
|
||||||
|
res-options: 资源配置
|
||||||
check-update: 检查更新
|
check-update: 检查更新
|
||||||
download-update: 下载更新
|
download-update: 下载更新
|
||||||
close: 关闭
|
close: 关闭
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,6 @@
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
{!! $forms['announ']->render() !!}
|
{!! $forms['announ']->render() !!}
|
||||||
|
|
||||||
{!! $forms['resources']->render() !!}
|
|
||||||
|
|
||||||
{!! $forms['meta']->render() !!}
|
{!! $forms['meta']->render() !!}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
32
resources/views/admin/resource.blade.php
Normal file
32
resources/views/admin/resource.blade.php
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
@extends('admin.master')
|
||||||
|
|
||||||
|
@section('title', trans('general.res-options'))
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
|
||||||
|
<!-- Content Wrapper. Contains page content -->
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<!-- Content Header (Page header) -->
|
||||||
|
<section class="content-header">
|
||||||
|
<h1>
|
||||||
|
@lang('general.res-options')
|
||||||
|
</h1>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- Main content -->
|
||||||
|
<section class="content">
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
{!! $forms['resources']->render() !!}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</section><!-- /.content -->
|
||||||
|
</div><!-- /.content-wrapper -->
|
||||||
|
|
||||||
|
@endsection
|
||||||
|
|
@ -103,6 +103,7 @@ Route::group(['middleware' => ['auth', 'admin'], 'prefix' => 'admin'], function
|
||||||
Route::any('/customize', 'AdminController@customize');
|
Route::any('/customize', 'AdminController@customize');
|
||||||
Route::any('/score', 'AdminController@score');
|
Route::any('/score', 'AdminController@score');
|
||||||
Route::any('/options', 'AdminController@options');
|
Route::any('/options', 'AdminController@options');
|
||||||
|
Route::any('/resource', 'AdminController@resource');
|
||||||
|
|
||||||
Route::view('/users', 'admin.users');
|
Route::view('/users', 'admin.users');
|
||||||
Route::any('/user-data', 'AdminController@getUserData');
|
Route::any('/user-data', 'AdminController@getUserData');
|
||||||
|
|
|
||||||
|
|
@ -138,6 +138,19 @@ class AdminControllerTest extends BrowserKitTestCase
|
||||||
$this->assertEquals('announcement', option('announcement'));
|
$this->assertEquals('announcement', option('announcement'));
|
||||||
|
|
||||||
$this->visit('/admin/options')
|
$this->visit('/admin/options')
|
||||||
|
->type('kw', 'meta_keywords')
|
||||||
|
->type('desc', 'meta_description')
|
||||||
|
->type('<!-- nothing -->', 'meta_extras')
|
||||||
|
->press('submit_meta');
|
||||||
|
$this->visit('/')
|
||||||
|
->see('<meta name="keywords" content="kw">')
|
||||||
|
->see('<meta name="description" content="desc">')
|
||||||
|
->see('<!-- nothing -->');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testResource()
|
||||||
|
{
|
||||||
|
$this->visit('/admin/resource')
|
||||||
->check('force_ssl')
|
->check('force_ssl')
|
||||||
->uncheck('auto_detect_asset_url')
|
->uncheck('auto_detect_asset_url')
|
||||||
->check('return_204_when_notfound')
|
->check('return_204_when_notfound')
|
||||||
|
|
@ -150,20 +163,10 @@ class AdminControllerTest extends BrowserKitTestCase
|
||||||
$this->assertEquals('0', option('cache_expire_time'));
|
$this->assertEquals('0', option('cache_expire_time'));
|
||||||
$this->visit('/')->see('url/app/index.js');
|
$this->visit('/')->see('url/app/index.js');
|
||||||
|
|
||||||
$this->visit('/admin/options')
|
$this->visit('/admin/resource')
|
||||||
->type('', 'cdn_address')
|
->type('', 'cdn_address')
|
||||||
->press('submit_resources');
|
->press('submit_resources');
|
||||||
$this->visit('/')->dontSee('url/app/index.js');
|
$this->visit('/')->dontSee('url/app/index.js');
|
||||||
|
|
||||||
$this->visit('/admin/options')
|
|
||||||
->type('kw', 'meta_keywords')
|
|
||||||
->type('desc', 'meta_description')
|
|
||||||
->type('<!-- nothing -->', 'meta_extras')
|
|
||||||
->press('submit_meta');
|
|
||||||
$this->visit('/')
|
|
||||||
->see('<meta name="keywords" content="kw">')
|
|
||||||
->see('<meta name="description" content="desc">')
|
|
||||||
->see('<!-- nothing -->');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testUsers()
|
public function testUsers()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user