Update style of plugin manage page
This commit is contained in:
parent
7c7b8873de
commit
70d59642b1
|
|
@ -98,24 +98,13 @@ class PluginController extends Controller
|
|||
|
||||
return Datatables::of($installed)
|
||||
->setRowId('plugin-{{ $name }}')
|
||||
->editColumn('title', function ($plugin) {
|
||||
return trans($plugin->title ?: 'EMPTY');
|
||||
})
|
||||
->editColumn('description', function ($plugin) {
|
||||
return trans($plugin->description ?: 'EMPTY');
|
||||
})
|
||||
->editColumn('author', function ($plugin) {
|
||||
return ['author' => trans($plugin->author ?: 'EMPTY'), 'url' => $plugin->url];
|
||||
})
|
||||
->editColumn('title', '{{ trans($title ?: "EMPTY") }}')
|
||||
->editColumn('description', '{{ trans($description ?: "EMPTY") }}')
|
||||
->addColumn('enabled', function ($plugin) { return $plugin->isEnabled(); })
|
||||
->addColumn('config', function ($plugin) { return $plugin->hasConfigView(); })
|
||||
->addColumn('dependencies', function ($plugin) {
|
||||
return $this->getPluginDependencies($plugin);
|
||||
})
|
||||
->addColumn('status', function ($plugin) {
|
||||
return trans('admin.plugins.status.'.($plugin->isEnabled() ? 'enabled' : 'disabled'));
|
||||
})
|
||||
->addColumn('operations', function ($plugin) {
|
||||
return ['enabled' => $plugin->isEnabled(), 'hasConfigView' => $plugin->hasConfigView()];
|
||||
})
|
||||
->make(true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ function initPluginsTable() {
|
|||
$.pluginsTable = $('#plugin-table').DataTable({
|
||||
columnDefs: pluginsTableColumnDefs,
|
||||
fnDrawCallback: () => $('[data-toggle="tooltip"]').tooltip(),
|
||||
rowCallback: (row, data) => $(row).addClass(data.enabled ? 'plugin-enabled' : ''),
|
||||
ajax: {
|
||||
url: url('admin/plugins/data'),
|
||||
type: 'POST'
|
||||
|
|
@ -18,27 +19,47 @@ function initPluginsTable() {
|
|||
const pluginsTableColumnDefs = [
|
||||
{
|
||||
targets: 0,
|
||||
data: 'title'
|
||||
data: 'title',
|
||||
title: trans('admin.pluginTitle'),
|
||||
width: '10%',
|
||||
render: (title, type, row) => {
|
||||
const actions = [];
|
||||
|
||||
if (row.enabled) {
|
||||
row.config && actions.push(`<a href="${url('admin/plugins/config/'+row.name)}" class="text-primary">${ trans('admin.configurePlugin') }</a>`);
|
||||
actions.push(`<a onclick="disablePlugin('${row.name}');" class="text-primary">${ trans('admin.disablePlugin') }</a>`);
|
||||
} else {
|
||||
actions.push(
|
||||
`<a onclick="enablePlugin('${row.name}');" class="text-primary">${ trans('admin.enablePlugin') }</a>`,
|
||||
`<a onclick="deletePlugin('${row.name}');" class="text-danger">${ trans('admin.deletePlugin') }</a>`
|
||||
);
|
||||
}
|
||||
|
||||
return `
|
||||
<strong>${ title }</strong>
|
||||
<div class="actions">${ actions.join(' | ') }</div>
|
||||
`;
|
||||
}
|
||||
},
|
||||
{
|
||||
targets: 1,
|
||||
data: 'description',
|
||||
title: trans('admin.pluginDescription'),
|
||||
orderable: false,
|
||||
width: '35%'
|
||||
render: (description, type, row) => {
|
||||
return `
|
||||
<div class="plugin-description"><p>${ description }</p></div>
|
||||
<div class="plugin-version-author">
|
||||
${ trans('admin.pluginVersion') } <span class="text-primary">${ row.version }</span> |
|
||||
${ trans('admin.pluginAuthor') } <a href="${ row.url }">${ row.author }</a>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
},
|
||||
{
|
||||
targets: 2,
|
||||
data: 'author',
|
||||
render: data => isEmpty(data.url) ? data.author : `<a href="${data.url}" target="_blank">${data.author}</a>`
|
||||
},
|
||||
{
|
||||
targets: 3,
|
||||
data: 'version',
|
||||
orderable: false
|
||||
},
|
||||
{
|
||||
targets: 4,
|
||||
data: 'dependencies',
|
||||
title: trans('admin.pluginDependencies'),
|
||||
searchable: false,
|
||||
orderable: false,
|
||||
render: data => {
|
||||
|
|
@ -57,35 +78,6 @@ const pluginsTableColumnDefs = [
|
|||
|
||||
return result;
|
||||
}
|
||||
},
|
||||
{
|
||||
targets: 5,
|
||||
data: 'status'
|
||||
},
|
||||
{
|
||||
targets: 6,
|
||||
data: 'operations',
|
||||
searchable: false,
|
||||
orderable: false,
|
||||
render: (data, type, row) => {
|
||||
let toggleButton, configViewButton;
|
||||
|
||||
if (data.enabled) {
|
||||
toggleButton = `<a class="btn btn-warning btn-sm" onclick="disablePlugin('${row.name}');">${trans('admin.disablePlugin')}</a>`;
|
||||
} else {
|
||||
toggleButton = `<a class="btn btn-primary btn-sm" onclick="enablePlugin('${row.name}');">${trans('admin.enablePlugin')}</a>`;
|
||||
}
|
||||
|
||||
if (data.enabled && data.hasConfigView) {
|
||||
configViewButton = `<a class="btn btn-default btn-sm" href="${url('/')}admin/plugins/config/${row.name}">${trans('admin.configurePlugin')}</a>`;
|
||||
} else {
|
||||
configViewButton = `<a class="btn btn-default btn-sm" disabled="disabled" title="${trans('admin.noPluginConfigNotice')}" data-toggle="tooltip" data-placement="top">${trans('admin.configurePlugin')}</a>`;
|
||||
}
|
||||
|
||||
const deletePluginButton = `<a class="btn btn-danger btn-sm" onclick="deletePlugin('${row.name}');">${trans('admin.deletePlugin')}</a>`;
|
||||
|
||||
return toggleButton + configViewButton + deletePluginButton;
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -45,3 +45,35 @@ td {
|
|||
color: #3c8dbc;
|
||||
}
|
||||
}
|
||||
|
||||
#plugin-table {
|
||||
.actions {
|
||||
margin-top: 5px;
|
||||
color: #ddd;
|
||||
}
|
||||
|
||||
.plugin-version-author {
|
||||
color: #777;
|
||||
font-size: small;
|
||||
|
||||
a {
|
||||
color: #337ab7;
|
||||
}
|
||||
}
|
||||
|
||||
td {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
td:first-child {
|
||||
border-left: 3px solid transparent;
|
||||
}
|
||||
|
||||
.plugin-enabled {
|
||||
background-color: #f7fcfe;
|
||||
}
|
||||
|
||||
.plugin-enabled td:first-child {
|
||||
border-left-color: #3c8dbc;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,12 +98,6 @@ customize:
|
|||
black-light: Black Light
|
||||
|
||||
plugins:
|
||||
name: Name
|
||||
description: Description
|
||||
author: Author
|
||||
version: Version
|
||||
dependencies: Dependencies
|
||||
|
||||
status:
|
||||
title: Status
|
||||
enabled: Enabled
|
||||
|
|
|
|||
|
|
@ -178,16 +178,18 @@
|
|||
emptyPlayerName: 'Player name cannot be empty.',
|
||||
|
||||
// Plugins
|
||||
configurePlugin: 'Configure',
|
||||
noPluginConfigNotice: 'The plugin has been disabled or no configuration is provided.',
|
||||
deletePlugin: 'Delete',
|
||||
noDependencies: 'No Dependencies',
|
||||
whyDependencies: 'What\'s this?',
|
||||
statusEnabled: 'Enabled',
|
||||
statusDisabled: 'Disabled',
|
||||
pluginTitle: 'Plugin',
|
||||
pluginAuthor: 'Author',
|
||||
pluginVersion: 'Version',
|
||||
enablePlugin: 'Enable',
|
||||
disablePlugin: 'Disable',
|
||||
configurePlugin: 'Configure',
|
||||
deletePlugin: 'Delete',
|
||||
confirmDeletion: 'Are you sure to delete this plugin?',
|
||||
pluginDescription: 'Description',
|
||||
pluginDependencies: 'Dependencies',
|
||||
noDependencies: 'No Dependencies',
|
||||
whyDependencies: 'What\'s this?',
|
||||
noDependenciesNotice: 'There is no dependency definition in the plugin. It means that the plugin may be not compatible with the current version of Blessing Skin, and enabling it may cause unexpected problems. Do you really want to enable the plugin?',
|
||||
|
||||
// Update
|
||||
|
|
|
|||
|
|
@ -98,19 +98,7 @@ customize:
|
|||
black-light: 黑色主题 - 白色侧边栏
|
||||
|
||||
plugins:
|
||||
name: 名称
|
||||
description: 描述
|
||||
author: 作者
|
||||
version: 版本
|
||||
dependencies: 依赖关系
|
||||
|
||||
status:
|
||||
title: 状态
|
||||
enabled: 已启用
|
||||
disabled: 已禁用
|
||||
|
||||
operations:
|
||||
title: 操作
|
||||
enabled: :plugin 已启用
|
||||
unsatisfied:
|
||||
notice: 无法启用此插件,因为其仍有未满足的依赖关系。请检查以下插件的版本,更新或安装它们:
|
||||
|
|
|
|||
|
|
@ -180,16 +180,18 @@
|
|||
emptyPlayerName: '您还没填写角色名呢',
|
||||
|
||||
// Plugins
|
||||
configurePlugin: '插件配置',
|
||||
noPluginConfigNotice: '插件已被禁用或无配置页',
|
||||
deletePlugin: '删除插件',
|
||||
pluginTitle: '插件',
|
||||
pluginAuthor: '作者',
|
||||
pluginVersion: '版本',
|
||||
enablePlugin: '启用',
|
||||
disablePlugin: '禁用',
|
||||
configurePlugin: '配置',
|
||||
deletePlugin: '删除',
|
||||
confirmDeletion: '真的要删除这个插件吗?',
|
||||
pluginDescription: '描述',
|
||||
pluginDependencies: '依赖关系',
|
||||
noDependencies: '无要求',
|
||||
whyDependencies: '为什么会这样?',
|
||||
statusEnabled: '已启用',
|
||||
statusDisabled: '已禁用',
|
||||
enablePlugin: '启用插件',
|
||||
disablePlugin: '禁用插件',
|
||||
confirmDeletion: '真的要删除这个插件吗?',
|
||||
noDependenciesNotice: '此插件没有声明任何依赖关系,这代表它有可能并不兼容此版本的 Blessing Skin,请将此插件升级至可能的最新版本。强行启用可能导致无法预料的后果。你确定要启用此插件吗?',
|
||||
|
||||
// Update
|
||||
|
|
|
|||
|
|
@ -2,10 +2,6 @@
|
|||
|
||||
@section('title', trans('general.plugin-manage'))
|
||||
|
||||
@section('style')
|
||||
<style> .btn { margin-right: 4px; } </style>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
|
||||
<!-- Content Wrapper. Contains page content -->
|
||||
|
|
@ -28,19 +24,7 @@
|
|||
|
||||
<div class="box">
|
||||
<div class="box-body table-bordered">
|
||||
<table id="plugin-table" class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ trans('admin.plugins.name') }}</th>
|
||||
<th>{{ trans('admin.plugins.description') }}</th>
|
||||
<th>{{ trans('admin.plugins.author') }}</th>
|
||||
<th>{{ trans('admin.plugins.version') }}</th>
|
||||
<th>{{ trans('admin.plugins.dependencies') }}</th>
|
||||
<th>{{ trans('admin.plugins.status.title') }}</th>
|
||||
<th>{{ trans('admin.plugins.operations.title') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<table id="plugin-table" class="table table-hover"></table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user