drag for mobile - handle sizeable
This commit is contained in:
@@ -13,11 +13,16 @@ class ConfigController extends BaseController
|
||||
const MIN_GAP_SIZE = 0;
|
||||
const MAX_GAP_SIZE = 200;
|
||||
|
||||
const DEFAULT_HANDLE_SIZE = 20;
|
||||
const MIN_HANDLE_SIZE = 8;
|
||||
const MAX_HANDLE_SIZE = 200;
|
||||
|
||||
public function show()
|
||||
{
|
||||
$gapSize = (int) $this->configModel->get('tweakdrag_column_gap_size', self::DEFAULT_GAP_SIZE);
|
||||
$columnGap = (int) $this->configModel->get('tweakdrag_column_gap', 1);
|
||||
$dragScroll = (int) $this->configModel->get('tweakdrag_drag_scroll', 1);
|
||||
$handleSize = (int) $this->configModel->get('tweakdrag_handle_size', self::DEFAULT_HANDLE_SIZE);
|
||||
|
||||
$this->response->html($this->helper->layout->config('tweakDrag:config/show', array(
|
||||
'title' => t('Settings').' > '.t('Tweak Drag'),
|
||||
@@ -25,6 +30,7 @@ class ConfigController extends BaseController
|
||||
'tweakdrag_column_gap_size' => $gapSize,
|
||||
'tweakdrag_column_gap' => $columnGap,
|
||||
'tweakdrag_drag_scroll' => $dragScroll,
|
||||
'tweakdrag_handle_size' => $handleSize,
|
||||
),
|
||||
'errors' => array(),
|
||||
)));
|
||||
@@ -40,10 +46,14 @@ class ConfigController extends BaseController
|
||||
$columnGap = isset($values['tweakdrag_column_gap']) ? 1 : 0;
|
||||
$dragScroll = isset($values['tweakdrag_drag_scroll']) ? 1 : 0;
|
||||
|
||||
$handleSize = isset($values['tweakdrag_handle_size']) ? (int) $values['tweakdrag_handle_size'] : self::DEFAULT_HANDLE_SIZE;
|
||||
$handleSize = max(self::MIN_HANDLE_SIZE, min(self::MAX_HANDLE_SIZE, $handleSize));
|
||||
|
||||
if ($this->configModel->save(array(
|
||||
'tweakdrag_column_gap_size' => $gapSize,
|
||||
'tweakdrag_column_gap' => $columnGap,
|
||||
'tweakdrag_drag_scroll' => $dragScroll,
|
||||
'tweakdrag_handle_size' => $handleSize,
|
||||
))) {
|
||||
$this->flash->success(t('Settings saved successfully.'));
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user