diff --git a/Controller/ConfigController.php b/Controller/ConfigController.php new file mode 100644 index 0000000..f9ca180 --- /dev/null +++ b/Controller/ConfigController.php @@ -0,0 +1,45 @@ +configModel->get('shrink_vertically_offset', self::DEFAULT_OFFSET); + + $this->response->html($this->helper->layout->config('shrinkVertically:config/show', array( + 'title' => t('Settings').' > '.t('Shrink Vertically'), + 'values' => array( + 'shrink_vertically_offset' => $offset, + ), + 'errors' => array(), + ))); + } + + public function save() + { + $values = $this->request->getValues(); + + $offset = isset($values['shrink_vertically_offset']) ? (int) $values['shrink_vertically_offset'] : self::DEFAULT_OFFSET; + $offset = max(self::MIN_OFFSET, min(self::MAX_OFFSET, $offset)); + + if ($this->configModel->save(array('shrink_vertically_offset' => $offset))) { + $this->flash->success(t('Settings saved successfully.')); + } else { + $this->flash->failure(t('Unable to save your settings.')); + } + + $this->response->redirect($this->helper->url->to('ConfigController', 'show', array('plugin' => 'ShrinkVertically'))); + } +} diff --git a/Template/config/show.php b/Template/config/show.php new file mode 100644 index 0000000..7d6c982 --- /dev/null +++ b/Template/config/show.php @@ -0,0 +1,19 @@ + + +
+ form->csrf() ?> + +
+ form->label(t('Vertical offset in pixels'), 'shrink_vertically_offset') ?> + form->number('shrink_vertically_offset', $values, $errors) ?> +

+ +

+
+ +
+ +
+
diff --git a/Template/config/sidebar.php b/Template/config/sidebar.php new file mode 100644 index 0000000..2ec11b6 --- /dev/null +++ b/Template/config/sidebar.php @@ -0,0 +1,3 @@ +
  • app->checkMenuSelection('ConfigController', 'show', 'ShrinkVertically') ?>> + url->link(t('Shrink Vertically'), 'ConfigController', 'show', array('plugin' => 'ShrinkVertically')) ?> +
  • diff --git a/Template/layout/variable.php b/Template/layout/variable.php new file mode 100644 index 0000000..2b17551 --- /dev/null +++ b/Template/layout/variable.php @@ -0,0 +1,3 @@ +