From 057a15a073fdae1ff2bf7102e368cebe027c124c Mon Sep 17 00:00:00 2001
From: Peter Rotich <peter@osticket.com>
Date: Mon, 13 Jul 2015 17:48:25 +0000
Subject: [PATCH] Make action verbs generic

Add danger to delete actions.
---
 include/staff/templates/task-view.tmpl.php    |  1 +
 .../staff/templates/tasks-actions.tmpl.php    | 19 +++++++++-------
 include/staff/ticket-tasks.inc.php            |  2 +-
 include/staff/ticket-view.inc.php             | 22 ++++++++++---------
 4 files changed, 25 insertions(+), 19 deletions(-)

diff --git a/include/staff/templates/task-view.tmpl.php b/include/staff/templates/task-view.tmpl.php
index e3d577c87..1ca83b30e 100644
--- a/include/staff/templates/task-view.tmpl.php
+++ b/include/staff/templates/task-view.tmpl.php
@@ -50,6 +50,7 @@ if ($role->hasPerm(Task::PERM_DELETE)) {
             'delete' => array(
                 'href' => sprintf('#tasks/%d/delete', $task->getId()),
                 'icon' => 'icon-trash',
+                'class' => 'red button task-action',
                 'label' => __('Delete')
             ));
 }
diff --git a/include/staff/templates/tasks-actions.tmpl.php b/include/staff/templates/tasks-actions.tmpl.php
index e5407d2ed..fcf6192a4 100644
--- a/include/staff/templates/tasks-actions.tmpl.php
+++ b/include/staff/templates/tasks-actions.tmpl.php
@@ -26,7 +26,7 @@ if ($agent->hasPerm(Task::PERM_CLOSE, false)) {
                     <a class="no-pjax tasks-action"
                         href="#tasks/mass/reopen"><i
                         class="icon-fixed-width icon-undo"></i> <?php
-                        echo __('Reopen Tasks');?> </a>
+                        echo __('Reopen');?> </a>
                 </li>
                 <?php
                 }
@@ -36,7 +36,7 @@ if ($agent->hasPerm(Task::PERM_CLOSE, false)) {
                     <a class="no-pjax tasks-action"
                         href="#tasks/mass/close"><i
                         class="icon-fixed-width icon-ok-circle"></i> <?php
-                        echo __('Close Tasks');?> </a>
+                        echo __('Close');?> </a>
                 </li>
                 <?php
                 } ?>
@@ -48,13 +48,13 @@ if ($agent->hasPerm(Task::PERM_CLOSE, false)) {
         $actions += array(
                 'reopen' => array(
                     'icon' => 'icon-undo',
-                    'action' => __('Reopen Tasks')
+                    'action' => __('Reopen')
                 ));
 
         $actions += array(
                 'close' => array(
                     'icon' => 'icon-ok-circle',
-                    'action' => __('Close Tasks')
+                    'action' => __('Close')
                 ));
     }
 }
@@ -63,7 +63,7 @@ if ($agent->hasPerm(Task::PERM_ASSIGN, false)) {
     $actions += array(
             'assign' => array(
                 'icon' => 'icon-user',
-                'action' => __('Assign Tasks')
+                'action' => __('Assign')
             ));
 }
 
@@ -71,15 +71,16 @@ if ($agent->hasPerm(Task::PERM_TRANSFER, false)) {
     $actions += array(
             'transfer' => array(
                 'icon' => 'icon-share',
-                'action' => __('Transfer Tasks')
+                'action' => __('Transfer')
             ));
 }
 
 if ($agent->hasPerm(Task::PERM_DELETE, false)) {
     $actions += array(
             'delete' => array(
+                'class' => 'danger',
                 'icon' => 'icon-trash',
-                'action' => __('Delete Tasks')
+                'action' => __('Delete')
             ));
 }
 if ($actions) {
@@ -98,7 +99,9 @@ if ($actions) {
         class="action-dropdown anchor-right">
         <ul>
     <?php foreach ($actions as $a => $action) { ?>
-            <li>
+            <li <?php
+                if ($action['class'])
+                    echo sprintf("class='%s'", $action['class']); ?> >
                 <a class="no-pjax tasks-action"
                     <?php
                     if ($action['dialog'])
diff --git a/include/staff/ticket-tasks.inc.php b/include/staff/ticket-tasks.inc.php
index 824ebb154..9085ab239 100644
--- a/include/staff/ticket-tasks.inc.php
+++ b/include/staff/ticket-tasks.inc.php
@@ -43,7 +43,7 @@ $showing = $pageNav->showing().' '._N('task', 'tasks', $count);
     Task::getAgentActions($thisstaff, array('morelabel' => __('Options')));
     ?>
 </div>
-<br/>
+<div class="clear"></div>
 <div>
 <?php
 if ($count) { ?>
diff --git a/include/staff/ticket-view.inc.php b/include/staff/ticket-view.inc.php
index d037930f3..609e21475 100644
--- a/include/staff/ticket-view.inc.php
+++ b/include/staff/ticket-view.inc.php
@@ -107,15 +107,8 @@ if($ticket->isOverdue())
                     echo __('Change Owner'); ?></a></li>
                 <?php
                  }
-                 if ($role->hasPerm(TicketModel::PERM_DELETE)) {
-                     ?>
-                    <li><a class="ticket-action" href="#tickets/<?php
-                    echo $ticket->getId(); ?>/status/delete"
-                    data-href="tickets.php"><i class="icon-trash"></i> <?php
-                    echo __('Delete Ticket'); ?></a></li>
-                <?php
-                 }
-                if($ticket->isOpen() && ($dept && $dept->isManager($thisstaff))) {
+
+                 if($ticket->isOpen() && ($dept && $dept->isManager($thisstaff))) {
 
                     if($ticket->isAssigned()) { ?>
                         <li><a  class="confirm-action" id="ticket-release" href="#release"><i class="icon-user"></i> <?php
@@ -159,7 +152,16 @@ if($ticket->isOverdue())
                                 $ticket->getEmail()); ?></a></li>
                     <?php
                      }
-                }?>
+                  }
+                  if ($role->hasPerm(TicketModel::PERM_DELETE)) {
+                     ?>
+                    <li class="danger"><a class="ticket-action" href="#tickets/<?php
+                    echo $ticket->getId(); ?>/status/delete"
+                    data-href="tickets.php"><i class="icon-trash"></i> <?php
+                    echo __('Delete Ticket'); ?></a></li>
+                <?php
+                 }
+                ?>
               </ul>
             </div>
         </div>
-- 
GitLab