Merge pull request #1882 from gpasztor87/patch-1

Clean up
This commit is contained in:
Samuel Georges 2016-03-29 23:08:47 +11:00
commit 5a9d62d54a
8 changed files with 5 additions and 64 deletions

View File

@ -1,8 +1,6 @@
<?php namespace Backend;
use App;
use Lang;
use Event;
use Backend;
use BackendMenu;
use BackendAuth;

View File

@ -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;
}
}

View File

@ -1,7 +1,6 @@
<?php namespace Backend\Traits;
use Request;
use SystemException;
use ApplicationException;
/**

View File

@ -1,10 +1,6 @@
<?php namespace Backend\Traits;
use Str;
use File;
use Lang;
use Block;
use SystemException;
/**
* Searchable Widget Trait

View File

@ -1,11 +1,6 @@
<?php namespace Backend\Traits;
use Str;
use File;
use Lang;
use Input;
use Block;
use SystemException;
/**
* Selectable Widget Trait

View File

@ -2,7 +2,6 @@
use Lang;
use Backend\Classes\FormField;
use Backend\Classes\WidgetManager;
use SystemException;
/**

View File

@ -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;
}
}

View File

@ -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>