From 3ca85aff8f90ceca198d8d1932ba1c9d03124de4 Mon Sep 17 00:00:00 2001 From: printempw Date: Sat, 31 Dec 2016 11:38:07 +0800 Subject: [PATCH] use jQuery DataTables plugin at user management --- app/Http/Controllers/AdminController.php | 41 +- app/Http/Controllers/PluginController.php | 6 +- app/Http/Routes/web.php | 2 + composer.json | 3 +- composer.lock | 587 ++++++++++++++++-- config/app.php | 1 + config/datatables.php | 98 +++ config/locales.php | 2 +- gulpfile.js | 5 +- resources/assets/src/js/admin.js | 9 +- resources/assets/src/sass/admin.scss | 26 +- resources/assets/src/sass/style.scss | 6 +- resources/lang/en/admin.yml | 4 + resources/lang/en/setup.yml | 15 +- resources/lang/zh_CN/admin.yml | 4 + resources/lang/zh_CN/locale.js | 29 +- resources/lang/zh_CN/setup.yml | 9 +- resources/views/admin/plugins.tpl | 26 +- resources/views/admin/users.tpl | 195 ++---- .../views/vendor/admin-operations/users.tpl | 65 ++ 20 files changed, 843 insertions(+), 290 deletions(-) create mode 100644 config/datatables.php create mode 100644 resources/views/vendor/admin-operations/users.tpl diff --git a/app/Http/Controllers/AdminController.php b/app/Http/Controllers/AdminController.php index 78407af4..c84e7286 100644 --- a/app/Http/Controllers/AdminController.php +++ b/app/Http/Controllers/AdminController.php @@ -5,10 +5,12 @@ namespace App\Http\Controllers; use View; use Utils; use Option; +use Datatables; use App\Events; use App\Models\User; use App\Models\Player; use App\Models\Texture; +use Illuminate\Support\Arr; use Illuminate\Http\Request; use App\Exceptions\PrettyPageException; use App\Services\Repositories\UserRepository; @@ -152,26 +154,31 @@ class AdminController extends Controller */ public function users(Request $request) { - $page = $request->input('page', 1); - $filter = $request->input('filter', ''); - $q = $request->input('q', ''); + return view('admin.users'); + } - if ($filter == "") { - $users = User::orderBy('uid'); - } elseif ($filter == "email") { - $users = User::like('email', $q)->orderBy('uid'); - } elseif ($filter == "nickname") { - $users = User::like('nickname', $q)->orderBy('uid'); - } + public function getUserData() + { + $users = User::select(['uid', 'email', 'nickname', 'score', 'permission', 'register_at']); - $total_pages = ceil($users->count() / 30); - $users = $users->skip(($page - 1) * 30)->take(30)->get(); + $permissionTextMap = [ + User::BANNED => '封禁', + User::NORMAL => '正常', + User::ADMIN => '管理员', + User::SUPER_ADMIN => '超级管理员' + ]; - return view('admin.users')->with('users', $users) - ->with('filter', $filter) - ->with('q', $q) - ->with('page', $page) - ->with('total_pages', $total_pages); + return Datatables::of($users)->editColumn('email', function ($user) { + return $user->email ?: '[未填写邮箱]'; + })->editColumn('permission', function ($user) use ($permissionTextMap) { + return Arr::get($permissionTextMap, $user->permission); + }) + ->setRowId('uid') + ->editColumn('score', function ($user) { + return ''; + }) + ->addColumn('operations', 'vendor.admin-operations.users') + ->make(true); } /** diff --git a/app/Http/Controllers/PluginController.php b/app/Http/Controllers/PluginController.php index a2a99909..27408b34 100644 --- a/app/Http/Controllers/PluginController.php +++ b/app/Http/Controllers/PluginController.php @@ -25,13 +25,13 @@ class PluginController extends Controller case 'enable': $plugins->enable($id); - return redirect('admin/plugins/manage'); + return redirect('admin/plugins/manage')->with('message', trans('admin.plugins.operations.enabled', ['plugin' => $plugin->title])); break; case 'disable': $plugins->disable($id); - return redirect('admin/plugins/manage'); + return redirect('admin/plugins/manage')->with('message', trans('admin.plugins.operations.disabled', ['plugin' => $plugin->title])); break; case 'delete': @@ -40,7 +40,7 @@ class PluginController extends Controller $plugins->uninstall($id); - return json('插件已被成功删除', 0); + return json(trans('admin.plugins.operations.deleted'), 0); } break; diff --git a/app/Http/Routes/web.php b/app/Http/Routes/web.php index 1723bd5c..532302b7 100644 --- a/app/Http/Routes/web.php +++ b/app/Http/Routes/web.php @@ -103,6 +103,8 @@ Route::group(['middleware' => 'admin', 'prefix' => 'admin'], function () Route::any('/options', 'AdminController@options'); Route::get('/users', 'AdminController@users'); + Route::get('/user-data', 'AdminController@getUserData'); + Route::get('/players', 'AdminController@players'); // ajax handlers Route::post('/users', 'AdminController@userAjaxHandler'); diff --git a/composer.json b/composer.json index 2b974d68..60f26d07 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,8 @@ "devitek/yaml-translation": "^2.0", "filp/whoops": "^2.1", "swiggles/memcache": "^2.0", - "erusev/parsedown": "^1.6" + "erusev/parsedown": "^1.6", + "yajra/laravel-datatables-oracle": "~6.0" }, "require-dev": { "fzaninotto/faker": "~1.4", diff --git a/composer.lock b/composer.lock index 48dbd4ae..ef4cb48b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "ff0e4c4559e77429c861ab50fedc8687", - "content-hash": "a2a5139be6747c19447f7f1feb023e1c", + "hash": "cf4826cb5df8157a0004708bed6439d8", + "content-hash": "89d8b3748af3c899e6783a21ea31e8ba", "packages": [ { "name": "classpreloader/classpreloader", @@ -199,6 +199,67 @@ ], "time": "2015-11-06 14:35:42" }, + { + "name": "dompdf/dompdf", + "version": "v0.7.0", + "source": { + "type": "git", + "url": "https://github.com/dompdf/dompdf.git", + "reference": "5c98652b1a5beb7e3cc8ec35419b2828dd63ab14" + }, + "dist": { + "type": "zip", + "url": "https://packagist.phpcomposer.com/files/dompdf/dompdf/5c98652b1a5beb7e3cc8ec35419b2828dd63ab14.zip", + "reference": "5c98652b1a5beb7e3cc8ec35419b2828dd63ab14", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-gd": "*", + "ext-mbstring": "*", + "phenx/php-font-lib": "0.4.*", + "phenx/php-svg-lib": "0.1.*", + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "3.7.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-develop": "0.7-dev" + } + }, + "autoload": { + "psr-4": { + "Dompdf\\": "src/" + }, + "classmap": [ + "lib/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-2.1" + ], + "authors": [ + { + "name": "Fabien Ménager", + "email": "fabien.menager@gmail.com" + }, + { + "name": "Brian Sweeney", + "email": "eclecticgeek@gmail.com" + }, + { + "name": "Gabriel Bull", + "email": "me@gabrielbull.com" + } + ], + "description": "DOMPDF is a CSS 2.1 compliant HTML to PDF converter", + "homepage": "https://github.com/dompdf/dompdf", + "time": "2016-05-11 00:36:29" + }, { "name": "erusev/parsedown", "version": "1.6.1", @@ -624,6 +685,60 @@ ], "time": "2016-08-26 11:44:52" }, + { + "name": "laravelcollective/html", + "version": "v5.2.4", + "source": { + "type": "git", + "url": "https://github.com/LaravelCollective/html.git", + "reference": "3a312d39ffe37da0f57b602618b61fd07c1fcec5" + }, + "dist": { + "type": "zip", + "url": "https://packagist.phpcomposer.com/files/LaravelCollective/html/3a312d39ffe37da0f57b602618b61fd07c1fcec5.zip", + "reference": "3a312d39ffe37da0f57b602618b61fd07c1fcec5", + "shasum": "" + }, + "require": { + "illuminate/http": "5.2.*", + "illuminate/routing": "5.2.*", + "illuminate/session": "5.2.*", + "illuminate/support": "5.2.*", + "illuminate/view": "5.2.*", + "php": ">=5.5.9" + }, + "require-dev": { + "illuminate/database": "5.2.*", + "mockery/mockery": "~0.9", + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Collective\\Html\\": "src/" + }, + "files": [ + "src/helpers.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylorotwell@gmail.com" + }, + { + "name": "Adam Engebretson", + "email": "adam@laravelcollective.com" + } + ], + "description": "HTML and Form Builders for the Laravel Framework", + "homepage": "http://laravelcollective.com", + "time": "2016-01-27 22:29:54" + }, { "name": "league/flysystem", "version": "1.0.32", @@ -707,6 +822,136 @@ ], "time": "2016-10-19 20:38:46" }, + { + "name": "league/fractal", + "version": "0.14.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/fractal.git", + "reference": "56ad8933fbb40328ca3321c84143b2c16186eebf" + }, + "dist": { + "type": "zip", + "url": "https://packagist.phpcomposer.com/files/thephpleague/fractal/56ad8933fbb40328ca3321c84143b2c16186eebf.zip", + "reference": "56ad8933fbb40328ca3321c84143b2c16186eebf", + "shasum": "" + }, + "require": { + "php": ">=5.4" + }, + "require-dev": { + "illuminate/contracts": "~5.0", + "mockery/mockery": "~0.9", + "pagerfanta/pagerfanta": "~1.0.0", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~1.5", + "zendframework/zend-paginator": "~2.3" + }, + "suggest": { + "illuminate/pagination": "The Illuminate Pagination component.", + "pagerfanta/pagerfanta": "Pagerfanta Paginator", + "zendframework/zend-paginator": "Zend Framework Paginator" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.13-dev" + } + }, + "autoload": { + "psr-4": { + "League\\Fractal\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Phil Sturgeon", + "email": "me@philsturgeon.uk", + "homepage": "http://philsturgeon.uk/", + "role": "Developer" + } + ], + "description": "Handle the output of complex data structures ready for API output.", + "homepage": "http://fractal.thephpleague.com/", + "keywords": [ + "api", + "json", + "league", + "rest" + ], + "time": "2016-07-21 09:56:14" + }, + { + "name": "maatwebsite/excel", + "version": "2.1.8", + "source": { + "type": "git", + "url": "https://github.com/Maatwebsite/Laravel-Excel.git", + "reference": "d9c398f7eba0ac9caf9c104dd0d55bd6a5ff231e" + }, + "dist": { + "type": "zip", + "url": "https://packagist.phpcomposer.com/files/Maatwebsite/Laravel-Excel/d9c398f7eba0ac9caf9c104dd0d55bd6a5ff231e.zip", + "reference": "d9c398f7eba0ac9caf9c104dd0d55bd6a5ff231e", + "shasum": "" + }, + "require": { + "illuminate/cache": "5.0.*|5.1.*|5.2.*|5.3.*", + "illuminate/config": "5.0.*|5.1.*|5.2.*|5.3.*", + "illuminate/filesystem": "5.0.*|5.1.*|5.2.*|5.3.*", + "illuminate/support": "5.0.*|5.1.*|5.2.*|5.3.*", + "nesbot/carbon": "~1.0", + "php": ">=5.5", + "phpoffice/phpexcel": "1.8.*", + "tijsverkoyen/css-to-inline-styles": "~2.0" + }, + "require-dev": { + "mockery/mockery": "~0.9", + "orchestra/testbench": "3.1.*", + "phpseclib/phpseclib": "~1.0", + "phpunit/phpunit": "~4.0" + }, + "suggest": { + "illuminate/http": "5.0.*|5.1.*|5.2.*|5.3.*", + "illuminate/queue": "5.0.*|5.1.*|5.2.*|5.3.*", + "illuminate/routing": "5.0.*|5.1.*|5.2.*|5.3.*", + "illuminate/view": "5.0.*|5.1.*|5.2.*|5.3.*" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/Maatwebsite/Excel" + ], + "psr-0": { + "Maatwebsite\\Excel\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL" + ], + "authors": [ + { + "name": "Maatwebsite.nl", + "email": "patrick@maatwebsite.nl" + } + ], + "description": "An eloquent way of importing and exporting Excel and CSV in Laravel 4 with the power of PHPExcel", + "keywords": [ + "PHPExcel", + "batch", + "csv", + "excel", + "export", + "import", + "laravel" + ], + "time": "2016-12-09 19:11:09" + }, { "name": "monolog/monolog", "version": "1.21.0", @@ -975,6 +1220,131 @@ ], "time": "2016-03-18 20:34:03" }, + { + "name": "phenx/php-font-lib", + "version": "0.4", + "source": { + "type": "git", + "url": "https://github.com/PhenX/php-font-lib.git", + "reference": "b8af0cacdc3cbf1e41a586fcb78f506f4121a088" + }, + "dist": { + "type": "zip", + "url": "https://packagist.phpcomposer.com/files/PhenX/php-font-lib/b8af0cacdc3cbf1e41a586fcb78f506f4121a088.zip", + "reference": "b8af0cacdc3cbf1e41a586fcb78f506f4121a088", + "shasum": "" + }, + "type": "library", + "autoload": { + "psr-0": { + "FontLib\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0" + ], + "authors": [ + { + "name": "Fabien Ménager", + "email": "fabien.menager@gmail.com" + } + ], + "description": "A library to read, parse, export and make subsets of different types of font files.", + "homepage": "https://github.com/PhenX/php-font-lib", + "time": "2015-05-06 20:02:39" + }, + { + "name": "phenx/php-svg-lib", + "version": "0.1", + "source": { + "type": "git", + "url": "https://github.com/PhenX/php-svg-lib.git", + "reference": "b419766515b3426c6da74b0e29e93d71c4f17099" + }, + "dist": { + "type": "zip", + "url": "https://packagist.phpcomposer.com/files/PhenX/php-svg-lib/b419766515b3426c6da74b0e29e93d71c4f17099.zip", + "reference": "b419766515b3426c6da74b0e29e93d71c4f17099", + "shasum": "" + }, + "type": "library", + "autoload": { + "psr-0": { + "Svg\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0" + ], + "authors": [ + { + "name": "Fabien Ménager", + "email": "fabien.menager@gmail.com" + } + ], + "description": "A library to read, parse and export to PDF SVG files.", + "homepage": "https://github.com/PhenX/php-svg-lib", + "time": "2015-05-06 18:49:49" + }, + { + "name": "phpoffice/phpexcel", + "version": "1.8.1", + "source": { + "type": "git", + "url": "https://github.com/PHPOffice/PHPExcel.git", + "reference": "372c7cbb695a6f6f1e62649381aeaa37e7e70b32" + }, + "dist": { + "type": "zip", + "url": "https://packagist.phpcomposer.com/files/PHPOffice/PHPExcel/372c7cbb695a6f6f1e62649381aeaa37e7e70b32.zip", + "reference": "372c7cbb695a6f6f1e62649381aeaa37e7e70b32", + "shasum": "" + }, + "require": { + "ext-xml": "*", + "ext-xmlwriter": "*", + "php": ">=5.2.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "PHPExcel": "Classes/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL" + ], + "authors": [ + { + "name": "Maarten Balliauw", + "homepage": "http://blog.maartenballiauw.be" + }, + { + "name": "Mark Baker" + }, + { + "name": "Franck Lefevre", + "homepage": "http://blog.rootslabs.net" + }, + { + "name": "Erik Tilt" + } + ], + "description": "PHPExcel - OpenXML - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine", + "homepage": "http://phpexcel.codeplex.com", + "keywords": [ + "OpenXML", + "excel", + "php", + "spreadsheet", + "xls", + "xlsx" + ], + "time": "2015-05-01 07:00:55" + }, { "name": "psr/log", "version": "1.0.2", @@ -1258,6 +1628,59 @@ "homepage": "https://symfony.com", "time": "2016-07-30 07:22:48" }, + { + "name": "symfony/css-selector", + "version": "v3.0.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/css-selector.git", + "reference": "b8999c1f33c224b2b66b38253f5e3a838d0d0115" + }, + "dist": { + "type": "zip", + "url": "https://packagist.phpcomposer.com/files/symfony/css-selector/b8999c1f33c224b2b66b38253f5e3a838d0d0115.zip", + "reference": "b8999c1f33c224b2b66b38253f5e3a838d0d0115", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\CssSelector\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jean-François Simon", + "email": "jeanfrancois.simon@sensiolabs.com" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony CssSelector Component", + "homepage": "https://symfony.com", + "time": "2016-06-29 05:40:00" + }, { "name": "symfony/debug", "version": "v3.0.9", @@ -2026,6 +2449,53 @@ "homepage": "https://symfony.com", "time": "2016-10-24 18:41:13" }, + { + "name": "tijsverkoyen/css-to-inline-styles", + "version": "2.2.0", + "source": { + "type": "git", + "url": "https://github.com/tijsverkoyen/CssToInlineStyles.git", + "reference": "ab03919dfd85a74ae0372f8baf9f3c7d5c03b04b" + }, + "dist": { + "type": "zip", + "url": "https://packagist.phpcomposer.com/files/tijsverkoyen/CssToInlineStyles/ab03919dfd85a74ae0372f8baf9f3c7d5c03b04b.zip", + "reference": "ab03919dfd85a74ae0372f8baf9f3c7d5c03b04b", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7", + "symfony/css-selector": "^2.7|~3.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.8|5.1.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "TijsVerkoyen\\CssToInlineStyles\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Tijs Verkoyen", + "email": "css_to_inline_styles@verkoyen.eu", + "role": "Developer" + } + ], + "description": "CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.", + "homepage": "https://github.com/tijsverkoyen/CssToInlineStyles", + "time": "2016-09-20 12:50:39" + }, { "name": "vlucas/phpdotenv", "version": "v2.4.0", @@ -2075,6 +2545,66 @@ "environment" ], "time": "2016-09-01 10:05:43" + }, + { + "name": "yajra/laravel-datatables-oracle", + "version": "v6.22.5", + "source": { + "type": "git", + "url": "https://github.com/yajra/laravel-datatables.git", + "reference": "3f3f353f010542e5360d1412bb846189ebc6d342" + }, + "dist": { + "type": "zip", + "url": "https://packagist.phpcomposer.com/files/yajra/laravel-datatables/3f3f353f010542e5360d1412bb846189ebc6d342.zip", + "reference": "3f3f353f010542e5360d1412bb846189ebc6d342", + "shasum": "" + }, + "require": { + "dompdf/dompdf": "^0.7", + "illuminate/database": "~5.0", + "illuminate/filesystem": "~5.0", + "illuminate/http": "~5.0", + "illuminate/support": "~5.0", + "illuminate/view": "~5.0", + "laravelcollective/html": "~5.0", + "league/fractal": "~0.14", + "maatwebsite/excel": "^2.0", + "php": ">=5.5.9" + }, + "require-dev": { + "mockery/mockery": "~0.9", + "phpunit/phpunit": "~4.0" + }, + "suggest": { + "barryvdh/laravel-snappy": "Allows exporting of dataTable to PDF using the print view." + }, + "type": "library", + "autoload": { + "psr-4": { + "Yajra\\Datatables\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Arjay Angeles", + "email": "aqangeles@gmail.com" + } + ], + "description": "jQuery DataTables API for Laravel 4|5", + "keywords": [ + "datatable", + "datatables", + "datatables jquery plugin", + "laravel", + "laravel4", + "laravel5" + ], + "time": "2016-12-07 08:59:09" } ], "packages-dev": [ @@ -3356,59 +3886,6 @@ "homepage": "https://github.com/sebastianbergmann/version", "time": "2015-06-21 13:59:46" }, - { - "name": "symfony/css-selector", - "version": "v3.0.9", - "source": { - "type": "git", - "url": "https://github.com/symfony/css-selector.git", - "reference": "b8999c1f33c224b2b66b38253f5e3a838d0d0115" - }, - "dist": { - "type": "zip", - "url": "https://packagist.phpcomposer.com/files/symfony/css-selector/b8999c1f33c224b2b66b38253f5e3a838d0d0115.zip", - "reference": "b8999c1f33c224b2b66b38253f5e3a838d0d0115", - "shasum": "" - }, - "require": { - "php": ">=5.5.9" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\CssSelector\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jean-François Simon", - "email": "jeanfrancois.simon@sensiolabs.com" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony CssSelector Component", - "homepage": "https://symfony.com", - "time": "2016-06-29 05:40:00" - }, { "name": "symfony/dom-crawler", "version": "v3.0.9", diff --git a/config/app.php b/config/app.php index 7bd101ef..ef3bdad4 100644 --- a/config/app.php +++ b/config/app.php @@ -161,6 +161,7 @@ return [ */ Devitek\Core\Translation\TranslationServiceProvider::class, Swiggles\Memcache\MemcacheServiceProvider::class, + Yajra\Datatables\DatatablesServiceProvider::class, /** * Application Service Providers... diff --git a/config/datatables.php b/config/datatables.php new file mode 100644 index 00000000..f5cc2b3b --- /dev/null +++ b/config/datatables.php @@ -0,0 +1,98 @@ + [ + /** + * Smart search will enclose search keyword with wildcard string "%keyword%". + * SQL: column LIKE "%keyword%" + */ + 'smart' => true, + + /** + * Case insensitive will search the keyword in lower case format. + * SQL: LOWER(column) LIKE LOWER(keyword) + */ + 'case_insensitive' => true, + + /** + * Wild card will add "%" in between every characters of the keyword. + * SQL: column LIKE "%k%e%y%w%o%r%d%" + */ + 'use_wildcards' => false, + ], + + /** + * DataTables fractal configurations. + */ + 'fractal' => [ + /** + * Request key name to parse includes on fractal. + */ + 'includes' => 'include', + + /** + * Default fractal serializer. + */ + 'serializer' => 'League\Fractal\Serializer\DataArraySerializer', + ], + + /** + * DataTables script view template. + */ + 'script_template' => 'datatables::script', + + /** + * DataTables internal index id response column name. + */ + 'index_column' => 'DT_Row_Index', + + /** + * Namespaces used by the generator. + */ + 'namespace' => [ + /** + * Base namespace/directory to create the new file. + * This is appended on default Laravel namespace. + * Usage: php artisan datatables:make User + * Output: App\DataTables\UserDataTable + * With Model: App\User (default model) + * Export filename: users_timestamp + */ + 'base' => 'DataTables', + + /** + * Base namespace/directory where your model's are located. + * This is appended on default Laravel namespace. + * Usage: php artisan datatables:make Post --model + * Output: App\DataTables\PostDataTable + * With Model: App\Post + * Export filename: posts_timestamp + */ + 'model' => '', + ], + + /** + * PDF generator to be used when converting the table to pdf. + * Available generators: excel, snappy + * Snappy package: barryvdh/laravel-snappy + * Excel package: maatwebsite/excel + */ + 'pdf_generator' => 'excel', + + /** + * Snappy PDF options. + */ + 'snappy' => [ + 'options' => [ + 'no-outline' => true, + 'margin-left' => '0', + 'margin-right' => '0', + 'margin-top' => '10mm', + 'margin-bottom' => '10mm', + ], + 'orientation' => 'landscape', + ], +]; diff --git a/config/locales.php b/config/locales.php index 3871d918..01eb72e3 100644 --- a/config/locales.php +++ b/config/locales.php @@ -10,7 +10,7 @@ return [ | */ 'zh_CN' => [ - 'name' => '中文 (中国)', + 'name' => '中文 (简体)', 'short_name' => 'ZH (CN)', ], 'en' => [ diff --git a/gulpfile.js b/gulpfile.js index 7c24ffc0..40aa30a6 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -2,7 +2,7 @@ * @Author: prpr * @Date: 2016-07-21 13:38:26 * @Last Modified by: printempw -* @Last Modified time: 2016-12-30 16:15:43 +* @Last Modified time: 2016-12-30 23:03:17 */ var gulp = require('gulp'), @@ -23,6 +23,8 @@ var vendor_js = [ 'AdminLTE/dist/js/app.min.js', 'bootstrap-fileinput/js/fileinput.min.js', 'bootstrap-fileinput/js/locales/zh.js', + 'AdminLTE/plugins/datatables/jquery.dataTables.min.js', + 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js', 'iCheck/icheck.min.js', 'toastr/toastr.min.js', 'sweetalert2/dist/sweetalert2.min.js', @@ -32,6 +34,7 @@ var vendor_js = [ var vendor_css = [ 'bootstrap/dist/css/bootstrap.min.css', 'AdminLTE/dist/css/AdminLTE.min.css', + 'AdminLTE/plugins/datatables/dataTables.bootstrap.css', 'bootstrap-fileinput/css/fileinput.min.css', 'font-awesome/css/font-awesome.min.css', 'iCheck/skins/square/blue.css', diff --git a/resources/assets/src/js/admin.js b/resources/assets/src/js/admin.js index 45915e7b..cde8743f 100644 --- a/resources/assets/src/js/admin.js +++ b/resources/assets/src/js/admin.js @@ -2,7 +2,7 @@ * @Author: printempw * @Date: 2016-07-22 14:02:44 * @Last Modified by: printempw - * @Last Modified time: 2016-11-25 13:10:36 + * @Last Modified time: 2016-12-31 10:54:41 */ 'use strict'; @@ -197,11 +197,10 @@ function deleteUserAccount(uid) { }); } -$('.score').on('keypress', function(event){ - if (event.which == 13) +$('body').on('keypress', '.score', function(event){ + if (event.which == 13) { changeUserScore($(this).parent().parent().attr('id'), $(this).val()); -}).click(function() { - $(this).tooltip('show'); + } }); $('body').on('change', '#preference', function() { diff --git a/resources/assets/src/sass/admin.scss b/resources/assets/src/sass/admin.scss index 34a2b0d0..ad83a909 100644 --- a/resources/assets/src/sass/admin.scss +++ b/resources/assets/src/sass/admin.scss @@ -2,7 +2,7 @@ * @Author: printempw * @Date: 2016-07-22 14:08:41 * @Last Modified by: printempw - * @Last Modified time: 2016-12-30 20:54:26 + * @Last Modified time: 2016-12-31 11:27:18 */ @import "style.scss"; @@ -21,25 +21,7 @@ } input.score { - width: 80px; -} - -.user-search-form { - display: inline; - - .user-search-input { - display: inline; - width: 30%; - float: right; - margin: 0; - } - - select.user-search-input { - padding-left: 0; - margin: 0 20px 0 0; - padding: 5.5px 14px; - width: 120px; - } + width: 100px !important; } td { @@ -68,3 +50,7 @@ td { color: #3c8dbc; } } + +.table>tbody>tr>td { + border-top: 0 !important; +} diff --git a/resources/assets/src/sass/style.scss b/resources/assets/src/sass/style.scss index 69e5b2f7..d8bd8f5c 100644 --- a/resources/assets/src/sass/style.scss +++ b/resources/assets/src/sass/style.scss @@ -2,7 +2,7 @@ * @Author: printempw * @Date: 2016-06-04 20:55:09 * @Last Modified by: printempw - * @Last Modified time: 2016-12-11 14:07:33 + * @Last Modified time: 2016-12-31 11:27:40 */ $font_stack: Ubuntu, 'Segoe UI', 'Microsoft Yahei', 'Microsoft Jhenghei', sans-serif; @@ -220,3 +220,7 @@ input:-webkit-autofill { td[class='key'], td[class='value'] { border-top: 0 !important; } + +tr.even { + background-color: #f7f7f7; +} diff --git a/resources/lang/en/admin.yml b/resources/lang/en/admin.yml index 8a214c1a..17ffad05 100644 --- a/resources/lang/en/admin.yml +++ b/resources/lang/en/admin.yml @@ -41,6 +41,10 @@ plugins: no-config-notice: The plugin has been disabled or no configuration is provided. delete: Delete + enabled: :plugin has been enabled. + disabled: :plugin has been disabled. + deleted: The plugin was deleted successfully. + empty: No result update: diff --git a/resources/lang/en/setup.yml b/resources/lang/en/setup.yml index 177849b8..17c20602 100644 --- a/resources/lang/en/setup.yml +++ b/resources/lang/en/setup.yml @@ -16,18 +16,19 @@ locked: updates: master: - title: Blessing Skin Server Updating Wizard + title: Update Wizard - Blessing Skin Server welcome: - title: Just one step - tip-welcome: Welcome to updating Blessing Skin Server - tip-next: We need to update your database, just click NEXT. + title: One more step + text: | + Welcome to update to Blessing Skin Server v:version! + We need to apply some updates to your database, click NEXT to continue. button: Next success: - title: Updated successfully - tip-success: Database updated successfully. Welcome to Blessing Skin Server. - tip-update: Tips of updating + title: Update complete + text: Blessing Skin Server has been successfully updated to v:version. + tips: "Update Tips:" wizard: master: diff --git a/resources/lang/zh_CN/admin.yml b/resources/lang/zh_CN/admin.yml index a69d5dd0..45314fdc 100644 --- a/resources/lang/zh_CN/admin.yml +++ b/resources/lang/zh_CN/admin.yml @@ -41,6 +41,10 @@ plugins: no-config-notice: 插件已被禁用或无配置页 delete: 删除插件 + enabled: :plugin 已启用 + disabled: :plugin 已禁用 + deleted: 插件已被成功删除 + empty: 无结果 update: diff --git a/resources/lang/zh_CN/locale.js b/resources/lang/zh_CN/locale.js index 40d270ba..5fd64925 100644 --- a/resources/lang/zh_CN/locale.js +++ b/resources/lang/zh_CN/locale.js @@ -10,7 +10,7 @@ (function ($) { "use strict"; - $.locales['zh-CN'] = { + $.locales['zh_CN'] = { auth: { // Login emptyIdentification: '你还没有填写邮箱/角色名哦', @@ -143,6 +143,33 @@ confirmLogout: '确定要登出吗?', confirm: '确定', cancel: '取消' + }, + vendor: { + datatables: { + "sProcessing": "处理中...", + "sLengthMenu": "每页 _MENU_ 项", + "sZeroRecords": "没有匹配结果", + "sInfo": "当前显示第 _START_ 至 _END_ 项,共 _TOTAL_ 项。", + "sInfoEmpty": "当前显示第 0 至 0 项,共 0 项", + "sInfoFiltered": "(由 _MAX_ 项结果过滤)", + "sInfoPostFix": "", + "sSearch": "搜索:", + "sUrl": "", + "sEmptyTable": "表中数据为空", + "sLoadingRecords": "载入中...", + "sInfoThousands": ",", + "oPaginate": { + "sFirst": "首页", + "sPrevious": "上页", + "sNext": "下页", + "sLast": "末页", + "sJump": "跳转" + }, + "oAria": { + "sSortAscending": ": 以升序排列此列", + "sSortDescending": ": 以降序排列此列" + } + } } }; })(window.jQuery); diff --git a/resources/lang/zh_CN/setup.yml b/resources/lang/zh_CN/setup.yml index 6c526f43..e0e64729 100644 --- a/resources/lang/zh_CN/setup.yml +++ b/resources/lang/zh_CN/setup.yml @@ -20,14 +20,15 @@ updates: welcome: title: 还差一小步 - tip-welcome: 欢迎升级至 Blessing Skin Server - tip-next: 我们需要升级您的数据库,点击下一步以继续。 + text: | + 欢迎升级至 Blessing Skin Server v:version! + 我们需要升级您的数据库,点击下一步以继续。 button: 下一步 success: title: 升级成功 - tip-success: 数据库升级成功,欢迎使用 Blessing Skin Server - tip-update: 升级提示: + text: 数据库升级成功,欢迎使用 Blessing Skin Server v:version! + tips: 升级提示: wizard: master: diff --git a/resources/views/admin/plugins.tpl b/resources/views/admin/plugins.tpl index e281c536..0183124a 100644 --- a/resources/views/admin/plugins.tpl +++ b/resources/views/admin/plugins.tpl @@ -4,12 +4,9 @@ @section('style') @endsection @@ -27,6 +24,13 @@ td#description {
+ + @if (session()->has('message')) + + @endif +
@@ -90,16 +94,6 @@ td#description { @endsection -@section('style') - -@endsection - @section('script') @endsection diff --git a/resources/views/vendor/admin-operations/users.tpl b/resources/views/vendor/admin-operations/users.tpl new file mode 100644 index 00000000..02a44520 --- /dev/null +++ b/resources/views/vendor/admin-operations/users.tpl @@ -0,0 +1,65 @@ +
+ + +
+ +{{-- If current user is super admin --}} +@if (app('user.current')->getPermission() == App\Models\User::SUPER_ADMIN) + + @if ($permission == "2") + 删除用户 + @else + 删除用户 + @endif + +@else + @if ($permission == "1" || $permission == "2") + 删除用户 + @else + 删除用户 + @endif + +@endif