mirror of
https://github.com/wintercms/winter.git
synced 2024-06-28 05:33:29 +02:00
commit
5a9d62d54a
@ -1,8 +1,6 @@
|
||||
<?php namespace Backend;
|
||||
|
||||
use App;
|
||||
use Lang;
|
||||
use Event;
|
||||
use Backend;
|
||||
use BackendMenu;
|
||||
use BackendAuth;
|
||||
|
@ -1,11 +1,6 @@
|
||||
<?php namespace Backend\Traits;
|
||||
|
||||
use Str;
|
||||
use File;
|
||||
use Lang;
|
||||
use Input;
|
||||
use Block;
|
||||
use SystemException;
|
||||
|
||||
/**
|
||||
* Collapsable Widget Trait
|
||||
@ -46,13 +41,13 @@ trait CollapsableWidget
|
||||
$this->putSession('groups', $statuses);
|
||||
}
|
||||
|
||||
protected function getGroupStatus($group)
|
||||
protected function getGroupStatus($group, $default = true)
|
||||
{
|
||||
$statuses = $this->getGroupStatuses();
|
||||
if (array_key_exists($group, $statuses)) {
|
||||
return $statuses[$group];
|
||||
}
|
||||
|
||||
return true;
|
||||
return $default;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
<?php namespace Backend\Traits;
|
||||
|
||||
use Request;
|
||||
use SystemException;
|
||||
use ApplicationException;
|
||||
|
||||
/**
|
||||
|
@ -1,10 +1,6 @@
|
||||
<?php namespace Backend\Traits;
|
||||
|
||||
use Str;
|
||||
use File;
|
||||
use Lang;
|
||||
use Block;
|
||||
use SystemException;
|
||||
|
||||
/**
|
||||
* Searchable Widget Trait
|
||||
|
@ -1,11 +1,6 @@
|
||||
<?php namespace Backend\Traits;
|
||||
|
||||
use Str;
|
||||
use File;
|
||||
use Lang;
|
||||
use Input;
|
||||
use Block;
|
||||
use SystemException;
|
||||
|
||||
/**
|
||||
* Selectable Widget Trait
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
use Lang;
|
||||
use Backend\Classes\FormField;
|
||||
use Backend\Classes\WidgetManager;
|
||||
use SystemException;
|
||||
|
||||
/**
|
||||
|
@ -3,9 +3,6 @@
|
||||
use Str;
|
||||
use Lang;
|
||||
use Input;
|
||||
use Request;
|
||||
use Response;
|
||||
use Cms\Classes\Theme;
|
||||
use System\Classes\PluginManager;
|
||||
use Cms\Classes\ComponentHelpers;
|
||||
use Backend\Classes\WidgetBase;
|
||||
@ -18,9 +15,9 @@ use Backend\Classes\WidgetBase;
|
||||
*/
|
||||
class ComponentList extends WidgetBase
|
||||
{
|
||||
protected $searchTerm = false;
|
||||
use \Backend\Traits\CollapsableWidget;
|
||||
|
||||
protected $groupStatusCache = false;
|
||||
protected $searchTerm = false;
|
||||
|
||||
protected $pluginComponentList;
|
||||
|
||||
@ -61,11 +58,6 @@ class ComponentList extends WidgetBase
|
||||
return $this->updateList();
|
||||
}
|
||||
|
||||
public function onGroupStatusUpdate()
|
||||
{
|
||||
$this->setGroupStatus(Input::get('group'), Input::get('status'));
|
||||
}
|
||||
|
||||
/*
|
||||
* Methods for th internal use
|
||||
*/
|
||||
@ -262,37 +254,4 @@ class ComponentList extends WidgetBase
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function getGroupStatuses()
|
||||
{
|
||||
if ($this->groupStatusCache !== false) {
|
||||
return $this->groupStatusCache;
|
||||
}
|
||||
|
||||
$groups = $this->getSession('groups');
|
||||
if (!is_array($groups)) {
|
||||
return $this->groupStatusCache = [];
|
||||
}
|
||||
|
||||
return $this->groupStatusCache = $groups;
|
||||
}
|
||||
|
||||
protected function setGroupStatus($group, $status)
|
||||
{
|
||||
$statuses = $this->getGroupStatuses();
|
||||
$statuses[$group] = $status;
|
||||
$this->groupStatusCache = $statuses;
|
||||
|
||||
$this->putSession('groups', $statuses);
|
||||
}
|
||||
|
||||
protected function getGroupStatus($group)
|
||||
{
|
||||
$statuses = $this->getGroupStatuses();
|
||||
if (array_key_exists($group, $statuses)) {
|
||||
return $statuses[$group];
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php if ($items): ?>
|
||||
<ul>
|
||||
<?php foreach ($items as $item): ?>
|
||||
<li class="group" data-status="<?= $this->getGroupStatus($item->pluginClass) ? 'expanded' : 'collapsed' ?>" data-group-id="<?= e($item->pluginClass) ?>">
|
||||
<li class="group" data-status="<?= $this->getGroupStatus($item->pluginClass, false) ? 'expanded' : 'collapsed' ?>" data-group-id="<?= e($item->pluginClass) ?>">
|
||||
<div class="group">
|
||||
<h4><a href="#"><?= e(trans($item->title)) ?></a></h4>
|
||||
<i class="<?= $item->icon ?>"></i>
|
||||
|
Loading…
x
Reference in New Issue
Block a user