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