From b873ffef9cad618ad5c07aea67916a648cba3816 Mon Sep 17 00:00:00 2001 From: printempw Date: Mon, 3 Jul 2017 20:54:19 +0800 Subject: [PATCH] Adjust filename of source files --- app/Services/OptionForm.php | 18 +++---- app/helpers.php | 48 +++---------------- gulpfile.js | 30 ++++++------ resources/assets/src/{scripts => js}/admin.js | 2 +- resources/assets/src/{scripts => js}/auth.js | 0 .../assets/src/{scripts => js}/general.js | 0 .../assets/src/{scripts => js}/skinlib.js | 0 resources/assets/src/{scripts => js}/user.js | 0 .../assets/src/{styles => sass}/admin.scss | 0 .../assets/src/{styles => sass}/auth.scss | 0 .../assets/src/{styles => sass}/general.scss | 0 .../assets/src/{styles => sass}/index.scss | 0 .../assets/src/{styles => sass}/install.scss | 0 .../assets/src/{styles => sass}/skinlib.scss | 0 .../assets/src/{styles => sass}/user.scss | 0 resources/views/admin/customize.tpl | 4 +- resources/views/admin/index.tpl | 2 +- resources/views/admin/master.tpl | 8 ++-- resources/views/admin/players.tpl | 9 ++-- resources/views/admin/users.tpl | 9 ++-- resources/views/auth/master.tpl | 7 +-- .../views/common/dependencies/script.tpl | 11 +++++ resources/views/common/dependencies/style.tpl | 13 +++++ .../views/{vendor => common}/language.tpl | 0 .../views/{vendor => common}/manage-panel.tpl | 0 .../{vendor => common}/option-form/addon.tpl | 0 .../option-form/checkbox.tpl | 0 .../{vendor => common}/option-form/group.tpl | 0 .../{vendor => common}/option-form/hint.tpl | 0 .../{vendor => common}/option-form/item.tpl | 0 .../{vendor => common}/option-form/main.tpl | 4 +- .../{vendor => common}/option-form/select.tpl | 0 .../{vendor => common}/option-form/text.tpl | 0 .../option-form/textarea.tpl | 0 .../{vendor => common}/texture-preview.tpl | 4 +- .../views/{vendor => common}/user-menu.tpl | 0 resources/views/errors/general.tpl | 2 +- resources/views/index.tpl | 10 ++-- resources/views/setup/master.tpl | 2 +- resources/views/skinlib/master.tpl | 10 ++-- resources/views/skinlib/show.tpl | 6 +-- resources/views/skinlib/upload.tpl | 2 +- resources/views/user/closet.tpl | 2 +- resources/views/user/master.tpl | 8 ++-- resources/views/user/player.tpl | 4 +- 45 files changed, 104 insertions(+), 111 deletions(-) rename resources/assets/src/{scripts => js}/admin.js (99%) rename resources/assets/src/{scripts => js}/auth.js (100%) rename resources/assets/src/{scripts => js}/general.js (100%) rename resources/assets/src/{scripts => js}/skinlib.js (100%) rename resources/assets/src/{scripts => js}/user.js (100%) rename resources/assets/src/{styles => sass}/admin.scss (100%) rename resources/assets/src/{styles => sass}/auth.scss (100%) rename resources/assets/src/{styles => sass}/general.scss (100%) rename resources/assets/src/{styles => sass}/index.scss (100%) rename resources/assets/src/{styles => sass}/install.scss (100%) rename resources/assets/src/{styles => sass}/skinlib.scss (100%) rename resources/assets/src/{styles => sass}/user.scss (100%) create mode 100644 resources/views/common/dependencies/script.tpl create mode 100644 resources/views/common/dependencies/style.tpl rename resources/views/{vendor => common}/language.tpl (100%) rename resources/views/{vendor => common}/manage-panel.tpl (100%) rename resources/views/{vendor => common}/option-form/addon.tpl (100%) rename resources/views/{vendor => common}/option-form/checkbox.tpl (100%) rename resources/views/{vendor => common}/option-form/group.tpl (100%) rename resources/views/{vendor => common}/option-form/hint.tpl (100%) rename resources/views/{vendor => common}/option-form/item.tpl (100%) rename resources/views/{vendor => common}/option-form/main.tpl (90%) rename resources/views/{vendor => common}/option-form/select.tpl (100%) rename resources/views/{vendor => common}/option-form/text.tpl (100%) rename resources/views/{vendor => common}/option-form/textarea.tpl (100%) rename resources/views/{vendor => common}/texture-preview.tpl (97%) rename resources/views/{vendor => common}/user-menu.tpl (100%) diff --git a/app/Services/OptionForm.php b/app/Services/OptionForm.php index b618cff2..edc25922 100644 --- a/app/Services/OptionForm.php +++ b/app/Services/OptionForm.php @@ -106,7 +106,7 @@ class OptionForm $hintContent = trans("options.$this->id.hint"); } - $this->hint = view('vendor.option-form.hint')->with('hint', $hintContent)->render(); + $this->hint = view('common.option-form.hint')->with('hint', $hintContent)->render(); return $this; } @@ -358,7 +358,7 @@ class OptionForm $this->assignValues(); - return view('vendor.option-form.main')->with(array_merge(get_object_vars($this)))->render(); + return view('common.option-form.main')->with(array_merge(get_object_vars($this)))->render(); } /** @@ -414,7 +414,7 @@ class OptionFormItem $hintContent = trans("options.$this->parentId.$this->id.hint"); } - $this->hint = view('vendor.option-form.hint')->with('hint', $hintContent)->render(); + $this->hint = view('common.option-form.hint')->with('hint', $hintContent)->render(); return $this; } @@ -453,7 +453,7 @@ class OptionFormText extends OptionFormItem { public function render() { - return view('vendor.option-form.text')->with([ + return view('common.option-form.text')->with([ 'id' => $this->id, 'value' => $this->value, 'disabled' => $this->disabled @@ -478,7 +478,7 @@ class OptionFormCheckbox extends OptionFormItem public function render() { - return view('vendor.option-form.checkbox')->with([ + return view('common.option-form.checkbox')->with([ 'id' => $this->id, 'value' => $this->value, 'label' => $this->label, @@ -500,7 +500,7 @@ class OptionFormTextarea extends OptionFormItem public function render() { - return view('vendor.option-form.textarea')->with([ + return view('common.option-form.textarea')->with([ 'id' => $this->id, 'rows' => $this->rows, 'value' => $this->value, @@ -522,7 +522,7 @@ class OptionFormSelect extends OptionFormItem public function render() { - return view('vendor.option-form.select')->with([ + return view('common.option-form.select')->with([ 'id' => $this->id, 'options' => $this->options, 'selected' => $this->value, @@ -562,12 +562,12 @@ class OptionFormGroup extends OptionFormItem $item['value'] = option($item['id']); } - $rendered[] = view('vendor.option-form.'.$item['type'])->with([ + $rendered[] = view('common.option-form.'.$item['type'])->with([ 'id' => $item['id'], 'value' => $item['value'] ]); } - return view('vendor.option-form.group')->with('items', $rendered); + return view('common.option-form.group')->with('items', $rendered); } } diff --git a/app/helpers.php b/app/helpers.php index ca1955e6..a4895f0f 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -39,7 +39,7 @@ if (! function_exists('assets')) { function assets($relativeUri) { // add query string to fresh cache - if (Str::startsWith($relativeUri, 'styles') || Str::startsWith($relativeUri, 'scripts')) { + if (Str::startsWith($relativeUri, 'css') || Str::startsWith($relativeUri, 'js')) { return url("resources/assets/dist/$relativeUri")."?v=".config('app.version'); } elseif (Str::startsWith($relativeUri, 'lang')) { return url("resources/$relativeUri"); @@ -92,61 +92,27 @@ if (! function_exists('json')) { } } -if (! function_exists('bs_footer')) { +if (! function_exists('bs_footer_extra')) { - function bs_footer($page_identification = "") + function bs_footer_extra() { - $content = ""; - - $scripts = [ - assets('scripts/app.min.js'), - assets('lang/'.config('app.locale').'/locale.js'), - ]; - - if ($page_identification !== "") { - $scripts[] = assets("scripts/$page_identification.js"); - } - - foreach ($scripts as $script) { - $content .= "\n"; - } - - $content .= ''; - $extraContents = []; Event::fire(new App\Events\RenderingFooter($extraContents)); - return $content . implode("\n", $extraContents); + return implode("\n", $extraContents); } } -if (! function_exists('bs_header')) { +if (! function_exists('bs_header_extra')) { - function bs_header($page_identification = "") + function bs_header_extra() { - $content = ""; - - $styles = [ - assets('styles/app.min.css'), - assets('styles/skins/'.Option::get('color_scheme').'.min.css') - ]; - - if ($page_identification !== "") { - $styles[] = assets("styles/$page_identification.css"); - } - - foreach ($styles as $style) { - $content .= "\n"; - } - - $content .= ''; - $extraContents = []; Event::fire(new App\Events\RenderingHeader($extraContents)); - return $content . implode("\n", $extraContents); + return implode("\n", $extraContents); } } diff --git a/gulpfile.js b/gulpfile.js index 3230914c..09ecb56c 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -36,7 +36,7 @@ var vendorScripts = [ 'es6-promise/dist/es6-promise.auto.min.js', 'sweetalert2/dist/sweetalert2.min.js', 'jqPaginator/dist/1.2.0/jqPaginator.min.js', - 'resources/assets/dist/scripts/general.js', + 'resources/assets/dist/js/general.js', ]; var vendorStyles = [ @@ -83,38 +83,36 @@ elixir((mix) => { .task('compile-es6') .task('compile-sass') - .scripts(convertNpmRelativePath(vendorScripts), distPath + 'scripts/app.min.js', './') - .styles(convertNpmRelativePath(vendorStyles), distPath + 'styles/app.min.css', './') - .replace(distPath + 'styles/app.min.css', styleReplacements) - .replace(distPath + 'scripts/app.min.js', scriptReplacements) + .scripts(convertNpmRelativePath(vendorScripts), distPath + 'js/app.js', './') + .styles(convertNpmRelativePath(vendorStyles), distPath + 'css/style.css', './') + .replace(distPath + 'css/style.css', styleReplacements) + .replace(distPath + 'js/app.js', scriptReplacements) // copy fonts & images .copy(convertNpmRelativePath(fonts), distPath + 'fonts/') .copy(convertNpmRelativePath(images), distPath + 'images/') - .copy(convertNpmRelativePath(['admin-lte/dist/css/skins']), distPath + 'styles/skins') + .copy(convertNpmRelativePath(['admin-lte/dist/css/skins']), distPath + 'css/skins') .copy( ['skin-preview/**', 'Chart.min.js'].map(relativePath => `${srcPath}vendor/${relativePath}`), - distPath + 'scripts/' + distPath + 'js/' ); }); // compile sass gulp.task('compile-sass', () => { - gulp.src(srcPath + 'styles/*.scss') + gulp.src(srcPath + 'sass/*.scss') .pipe(sass().on('error', sass.logError)) .pipe(cleanCss()) - .pipe(gulp.dest(distPath + 'styles')); + .pipe(gulp.dest(distPath + 'css')); }); gulp.task('compile-es6', () => { - gulp.src(srcPath + 'scripts/*.js') + gulp.src(srcPath + 'js/*.js') .pipe(babel({ presets: ['es2015'] })) .pipe(uglify()) - .pipe(gulp.dest(distPath + 'scripts')); + .pipe(gulp.dest(distPath + 'js')); }); -gulp.task - // delete cache files gulp.task('clear', () => { clearCache(); @@ -168,10 +166,10 @@ gulp.task('zip', () => { gulp.task('watch', () => { // watch .scss files - gulp.watch(srcPath + 'styles/*.scss', ['compile-sass'], () => notify({ message: 'Sass files compiled!' })); + gulp.watch(srcPath + 'sass/*.scss', ['compile-sass'], () => notify({ message: 'Sass files compiled!' })); // watch .js files - gulp.watch(srcPath + 'scripts/*.js', ['compile-es6'], () => notify({ message: 'ES6 scripts compiled!' })); - gulp.watch(srcPath + 'scripts/general.js', ['scripts']); + gulp.watch(srcPath + 'js/*.js', ['compile-es6'], () => notify({ message: 'ES6 scripts compiled!' })); + gulp.watch(srcPath + 'js/general.js', ['scripts']); }); function convertNpmRelativePath(paths) { diff --git a/resources/assets/src/scripts/admin.js b/resources/assets/src/js/admin.js similarity index 99% rename from resources/assets/src/scripts/admin.js rename to resources/assets/src/js/admin.js index d63bbc4d..f8d1ee3f 100644 --- a/resources/assets/src/scripts/admin.js +++ b/resources/assets/src/js/admin.js @@ -19,7 +19,7 @@ $(document).ready(function() { }); $.extend(true, $.fn.dataTable.defaults, { - language: trans('vendor.datatables'), + language: trans('common.datatables'), scrollX: true, pageLength: 25, autoWidth: false, diff --git a/resources/assets/src/scripts/auth.js b/resources/assets/src/js/auth.js similarity index 100% rename from resources/assets/src/scripts/auth.js rename to resources/assets/src/js/auth.js diff --git a/resources/assets/src/scripts/general.js b/resources/assets/src/js/general.js similarity index 100% rename from resources/assets/src/scripts/general.js rename to resources/assets/src/js/general.js diff --git a/resources/assets/src/scripts/skinlib.js b/resources/assets/src/js/skinlib.js similarity index 100% rename from resources/assets/src/scripts/skinlib.js rename to resources/assets/src/js/skinlib.js diff --git a/resources/assets/src/scripts/user.js b/resources/assets/src/js/user.js similarity index 100% rename from resources/assets/src/scripts/user.js rename to resources/assets/src/js/user.js diff --git a/resources/assets/src/styles/admin.scss b/resources/assets/src/sass/admin.scss similarity index 100% rename from resources/assets/src/styles/admin.scss rename to resources/assets/src/sass/admin.scss diff --git a/resources/assets/src/styles/auth.scss b/resources/assets/src/sass/auth.scss similarity index 100% rename from resources/assets/src/styles/auth.scss rename to resources/assets/src/sass/auth.scss diff --git a/resources/assets/src/styles/general.scss b/resources/assets/src/sass/general.scss similarity index 100% rename from resources/assets/src/styles/general.scss rename to resources/assets/src/sass/general.scss diff --git a/resources/assets/src/styles/index.scss b/resources/assets/src/sass/index.scss similarity index 100% rename from resources/assets/src/styles/index.scss rename to resources/assets/src/sass/index.scss diff --git a/resources/assets/src/styles/install.scss b/resources/assets/src/sass/install.scss similarity index 100% rename from resources/assets/src/styles/install.scss rename to resources/assets/src/sass/install.scss diff --git a/resources/assets/src/styles/skinlib.scss b/resources/assets/src/sass/skinlib.scss similarity index 100% rename from resources/assets/src/styles/skinlib.scss rename to resources/assets/src/sass/skinlib.scss diff --git a/resources/assets/src/styles/user.scss b/resources/assets/src/sass/user.scss similarity index 100% rename from resources/assets/src/styles/user.scss rename to resources/assets/src/sass/user.scss diff --git a/resources/views/admin/customize.tpl b/resources/views/admin/customize.tpl index 5b6b617d..7c66899d 100644 --- a/resources/views/admin/customize.tpl +++ b/resources/views/admin/customize.tpl @@ -3,7 +3,7 @@ @section('title', trans('general.customize')) @section('style') - + @endsection @section('content') @@ -63,5 +63,3 @@ var current_skin = "{{ option('color_scheme') }}"; @endsection - - diff --git a/resources/views/admin/index.tpl b/resources/views/admin/index.tpl index d80ecac5..4669ace2 100644 --- a/resources/views/admin/index.tpl +++ b/resources/views/admin/index.tpl @@ -82,7 +82,7 @@ - + @endsection diff --git a/resources/views/admin/master.tpl b/resources/views/admin/master.tpl index e96356ba..63b38a51 100644 --- a/resources/views/admin/master.tpl +++ b/resources/views/admin/master.tpl @@ -8,7 +8,7 @@ - {!! bs_header('admin') !!} + @include('common.dependencies.style', ['module' => 'admin']) @yield('style') @@ -38,9 +38,9 @@ @@ -89,7 +89,7 @@ - {!! bs_footer('admin') !!} + @include('common.dependencies.script', ['module' => 'admin']) @if (option('check_update')) @endsection diff --git a/resources/views/admin/users.tpl b/resources/views/admin/users.tpl index 8c1bc779..7483e1bd 100644 --- a/resources/views/admin/users.tpl +++ b/resources/views/admin/users.tpl @@ -40,8 +40,11 @@ @section('script') @endsection diff --git a/resources/views/auth/master.tpl b/resources/views/auth/master.tpl index 213bf259..2b728801 100644 --- a/resources/views/auth/master.tpl +++ b/resources/views/auth/master.tpl @@ -7,8 +7,9 @@ {!! bs_favicon() !!} - {!! bs_header('auth') !!} - + @include('common.dependencies.style', ['module' => 'auth']) + + @@ -21,7 +22,7 @@ - {!! bs_footer('auth') !!} + @include('common.dependencies.script', ['module' => 'auth']) @yield('script') diff --git a/resources/views/common/dependencies/script.tpl b/resources/views/common/dependencies/script.tpl new file mode 100644 index 00000000..a4840428 --- /dev/null +++ b/resources/views/common/dependencies/script.tpl @@ -0,0 +1,11 @@ + + + +@if (isset($module)) + +@endif + + + +{{-- Content added by plugins dynamically --}} +{!! bs_footer_extra() !!} diff --git a/resources/views/common/dependencies/style.tpl b/resources/views/common/dependencies/style.tpl new file mode 100644 index 00000000..700c1946 --- /dev/null +++ b/resources/views/common/dependencies/style.tpl @@ -0,0 +1,13 @@ + + + + + +@if (isset($module)) + +@endif + + + +{{-- Content added by plugins dynamically --}} +{!! bs_header_extra() !!} diff --git a/resources/views/vendor/language.tpl b/resources/views/common/language.tpl similarity index 100% rename from resources/views/vendor/language.tpl rename to resources/views/common/language.tpl diff --git a/resources/views/vendor/manage-panel.tpl b/resources/views/common/manage-panel.tpl similarity index 100% rename from resources/views/vendor/manage-panel.tpl rename to resources/views/common/manage-panel.tpl diff --git a/resources/views/vendor/option-form/addon.tpl b/resources/views/common/option-form/addon.tpl similarity index 100% rename from resources/views/vendor/option-form/addon.tpl rename to resources/views/common/option-form/addon.tpl diff --git a/resources/views/vendor/option-form/checkbox.tpl b/resources/views/common/option-form/checkbox.tpl similarity index 100% rename from resources/views/vendor/option-form/checkbox.tpl rename to resources/views/common/option-form/checkbox.tpl diff --git a/resources/views/vendor/option-form/group.tpl b/resources/views/common/option-form/group.tpl similarity index 100% rename from resources/views/vendor/option-form/group.tpl rename to resources/views/common/option-form/group.tpl diff --git a/resources/views/vendor/option-form/hint.tpl b/resources/views/common/option-form/hint.tpl similarity index 100% rename from resources/views/vendor/option-form/hint.tpl rename to resources/views/common/option-form/hint.tpl diff --git a/resources/views/vendor/option-form/item.tpl b/resources/views/common/option-form/item.tpl similarity index 100% rename from resources/views/vendor/option-form/item.tpl rename to resources/views/common/option-form/item.tpl diff --git a/resources/views/vendor/option-form/main.tpl b/resources/views/common/option-form/main.tpl similarity index 90% rename from resources/views/vendor/option-form/main.tpl rename to resources/views/common/option-form/main.tpl index db6ca41c..058c4ae1 100644 --- a/resources/views/vendor/option-form/main.tpl +++ b/resources/views/common/option-form/main.tpl @@ -11,7 +11,7 @@ @endforeach @if ($renderWithOutTable) - @each('vendor.option-form.item', $items, 'item') + @each('common.option-form.item', $items, 'item') @else @@ -22,7 +22,7 @@ @endunless @endforeach diff --git a/resources/views/vendor/option-form/select.tpl b/resources/views/common/option-form/select.tpl similarity index 100% rename from resources/views/vendor/option-form/select.tpl rename to resources/views/common/option-form/select.tpl diff --git a/resources/views/vendor/option-form/text.tpl b/resources/views/common/option-form/text.tpl similarity index 100% rename from resources/views/vendor/option-form/text.tpl rename to resources/views/common/option-form/text.tpl diff --git a/resources/views/vendor/option-form/textarea.tpl b/resources/views/common/option-form/textarea.tpl similarity index 100% rename from resources/views/vendor/option-form/textarea.tpl rename to resources/views/common/option-form/textarea.tpl diff --git a/resources/views/vendor/texture-preview.tpl b/resources/views/common/texture-preview.tpl similarity index 97% rename from resources/views/vendor/texture-preview.tpl rename to resources/views/common/texture-preview.tpl index 3d20fe58..7443ebcb 100644 --- a/resources/views/vendor/texture-preview.tpl +++ b/resources/views/common/texture-preview.tpl @@ -14,8 +14,8 @@ - - + + @@ -42,10 +42,10 @@ - {!! bs_footer() !!} + @include('common.dependencies.script', ['module' => 'index']) - + + @endsection
- @include('vendor.option-form.item', compact('item')) + @include('common.option-form.item', compact('item'))