diff --git a/app/extensions/IconsHelper.php b/app/extensions/IconsHelper.php index 3a592bd..00b6b72 100644 --- a/app/extensions/IconsHelper.php +++ b/app/extensions/IconsHelper.php @@ -31,7 +31,28 @@ class IconsHelper extends \Prefab { static public function icons($node){ + // debug_print($node); + + $required = ['type', 'path']; + $check = self::checkAttributes($node, $required); + if(!is_null($check)){ + return sprintf('
%s
', $check); + } + $attr = $node['@attrib']; + $type = $attr['type']; + $path = $attr['path']; + $selected = $attr['selected']; + + switch($attr['type']){ + case 'status-selector': + $selected = Base::instance()->get('GET.status') ?: null; + return 'renderStatusSelector("'.$selected.'", "'.$path.'"); ?>'; + return self::renderStatusSelector($selected, $path); + + default: + return '
unknown icon selector type
'; + } $tpl = Template::instance(); $f3 = Base::instance(); @@ -43,6 +64,42 @@ class IconsHelper extends \Prefab { } + private static function checkAttributes($node, array $required){ + if(isset($node['@attrib'])){ + $attr = $node['@attrib']; + $errors = []; + + foreach($required as $key){ + if(empty($attr[$key])){ + $errors[] = "Error: '$key' is missing."; + } + } + + return empty($errors) ? null : implode(" ", $errors); + } + return "Error: '@attrib' is missing"; + } + + public static function renderStatusSelector($current_status, $path) + { + $output = '
'; + + foreach (self::$status_icons as $k => $icon) { + $active = ($current_status == $k); + $url = $path . ($active ? '' : '/?status=' . $k); + $class = 'button' . ($active ? ' is-primary' : ''); + + $output .= '

'; + $output .= ''; + $output .= ''; + $output .= '' . self::$status_names[$k] . ''; + $output .= ''; + $output .= '

'; + } + $output .= '
'; + return $output; + } + static function do_the_switch($type, $value){ if($value !== null) { diff --git a/app/ui/views/ticket/create.html b/app/ui/views/ticket/create.html index e9e8d98..f4d8bc9 100644 --- a/app/ui/views/ticket/create.html +++ b/app/ui/views/ticket/create.html @@ -1,30 +1,69 @@ -

Create Ticket Form

- + +
{{ \CSRFHelper::field() | raw }}
-
+
- - + Cancel
- - +
-
-
- Cancel -
-
- +
+
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+
+ +
+ +
+ + + + + + + + + +
-
\ No newline at end of file diff --git a/app/ui/views/ticket/create.html.v1 b/app/ui/views/ticket/create.html.v1 new file mode 100644 index 0000000..3cc4623 --- /dev/null +++ b/app/ui/views/ticket/create.html.v1 @@ -0,0 +1,52 @@ +

Create Ticket Form

+ +
+ + + + + + + + + + + +
+
+
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+
+ +
+
+ Cancel +
+
+ +
+
+
+ \ No newline at end of file diff --git a/app/ui/views/ticket/index.html b/app/ui/views/ticket/index.html index 069b796..438a706 100644 --- a/app/ui/views/ticket/index.html +++ b/app/ui/views/ticket/index.html @@ -20,19 +20,26 @@
+
-
- - -

- - - {{ IconsHelper::$status_names[@k] }} - -

-
-
+ 25
+ + +
+ +
+

diff --git a/app/ui/views/ticket/view.html b/app/ui/views/ticket/view.html index 770a84f..038a4bb 100644 --- a/app/ui/views/ticket/view.html +++ b/app/ui/views/ticket/view.html @@ -30,7 +30,6 @@
Tags
-
@@ -45,10 +44,9 @@
Projects

-
Assignees
+
Assigned User:
-

Assigned User

{{ @assigned_user.display_name ?: @assigned_user.username }}

@@ -84,6 +82,7 @@
+ {{ \CSRFHelper::field() | raw }}
diff --git a/public/index.php b/public/index.php index d744fc6..c345e1a 100644 --- a/public/index.php +++ b/public/index.php @@ -1,5 +1,10 @@ %s', print_r($obj,1)); +} + require '../lib/autoload.php'; $f3 = \Base::instance();