mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-02 19:36:08 +01:00
Show the access levels filters
This commit is contained in:
@@ -405,7 +405,7 @@ class Admin
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get All template types
|
* Get all template types
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
@@ -415,7 +415,7 @@ class Admin
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get All modular template types
|
* Get all modular template types
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
@@ -424,6 +424,16 @@ class Admin
|
|||||||
return Pages::modularTypes();
|
return Pages::modularTypes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all access levels
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function accessLevels()
|
||||||
|
{
|
||||||
|
return $this->grav['pages']->accessLevels();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all plugins.
|
* Get all plugins.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ $(function(){
|
|||||||
// selectize
|
// selectize
|
||||||
var pageFilter = $('input.page-filter'),
|
var pageFilter = $('input.page-filter'),
|
||||||
pageTypes = pageFilter.data('template-types'),
|
pageTypes = pageFilter.data('template-types'),
|
||||||
|
accessLevels = pageFilter.data('template-access-levels'),
|
||||||
options = [
|
options = [
|
||||||
{flag: 'Modular', key: 'Modular', cat: 'mode'},
|
{flag: 'Modular', key: 'Modular', cat: 'mode'},
|
||||||
{flag: 'Visible', key: 'Visible', cat: 'mode'},
|
{flag: 'Visible', key: 'Visible', cat: 'mode'},
|
||||||
@@ -25,6 +26,10 @@ $(function(){
|
|||||||
options.push({flag: name, key: key, cat: 'type'});
|
options.push({flag: name, key: key, cat: 'type'});
|
||||||
})
|
})
|
||||||
|
|
||||||
|
jQuery.each(accessLevels, function(key, name){
|
||||||
|
options.push({flag: name, key: key, cat: 'access'});
|
||||||
|
})
|
||||||
|
|
||||||
pageFilter.selectize({
|
pageFilter.selectize({
|
||||||
maxItems: null,
|
maxItems: null,
|
||||||
valueField: 'key',
|
valueField: 'key',
|
||||||
@@ -34,11 +39,12 @@ $(function(){
|
|||||||
optgroups: [
|
optgroups: [
|
||||||
{id: 'mode', name: 'Page Modes'},
|
{id: 'mode', name: 'Page Modes'},
|
||||||
{id: 'type', name: 'Page Types'},
|
{id: 'type', name: 'Page Types'},
|
||||||
|
{id: 'access', name: 'Access'},
|
||||||
],
|
],
|
||||||
optgroupField: 'cat',
|
optgroupField: 'cat',
|
||||||
optgroupLabelField: 'name',
|
optgroupLabelField: 'name',
|
||||||
optgroupValueField: 'id',
|
optgroupValueField: 'id',
|
||||||
optgroupOrder: ['mode', 'type'],
|
optgroupOrder: ['mode', 'type', 'access'],
|
||||||
plugins: ['optgroup_columns']
|
plugins: ['optgroup_columns']
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -241,7 +241,7 @@
|
|||||||
{% else %}
|
{% else %}
|
||||||
<form id="page-filtering">
|
<form id="page-filtering">
|
||||||
<div class="page-filters">
|
<div class="page-filters">
|
||||||
<input type="text" data-template-types="{{ admin.types|merge(admin.modularTypes)|json_encode|e('html_attr') }}" placeholder="{{ "PLUGIN_ADMIN.ADD_FILTERS"|tu }}" class="page-filter" name="page-filter" />
|
<input type="text" data-template-types="{{ admin.types|merge(admin.modularTypes)|json_encode|e('html_attr') }}" data-template-access-levels="{{ admin.accessLevels|json_encode|e('html_attr') }}" placeholder="{{ "PLUGIN_ADMIN.ADD_FILTERS"|tu }}" class="page-filter" name="page-filter" />
|
||||||
</div>
|
</div>
|
||||||
<div class="page-search">
|
<div class="page-search">
|
||||||
<input type="text" placeholder="{{ "PLUGIN_ADMIN.SEARCH_PAGES"|tu }}" name="page-search" />
|
<input type="text" placeholder="{{ "PLUGIN_ADMIN.SEARCH_PAGES"|tu }}" name="page-search" />
|
||||||
|
|||||||
Reference in New Issue
Block a user