mirror of
https://github.com/flextype/flextype.git
synced 2025-08-21 04:11:42 +02:00
feat(admin-plugin): remove btn class and add grid and list func #211
This commit is contained in:
@@ -35,7 +35,7 @@ class ApiController extends Controller
|
||||
'api' => [
|
||||
'link' => $this->router->pathFor('admin.api.index'),
|
||||
'title' => __('admin_api'),
|
||||
'attributes' => ['class' => 'btn active'],
|
||||
'attributes' => ['class' => 'active'],
|
||||
],
|
||||
],
|
||||
]
|
||||
@@ -63,19 +63,19 @@ class ApiController extends Controller
|
||||
'api' => [
|
||||
'link' => $this->router->pathFor('admin.api.index'),
|
||||
'title' => __('admin_api'),
|
||||
'attributes' => ['class' => 'btn'],
|
||||
'attributes' => ['class' => ''],
|
||||
],
|
||||
'api_tokens' => [
|
||||
'link' => $this->router->pathFor('admin.api_tokens.index') . '?api=' . $api,
|
||||
'title' => __('admin_' . $api),
|
||||
'attributes' => ['class' => 'btn active'],
|
||||
'attributes' => ['class' => 'active'],
|
||||
],
|
||||
],
|
||||
'buttons' => [
|
||||
'api_tokens_add' => [
|
||||
'link' => $this->router->pathFor('admin.api_tokens.add') . '?api=' . $api,
|
||||
'title' => __('admin_create_new_' . $api . '_token'),
|
||||
'attributes' => ['class' => 'btn'],
|
||||
'attributes' => ['class' => ''],
|
||||
],
|
||||
],
|
||||
]
|
||||
@@ -102,17 +102,17 @@ class ApiController extends Controller
|
||||
'api' => [
|
||||
'link' => $this->router->pathFor('admin.api.index'),
|
||||
'title' => __('admin_api'),
|
||||
'attributes' => ['class' => 'btn'],
|
||||
'attributes' => ['class' => ''],
|
||||
],
|
||||
'api_tokens' => [
|
||||
'link' => $this->router->pathFor('admin.api_tokens.index') . '?api=' . $api,
|
||||
'title' => __('admin_' . $api),
|
||||
'attributes' => ['class' => 'btn'],
|
||||
'attributes' => ['class' => ''],
|
||||
],
|
||||
'api_tokens_add' => [
|
||||
'link' => $this->router->pathFor('admin.api_tokens.add') . '?api=' . $api,
|
||||
'title' => __('admin_create_new_' . $api . '_token'),
|
||||
'attributes' => ['class' => 'btn active'],
|
||||
'attributes' => ['class' => ' active'],
|
||||
],
|
||||
],
|
||||
]
|
||||
@@ -197,17 +197,17 @@ class ApiController extends Controller
|
||||
'api' => [
|
||||
'link' => $this->router->pathFor('admin.api.index'),
|
||||
'title' => __('admin_api'),
|
||||
'attributes' => ['class' => 'btn'],
|
||||
'attributes' => ['class' => ''],
|
||||
],
|
||||
'api_tokens' => [
|
||||
'link' => $this->router->pathFor('admin.api_tokens.index') . '?api=' . $api,
|
||||
'title' => __('admin_' . $api),
|
||||
'attributes' => ['class' => 'btn'],
|
||||
'attributes' => ['class' => ''],
|
||||
],
|
||||
'api_tokens_add' => [
|
||||
'link' => $this->router->pathFor('admin.api_tokens.add') . '?api=' . $api,
|
||||
'title' => __('admin_create_new_' . $api . '_token'),
|
||||
'attributes' => ['class' => 'btn active'],
|
||||
'attributes' => ['class' => ' active'],
|
||||
],
|
||||
],
|
||||
]
|
||||
|
@@ -89,12 +89,22 @@ class EntriesController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
$entry_current = $this->entries->fetch($this->getEntryID($query));
|
||||
|
||||
if ($entry_current['items_view'] != '') {
|
||||
$items_view = $entry_current['items_view'];
|
||||
} else {
|
||||
$items_view = $this->registry->get('settings.entries.items_view_default');
|
||||
}
|
||||
|
||||
return $this->view->render(
|
||||
$response,
|
||||
'plugins/admin/templates/content/entries/index.html',
|
||||
[
|
||||
'entries_list' => $this->entries->fetch($this->getEntryID($query), ['order_by' => ['field' => 'published_at', 'direction' => 'desc']]),
|
||||
'id_current' => $this->getEntryID($query),
|
||||
'entry_current' => $entry_current,
|
||||
'items_view' => $items_view,
|
||||
'menu_item' => 'entries',
|
||||
'fieldsets' => $fieldsets,
|
||||
'parts' => $parts,
|
||||
@@ -1075,6 +1085,29 @@ class EntriesController extends Controller
|
||||
return $files;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display view token - process
|
||||
*
|
||||
* @param Request $request PSR7 request
|
||||
* @param Response $response PSR7 response
|
||||
*/
|
||||
public function displayViewProcess(Request $request, Response $response) : Response
|
||||
{
|
||||
// Get POST data
|
||||
$post_data = $request->getParsedBody();
|
||||
|
||||
if ($post_data['id'] == '') {
|
||||
$data = [];
|
||||
Arr::set($data, 'entries.items_view_default', $post_data['items_view']);
|
||||
//$this->registry->get('settings')
|
||||
Filesystem::write(PATH['config']['site'] . '/settings.yaml', $this->parser->encode(array_replace_recursive($this->registry->get('settings'), $data), 'yaml'));
|
||||
} else {
|
||||
$this->entries->update($post_data['id'], ['items_view' => $post_data['items_view']]);
|
||||
}
|
||||
|
||||
return $response->withRedirect($this->router->pathFor('admin.entries.index') . '?id=' . $post_data['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear entry counter
|
||||
*
|
||||
|
Reference in New Issue
Block a user