diff --git a/include/ajax.tickets.php b/include/ajax.tickets.php index 4e87d0866b96dab2c529ca9f1dec7b4d00fbf462..0adc1abcb6bd3347ad7ba425e7de588e1a1fd908 100644 --- a/include/ajax.tickets.php +++ b/include/ajax.tickets.php @@ -463,9 +463,6 @@ class TicketsAjaxAPI extends AjaxController { || !$ticket->checkStaffAccess($thisstaff)) Http::response(404, 'No such ticket'); - if (!$ticket->getCollaborators()) - Http::response(404, 'No such ticket'); - ob_start(); include STAFFINC_DIR . 'templates/collaborators-preview.tmpl.php'; $resp = ob_get_contents(); diff --git a/include/staff/templates/collaborators-preview.tmpl.php b/include/staff/templates/collaborators-preview.tmpl.php index f41150b7b6f29e8786802b497bbaa71f603deb8a..bd9a3b6d0d25199c94664b86566da1ca8eec6a1d 100644 --- a/include/staff/templates/collaborators-preview.tmpl.php +++ b/include/staff/templates/collaborators-preview.tmpl.php @@ -12,17 +12,33 @@ if (($users=$ticket->getCollaborators())) {?> $user->getEmail()); } } else { - echo "Bro, not sure how you got here!"; + echo "<strong>Ticket doesn't have collaborators.</strong>"; }?> </table> <?php $options = array(); -//TODO: Add options to manage collaborators + +$options[] = sprintf( + '<a class="collaborators" id="managecollab" href="#tickets/%d/collaborators">%s</a>', + $ticket->getId(), + $ticket->getNumCollaborators() + ? 'Manage Collaborators' : 'Add Collaborator' + ); + if ($options) { echo '<ul class="tip_menu">'; foreach($options as $option) - echo sprintf('<li><a href="%s">%s</a></li>', $option['url'], $option['action']); + echo sprintf('<li>%s</li>', $option); echo '</ul>'; } ?> </div> +<script type="text/javascript"> +$(function() { + $(document).on('click', 'a#managecollab', function (e) { + e.preventDefault(); + $('.tip_box').remove(); + return false; + }); +}); +</script>