use jQuery DataTables plugin at user management

This commit is contained in:
printempw 2016-12-31 11:38:07 +08:00
parent 57937ac458
commit 3ca85aff8f
20 changed files with 843 additions and 290 deletions

View File

@ -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 '<input type="text" class="form-control score" value="'.$user->score.'" title="输入修改后的积分,回车提交" data-toggle="tooltip" data-placement="right">';
})
->addColumn('operations', 'vendor.admin-operations.users')
->make(true);
}
/**

View File

@ -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;

View File

@ -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');

View File

@ -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",

587
composer.lock generated
View File

@ -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",

View File

@ -161,6 +161,7 @@ return [
*/
Devitek\Core\Translation\TranslationServiceProvider::class,
Swiggles\Memcache\MemcacheServiceProvider::class,
Yajra\Datatables\DatatablesServiceProvider::class,
/**
* Application Service Providers...

98
config/datatables.php Normal file
View File

@ -0,0 +1,98 @@
<?php
return [
/**
* DataTables search options.
*/
'search' => [
/**
* 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',
],
];

View File

@ -10,7 +10,7 @@ return [
|
*/
'zh_CN' => [
'name' => '中文 (中国)',
'name' => '中文 (简体)',
'short_name' => 'ZH (CN)',
],
'en' => [

View File

@ -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',

View File

@ -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() {

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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:

View File

@ -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:

View File

@ -41,6 +41,10 @@ plugins:
no-config-notice: 插件已被禁用或无配置页
delete: 删除插件
enabled: :plugin 已启用
disabled: :plugin 已禁用
deleted: 插件已被成功删除
empty: 无结果
update:

View File

@ -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);

View File

@ -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:

View File

@ -4,12 +4,9 @@
@section('style')
<style>
.btn {
margin-right: 4px;
}
td#description {
width: 35%;
}
.btn { margin-right: 4px; }
td#description { width: 35%; }
@media (max-width: 767px) { .content-header > h1 > small { display: none; } }
</style>
@endsection
@ -27,6 +24,13 @@ td#description {
<!-- Main content -->
<section class="content">
@if (session()->has('message'))
<div class="callout callout-success" role="alert">
{{ session('message') }}
</div>
@endif
<div class="box">
<div class="box-body table-responsive no-padding">
<table class="table table-hover">
@ -90,16 +94,6 @@ td#description {
@endsection
@section('style')
<style>
@media (max-width: 767px) {
.content-header > h1 > small {
display: none;
}
}
</style>
@endsection
@section('script')
<script type="text/javascript">

View File

@ -9,32 +9,19 @@
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
@if (isset($_GET['q']))
搜索结果:{{ $_GET['q'] }}
@else
{{ trans('general.user-manage') }}
@endif
<small>User Management</small>
<form method="get" action="" class="user-search-form">
<input type="text" name="q" class="form-control user-search-input" placeholder="输入,回车搜索。" value="{{ $q }}">
<select name="filter" class="form-control pull-right user-search-input">
<option value='nickname' {{ $filter == 'nickname' ? 'selected="selected"' : '' }}>搜索昵称</option>
<option value='email' {{ $filter == 'email' ? 'selected="selected"' : '' }}>搜索邮箱</option>
</select>
</form>
</h1>
</section>
<?php $current_user = app('users')->get(session('uid')); ?>
<!-- Main content -->
<section class="content">
<div class="box">
<div class="box-body table-responsive no-padding">
<table class="table table-hover">
<div class="box-body table-bordered">
<table id="user-table" class="table table-hover">
<thead>
<tr>
{{-- <th><input name="select_all" value="1" type="checkbox"></th> --}}
<th>UID</th>
<th>邮箱</th>
<th>昵称</th>
@ -44,160 +31,52 @@
<th>操作</th>
</tr>
</thead>
<tbody>
@forelse($users as $user)
<tr id="{{ $user->uid }}">
<td>{{ $user->uid }}</td>
<td id="email">{{ $user->email }}</td>
<td id="nickname">{{ $user->nickname }}</td>
<td><input type="text" class="form-control score" value="{{ $user->score }}" title="输入修改后的积分,回车提交" data-placement="top"></td>
<td id="permission">
@if ($user->permission == "0")
正常
@elseif ($user->permission == "-1")
封禁
@elseif ($user->permission == "1")
管理员
@elseif ($user->permission == "2")
超级管理员
@endif
</td>
<td>{{ $user->register_at }}</td>
<td>
<div class="btn-group">
<button type="button" class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
更多操作 <span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a href="javascript:changeUserEmail('{{ $user->uid }}');">修改邮箱</a></li>
<li><a href="javascript:changeUserNickName('{{ $user->uid }}');">修改昵称</a></li>
<li><a href="javascript:changeUserPwd('{{ $user->uid }}');">更改密码</a></li>
<li class="divider"></li>
<li><a href="{{ url('admin/players?filter=uid&q='.$user->uid) }}">查看该用户拥有的角色</a></li>
<li class="divider"></li>
{{-- If current user is super admin --}}
@if ($current_user->getPermission() == "2")
@if ($user->permission == "1")
<li><a id="admin" href="javascript:changeAdminStatus('{{ $user->uid }}');">解除管理员</a></li>
@elseif ($user->permission == "2")
<li><a href="javascript:;">无法解除超级管理员</a></li>
@else
<li><a id="admin" href="javascript:changeAdminStatus('{{ $user->uid }}');">设为管理员</a></li>
@endif
<li class="divider"></li>
@if ($user->permission == "2")
<li><a href="javascript:;">无法封禁超级管理员</a></li>
@elseif ($user->permission == "-1")
<li><a id="ban" href="javascript:changeBanStatus('{{ $user->uid }}');">解封</a></li>
@else
<li><a id="ban" href="javascript:changeBanStatus('{{ $user->uid }}');">封禁</a></li>
@endif
{{-- If current user is ordinary admin --}}
@else
@if ($user->permission == "1" || $user->permission == "2")
<li><a href="javascript:;">无法封禁管理员</a></li>
@elseif ($user->permission == "0")
<li><a id="ban" href="javascript:changeBanStatus('{{ $user->uid }}');">封禁</a></li>
@else
<li><a id="ban" href="javascript:changeBanStatus('{{ $user->uid }}');">解封</a></li>
@endif
@endif
</ul>
</div>
{{-- If current user is super admin --}}
@if ($current_user->getPermission() == "2")
@if ($user->permission == "2")
<a class="btn btn-danger btn-sm" disabled="disabled" data-toggle="tooltip" data-placement="bottom" title="超级管理员账号不能被这样删除的啦">删除用户</a>
@else
<a class="btn btn-danger btn-sm" href="javascript:deleteUserAccount('{{ $user->uid }}');">删除用户</a>
@endif
@else
@if ($user->permission == "1" || $user->permission == "2")
<a class="btn btn-danger btn-sm" disabled="disabled" data-toggle="tooltip" data-placement="bottom" title="你不能删除管理员账号哦">删除用户</a>
@else
<a class="btn btn-danger btn-sm" href="javascript:deleteUserAccount('{{ $user->uid }}');">删除用户</a>
@endif
@endif
</td>
</tr>
@empty
<tr>
<td>0</td>
<td>无结果</td>
<td>(´・ω・`)</td>
</tr>
@endforelse
</tbody>
</table>
</div>
<div class="box-footer">
<!-- Pagination -->
<ul class="pagination pagination-sm no-margin pull-right">
<?php $base_url = ($filter != "" && $q != "") ? "?filter=$filter&q=$q&" : "?"; ?>
<li><a href="?page=1">«</a></li>
@if ($page != 1)
<li><a href="{{ $base_url }}page={{ $page-1 }}">{{ $page - 1 }}</a></li>
@endif
<li><a href="{{ $base_url }}page={{ $page }}" class="active">{{ $page }}</a></li>
@if ($total_pages > $page)
<li><a href="{{ $base_url }}page={{ $page+1 }}">{{ $page+1 }}</a></li>
@endif
<li><a href="{{ $base_url }}page={{ $total_pages }}">»</a></li>
</ul>
<select id="page-select" class="pull-right">
@for ($i = 1; $i <= $total_pages; $i++)
@if ($i == $page)
<option value='{{ $i }}' selected="selected">{{ $i }}</option>
@else
<option value='{{ $i }}'>{{ $i }}</option>
@endif
@endfor
</select>
<p class="pull-right"> {{ $page }} 页,共 {{ $total_pages }} </p>
</div>
</div>
</section><!-- /.content -->
</div><!-- /.content-wrapper -->
@endsection
@section('style')
<style>
@media (max-width: 767px) {
.content-header > h1 > small {
display: none;
}
}
</style>
@endsection
@section('script')
<script type="text/javascript">
$(document).ready(function() {
$('.box-body').css('min-height', $('.content-wrapper').height() - $('.content-header').outerHeight() - 120);
});
$('#user-table').DataTable({
language: trans('vendor.datatables'),
responsive: true,
autoWidth: false,
processing: true,
serverSide: true,
ajax: '{{ url("admin/user-data") }}',
createdRow: function (row, data, index) {
$('td', row).eq(2).attr('id', 'email');
$('td', row).eq(3).attr('id', 'nickname');
$('td', row).eq(5).attr('id', 'permission');
},
// columnDefs: [{
// targets: 0,
// searchable: false,
// orderable: false,
// width: '1%',
// className: 'dt-body-center',
// render: function (data, type, full, meta){
// return '<input type="checkbox">';
// }
// }],
columns: [
// {data: 0},
{data: 'uid', 'width': '1%'},
{data: 'email'},
{data: 'nickname'},
{data: 'score'},
{data: 'permission'},
{data: 'register_at'},
{data: 'operations', searchable: false, orderable: false}
]
});
</script>
@endsection

View File

@ -0,0 +1,65 @@
<div class="btn-group">
<button type="button" class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
更多操作 <span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a href="javascript:changeUserEmail('{{ $uid }}');">修改邮箱</a></li>
<li><a href="javascript:changeUserNickName('{{ $uid }}');">修改昵称</a></li>
<li><a href="javascript:changeUserPwd('{{ $uid }}');">更改密码</a></li>
<li class="divider"></li>
<li><a href="{{ url('admin/players?filter=uid&q='.$uid) }}">查看该用户拥有的角色</a></li>
<li class="divider"></li>
{{-- If current user is super admin --}}
@if (app('user.current')->getPermission() == App\Models\User::SUPER_ADMIN)
@if ($permission == "1")
<li><a id="admin" href="javascript:changeAdminStatus('{{ $uid }}');">解除管理员</a></li>
@elseif ($permission == "2")
<li><a href="javascript:;">无法解除超级管理员</a></li>
@else
<li><a id="admin" href="javascript:changeAdminStatus('{{ $uid }}');">设为管理员</a></li>
@endif
<li class="divider"></li>
@if ($permission == "2")
<li><a href="javascript:;">无法封禁超级管理员</a></li>
@elseif ($permission == "-1")
<li><a id="ban" href="javascript:changeBanStatus('{{ $uid }}');">解封</a></li>
@else
<li><a id="ban" href="javascript:changeBanStatus('{{ $uid }}');">封禁</a></li>
@endif
{{-- If current user is ordinary admin --}}
@else
@if ($permission == "1" || $permission == "2")
<li><a href="javascript:;">无法封禁管理员</a></li>
@elseif ($permission == "0")
<li><a id="ban" href="javascript:changeBanStatus('{{ $uid }}');">封禁</a></li>
@else
<li><a id="ban" href="javascript:changeBanStatus('{{ $uid }}');">解封</a></li>
@endif
@endif
</ul>
</div>
{{-- If current user is super admin --}}
@if (app('user.current')->getPermission() == App\Models\User::SUPER_ADMIN)
@if ($permission == "2")
<a class="btn btn-danger btn-sm" disabled="disabled" data-toggle="tooltip" data-placement="bottom" title="超级管理员账号不能被这样删除的啦">删除用户</a>
@else
<a class="btn btn-danger btn-sm" href="javascript:deleteUserAccount('{{ $uid }}');">删除用户</a>
@endif
@else
@if ($permission == "1" || $permission == "2")
<a class="btn btn-danger btn-sm" disabled="disabled" data-toggle="tooltip" data-placement="bottom" title="你不能删除管理员账号哦">删除用户</a>
@else
<a class="btn btn-danger btn-sm" href="javascript:deleteUserAccount('{{ $uid }}');">删除用户</a>
@endif
@endif