mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 20:58:30 +01:00
Issue #2794 Enhancement: Grid View toggle button for Admin-UI
This commit is contained in:
parent
edfcdb8195
commit
c7e5af666d
@ -157,7 +157,8 @@ class media_admin extends e_admin_dispatcher
|
||||
|
||||
|
||||
protected $adminMenuAliases = array(
|
||||
'main/edit' => 'main/list'
|
||||
'main/edit' => 'main/list',
|
||||
'main/grid' => 'main/list'
|
||||
);
|
||||
|
||||
protected $menuTitle = LAN_MEDIAMANAGER;
|
||||
@ -179,6 +180,8 @@ class media_cat_ui extends e_admin_ui
|
||||
|
||||
// protected $editQry = "SELECT * FROM #faq_info WHERE faq_info_id = {ID}";
|
||||
|
||||
|
||||
|
||||
protected $fields = array(
|
||||
//'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'),
|
||||
'media_cat_id' => array('title'=> LAN_ID, 'type' => 'number', 'width' =>'5%', 'nolist'=>true, 'forced'=> TRUE, 'readonly'=>TRUE),
|
||||
@ -635,6 +638,14 @@ class media_form_ui extends e_admin_form_ui
|
||||
switch($mode)
|
||||
{
|
||||
case 'read':
|
||||
if($this->getController()->getAction() === 'grid')
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
$img = $this->getController()->getFieldVar('media_url');
|
||||
$size = 400;
|
||||
return $tp->toImage($img, array('w'=>$size,'h'=>$size, 'crop'=>1));
|
||||
}
|
||||
|
||||
$attributes['readParms'] = 'thumb=60&thumb_urlraw=0&thumb_aw=60';
|
||||
$val = $this->getController()->getListModel()->get('media_url');
|
||||
break;
|
||||
@ -743,6 +754,9 @@ class media_admin_ui extends e_admin_ui
|
||||
public $deleteConfirmScreen = true;
|
||||
public $deleteConfirmMessage = IMALAN_129;
|
||||
|
||||
protected $grid = array('title'=>'media_name', 'image'=>'media_preview', 'body'=>'', 'class'=>'col-md-2', 'perPage'=>12, 'carousel'=>false);
|
||||
|
||||
|
||||
|
||||
protected $preftabs = array(IMALAN_78,IMALAN_89, "Youtube");
|
||||
|
||||
|
@ -445,6 +445,9 @@ define("E_32_TRUE", "<i class='S32 e-true-32'></i>");
|
||||
define("ADMIN_TRUE_ICON", "<i class='fa fa-check text-success'></i>");
|
||||
define("ADMIN_FALSE_ICON", "<i class='fa fa-times text-danger'></i>");
|
||||
define("ADMIN_WARNING_ICON", "<i class='fa fa-warning text-warning'></i>");
|
||||
define("ADMIN_GRID_ICON", "<i class='fa fa-th'></i>");
|
||||
define("ADMIN_LIST_ICON", "<i class='fa fa-th-list'></i>");
|
||||
|
||||
/*
|
||||
define("ADMIN_EDIT_ICON", "<i class='fa fa-edit fa-2x fa-fw'></i>");
|
||||
define("ADMIN_DELETE_ICON", "<i class='fa fa-trash fa-2x fa-fw'></i>");
|
||||
|
@ -6580,7 +6580,7 @@ class e_admin_form_ui extends e_form
|
||||
*/
|
||||
public function renderPagination()
|
||||
{
|
||||
if($this->getController()->getGrid('carousel') === true)
|
||||
if($this->getController()->getAction() === 'grid' && $this->getController()->getGrid('carousel') === true)
|
||||
{
|
||||
return '<div class="btn-group" >
|
||||
<a id="admin-ui-carousel-prev" class="btn btn-default" href="#admin-ui-carousel" data-slide="prev"><i class="fa fa-backward"></i></a>
|
||||
@ -6651,6 +6651,19 @@ class e_admin_form_ui extends e_form
|
||||
|
||||
// $tree = $this->getTree();
|
||||
// $total = $this->getTotal();
|
||||
$grid = $this->getController()->getGrid();
|
||||
$gridToggle = '';
|
||||
|
||||
if(!empty($grid))
|
||||
{
|
||||
$gridAction = $this->getController()->getAction() === 'grid' ? 'list' : 'grid';
|
||||
$gridQuery = (array) $_GET;
|
||||
$gridQuery['action'] = $gridAction;
|
||||
$toggleUrl = e_REQUEST_SELF."?".http_build_query($gridQuery);
|
||||
$gridIcon = ($gridAction === 'grid') ? ADMIN_GRID_ICON : ADMIN_LIST_ICON;
|
||||
$gridTitle = ($gridAction === 'grid') ? LAN_UI_VIEW_GRID_LABEL : LAN_UI_VIEW_LIST_LABEL;
|
||||
$gridToggle = "<a class='btn btn-default' href='".$toggleUrl."' title=\"".$gridTitle."\">".$gridIcon."</a>";
|
||||
}
|
||||
|
||||
|
||||
$text = "
|
||||
@ -6672,15 +6685,16 @@ class e_admin_form_ui extends e_form
|
||||
<div class='e-autocomplete'></div>
|
||||
".implode("\n", $filter_preserve_var)."
|
||||
".$this->admin_button('etrigger_filter', 'etrigger_filter', 'filter e-hide-if-js', ADMIN_FILTER_ICON, array('id' => false,'title'=>LAN_FILTER))."
|
||||
|
||||
|
||||
".$this->renderPagination()."
|
||||
<span class='indicator' style='display: none;'>
|
||||
<img src='".e_IMAGE_ABS."generic/loading_16.gif' class='icon action S16' alt='".LAN_LOADING."' />
|
||||
</span>
|
||||
".$gridToggle."
|
||||
</div>
|
||||
<div id='admin-ui-list-db-language' class='span4 col-md-4 text-right' >";
|
||||
|
||||
|
||||
|
||||
// Let Admin know which language table is being saved to. (avoid default table overwrites)
|
||||
$text .= $this->renderLanguageTableInfo();
|
||||
|
||||
|
@ -540,3 +540,6 @@ define("LAN_SOURCE", "Source");
|
||||
define("LAN_ERROR_CONNECTION","Unable to connect for updates. Please check firewall and/or internet connection.");
|
||||
|
||||
define("LAN_UI_X_CANT_EQUAL_Y", "[x] cannot be the same as [y]");
|
||||
define("LAN_UI_VIEW_GRID_LABEL", "Grid view");
|
||||
define("LAN_UI_VIEW_LIST_LABEL", "List view");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user