* dashboard support resize by drag edge.
This commit is contained in:
@@ -152,6 +152,28 @@ class block extends control
|
||||
$this->send(array('result' => 'success'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Resize block
|
||||
* @param integer $id
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function resize($id, $grid = 4)
|
||||
{
|
||||
$block = $this->block->getByID($id);
|
||||
if($block)
|
||||
{
|
||||
$block->grid = $grid;
|
||||
$this->dao->replace(TABLE_BLOCK)->data($block)->exec();
|
||||
if(dao::isError()) $this->send(array('result' => 'fail', 'code' => 500));
|
||||
$this->send(array('result' => 'success'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->send(array('result' => 'fail', 'code' => 404));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display dashboard for app.
|
||||
*
|
||||
|
||||
@@ -35,7 +35,7 @@ function sortBlocks(orders)
|
||||
|
||||
$.getJSON(createLink('block', 'sort', 'orders=' + newOrders.join(',') + '&module=' + module), function(data)
|
||||
{
|
||||
if(data.result == 'success') $.zui.messager.success(config.ordersSaved);
|
||||
// if(data.result == 'success') $.zui.messager.success(config.ordersSaved);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -51,6 +51,15 @@ function checkEmpty()
|
||||
$dashboard.find('.dashboard-empty-message').toggleClass('hide', hasBlocks);
|
||||
}
|
||||
|
||||
function resizeBlock(event)
|
||||
{
|
||||
var blockID = event.element.find('.panel').data('id');
|
||||
$.getJSON(createLink('block', 'resize', 'id=' + blockID + '&grid=' + event.grid), function(data)
|
||||
{
|
||||
if(data.result !== 'success') event.revert();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$(function()
|
||||
{
|
||||
@@ -62,7 +71,9 @@ $(function()
|
||||
afterOrdered : sortBlocks,
|
||||
afterPanelRemoved : deleteBlock,
|
||||
sensitive : true,
|
||||
panelRemovingTip : config.confirmRemoveBlock
|
||||
panelRemovingTip : config.confirmRemoveBlock,
|
||||
resizable : true,
|
||||
onResize : resizeBlock
|
||||
});
|
||||
|
||||
$dashboard.find('ul.dashboard-actions').addClass('hide').children('li').addClass('right').appendTo($('#modulemenu > .nav'));
|
||||
|
||||
+2
-1
@@ -1759,8 +1759,9 @@ function initHelpLink()
|
||||
function initMainMenu()
|
||||
{
|
||||
var $menu = $('#mainmenu > .nav');
|
||||
$menu.sortable();
|
||||
$menu.sortable({
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/* Ping the server every some minutes to keep the session. */
|
||||
|
||||
Reference in New Issue
Block a user