summaryrefslogtreecommitdiff
path: root/app/Helper/ModalHelper.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2017-01-02 17:01:27 -0500
committerFrederic Guillot <fred@kanboard.net>2017-01-02 17:01:27 -0500
commit3833c12ccce59bcc49c4cfa892401973558f604d (patch)
treeb67b0e10cdc3d42e5626f728206138a444a40ed0 /app/Helper/ModalHelper.php
parentd49ce63e51f596ad3bf0d02b689aea673cf544f8 (diff)
Refactoring/rewrite of modal boxes handling
Diffstat (limited to 'app/Helper/ModalHelper.php')
-rw-r--r--app/Helper/ModalHelper.php73
1 files changed, 73 insertions, 0 deletions
diff --git a/app/Helper/ModalHelper.php b/app/Helper/ModalHelper.php
new file mode 100644
index 00000000..e6037a8c
--- /dev/null
+++ b/app/Helper/ModalHelper.php
@@ -0,0 +1,73 @@
+<?php
+
+namespace Kanboard\Helper;
+
+use Kanboard\Core\Base;
+
+/**
+ * Class ModalHelper
+ *
+ * @package Kanboard\Helper
+ * @author Frederic Guillot
+ */
+class ModalHelper extends Base
+{
+ public function submitButtons(array $params = array())
+ {
+ return $this->helper->app->component('submit-buttons', array(
+ 'submitLabel' => isset($params['submitLabel']) ? $params['submitLabel'] : t('Save'),
+ 'orLabel' => t('or'),
+ 'cancelLabel' => t('cancel'),
+ 'color' => isset($params['color']) ? $params['color'] : 'blue',
+ 'tabindex' => isset($params['tabindex']) ? $params['tabindex'] : null,
+ 'disabled' => isset($params['disabled']) ? true : false,
+ ));
+ }
+
+ public function confirmButtons($controller, $action, array $params = array(), $submitLabel = '', $tabindex = null)
+ {
+ return $this->helper->app->component('confirm-buttons', array(
+ 'url' => $this->helper->url->href($controller, $action, $params, true),
+ 'submitLabel' => $submitLabel ?: t('Yes'),
+ 'orLabel' => t('or'),
+ 'cancelLabel' => t('cancel'),
+ 'tabindex' => $tabindex,
+ ));
+ }
+
+ public function largeIcon($icon, $label, $controller, $action, array $params = array())
+ {
+ $html = '<i class="fa fa-'.$icon.' fa-fw js-modal-large" aria-hidden="true"></i>';
+ return $this->helper->url->link($html, $controller, $action, $params, false, 'js-modal-large', $label);
+ }
+
+ public function large($icon, $label, $controller, $action, array $params = array())
+ {
+ $html = '<i class="fa fa-'.$icon.' fa-fw js-modal-large" aria-hidden="true"></i> '.$label;
+ return $this->helper->url->link($html, $controller, $action, $params, false, 'js-modal-large');
+ }
+
+ public function medium($icon, $label, $controller, $action, array $params = array())
+ {
+ $html = '<i class="fa fa-'.$icon.' fa-fw js-modal-medium" aria-hidden="true"></i> '.$label;
+ return $this->helper->url->link($html, $controller, $action, $params, false, 'js-modal-medium');
+ }
+
+ public function small($icon, $label, $controller, $action, array $params = array())
+ {
+ $html = '<i class="fa fa-'.$icon.' fa-fw js-modal-small" aria-hidden="true"></i> '.$label;
+ return $this->helper->url->link($html, $controller, $action, $params, false, 'js-modal-small');
+ }
+
+ public function mediumButton($icon, $label, $controller, $action, array $params = array())
+ {
+ $html = '<i class="fa fa-'.$icon.' fa-fw js-modal-medium" aria-hidden="true"></i> '.$label;
+ return $this->helper->url->link($html, $controller, $action, $params, false, 'js-modal-medium btn');
+ }
+
+ public function confirm($icon, $label, $controller, $action, array $params = array())
+ {
+ $html = '<i class="fa fa-'.$icon.' fa-fw js-modal-confirm" aria-hidden="true"></i> '.$label;
+ return $this->helper->url->link($html, $controller, $action, $params, false, 'js-modal-confirm');
+ }
+}