Skip to content

Commit f78d6ae

Browse files
committed
[#] 自定义主题优化
1 parent 0e52510 commit f78d6ae

File tree

5 files changed

+69
-28
lines changed

5 files changed

+69
-28
lines changed

app/Http/Controllers/DriveController.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function query(Request $request, $hash = '', $query = '')
9191
}
9292
if ($need_pass) {
9393
$redirect = $redirectQuery;
94-
return view(config('olaindex.theme') . 'password', compact('hash', 'item', 'redirect'));
94+
return view(setting('main_theme', 'default') . '.password', compact('hash', 'item', 'redirect'));
9595
}
9696
}
9797
}
@@ -167,7 +167,7 @@ public function query(Request $request, $hash = '', $query = '')
167167

168168
return redirect()->away($url);
169169
}
170-
return view(config('olaindex.theme') . 'preview' . $view, compact('accounts', 'hash', 'path', 'show', 'file'));
170+
return view(setting('main_theme', 'default') . '.preview' . $view, compact('accounts', 'hash', 'path', 'show', 'file'));
171171
}
172172
}
173173
return redirect()->away($download);
@@ -208,7 +208,7 @@ public function query(Request $request, $hash = '', $query = '')
208208

209209
$list = $this->paginate($list, $perPage, false);
210210

211-
return view(config('olaindex.theme') . 'one' . $view, compact('accounts', 'hash', 'path', 'item', 'list', 'doc', 'keywords'));
211+
return view(setting('main_theme', 'default') . '.one' . $view, compact('accounts', 'hash', 'path', 'item', 'list', 'doc', 'keywords'));
212212
}
213213

214214
/**

app/Http/Controllers/ImageController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class ImageController extends BaseController
2727
*/
2828
public function index()
2929
{
30-
return view(config('olaindex.theme') . 'image');
30+
return view(setting('main_theme', 'default') . '.image');
3131
}
3232

3333
/**

resources/views/default/admin/config.blade.php

+38-23
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,31 @@
11
@php
22
$themes = [
3-
'Cerulean' => 'cerulean',
4-
'Cosmo' => 'cosmo',
5-
'Cyborg' => 'cyborg',
6-
'Darkly' => 'darkly',
7-
'Flatly' => 'flatly',
8-
'Journal' => 'journal',
9-
'Litera' => 'litera',
10-
'Lumen' => 'lumen',
11-
'Materia' => 'materia',
12-
'Lux' => 'lux',
13-
'Minty' => 'minty',
14-
'Pulse' => 'pulse',
15-
'Sandstone' => 'sandstone',
16-
'Simplex' => 'simplex',
17-
'Sketchy' => 'sketchy',
18-
'Slate' => 'slate',
19-
'Solar' => 'solar',
20-
'Spacelab' => 'spacelab',
21-
'Superhero' => 'superhero',
22-
'United' => 'united',
23-
'Yeti' => 'yeti',
24-
];
3+
'Cerulean' => 'cerulean',
4+
'Cosmo' => 'cosmo',
5+
'Cyborg' => 'cyborg',
6+
'Darkly' => 'darkly',
7+
'Flatly' => 'flatly',
8+
'Journal' => 'journal',
9+
'Litera' => 'litera',
10+
'Lumen' => 'lumen',
11+
'Materia' => 'materia',
12+
'Lux' => 'lux',
13+
'Minty' => 'minty',
14+
'Pulse' => 'pulse',
15+
'Sandstone' => 'sandstone',
16+
'Simplex' => 'simplex',
17+
'Sketchy' => 'sketchy',
18+
'Slate' => 'slate',
19+
'Solar' => 'solar',
20+
'Spacelab' => 'spacelab',
21+
'Superhero' => 'superhero',
22+
'United' => 'united',
23+
'Yeti' => 'yeti',
24+
];
25+
$main_themes = [
26+
'default' => 'default',
27+
'mdui' => 'mdui',
28+
];
2529
@endphp
2630
@extends('default.layouts.main')
2731
@section('title', '设置')
@@ -54,7 +58,7 @@
5458
value="{{ setting('site_name','OLAINDEX') }}">
5559
</div>
5660
<div class="form-group">
57-
<label class="form-control-label" for="site_theme"><b>显示主题</b></label>
61+
<label class="form-control-label" for="site_theme"><b>全局主题</b></label>
5862
<select class="custom-select" name="site_theme" id="site_theme">
5963
@foreach( $themes as $name => $theme)
6064
<option value="{{ $theme }}"
@@ -64,6 +68,17 @@
6468
@endforeach
6569
</select>
6670
</div>
71+
<div class="form-group">
72+
<label class="form-control-label" for="main_theme"><b>显示主题</b></label>
73+
<select class="custom-select" name="main_theme" id="main_theme">
74+
@foreach( $main_themes as $name => $theme)
75+
<option value="{{ $theme }}"
76+
@if(setting('main_theme') === $theme) selected @endif>
77+
{{ $name }}
78+
</option>
79+
@endforeach
80+
</select>
81+
</div>
6782
<div class="form-group">
6883
<label class="form-control-label" for="cache_expires">网盘资源缓存时间(秒)</label>
6984
<input type="text" class="form-control" id="cache_expires" name="cache_expires"
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
@extends('mdui.layouts.main')
2+
@section('content')
3+
<div class="mdui-container mdui-m-t-5">
4+
<div class="mdui-row mdui-m-t-3">
5+
<div class="mdui-col-xs-10 mdui-col-offset-xs-1">
6+
<div class="mdui-card">
7+
<div class="mdui-card-media">
8+
<img src="https://i.loli.net/2018/12/07/5c09d18d9b255.png" alt=""/>
9+
<div class="mdui-card-media-covered">
10+
<div class="mdui-card-primary">
11+
<div class="mdui-card-primary-title">OLAINDEX</div>
12+
<div class="mdui-card-primary-subtitle">✨ Another OneDrive Directory Index.</div>
13+
</div>
14+
</div>
15+
</div>
16+
<div class="mdui-card-actions">
17+
<a class="mdui-btn mdui-ripple" href="{{ route('home') }}"><i class="mdui-icon material-icons">subdirectory_arrow_left</i>
18+
返回首页</a>
19+
</div>
20+
</div>
21+
</div>
22+
</div>
23+
24+
</div>
25+
@stop
26+

routes/web.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
|
1818
*/
1919
// 消息通知
20-
Route::view('message', config('olaindex.theme') . 'message')->name('message');
20+
Route::view('message', setting('main_theme', 'default') . '.message')->name('message');
2121
// 授权回调
2222
Route::get('callback', 'AuthController@callback')->name('callback');
2323
// 登录登出

0 commit comments

Comments
 (0)