diff --git a/include/staff/templates/task-view.tmpl.php b/include/staff/templates/task-view.tmpl.php index 0e3f509268b1b5dcded6377b5a137af6be80a029..7cc7c42b331a8fb0888bb2bf7046361426e80503 100644 --- a/include/staff/templates/task-view.tmpl.php +++ b/include/staff/templates/task-view.tmpl.php @@ -59,13 +59,15 @@ if ($task->isOverdue()) $warn.=' <span class="Icon overdueTicket">'.__('Marked overdue!').'</span>'; ?> -<table width="940" cellpadding="2" cellspacing="0" border="0"> - <tr> - <td width="<?php echo $ticket ? '70%' : '20%'; ?>" class="has_bottom_border"> + +<div class="has_bottom_border" class="sticky bar stop"> + <div class="sticky bar"> + <div class="content"> + <div class="pull-left flush-left"> <?php if ($ticket) { ?> <strong> - <a id="tasks" href="#"> All Tasks (<?php echo $ticket->getNumTasks(); ?>)</a> + <a id="ticket-tasks" href="#"> All Tasks (<?php echo $ticket->getNumTasks(); ?>)</a> / <?php echo $task->getTitle(); ?> — @@ -88,11 +90,12 @@ if ($task->isOverdue()) href="tasks.php?id=<?php echo $task->getId(); ?>" ><i class="icon-refresh"></i> <?php echo sprintf(__('Task #%s'), $task->getNumber()); ?></a> + <span class="faded notsticky"> — <?php echo $task->getTitle(); ?></span> </h2> <?php } ?> - </td> - <td width="auto" class="flush-right has_bottom_border"> + </div> + <div class="flush-right"> <?php if ($ticket) { ?> <span @@ -143,9 +146,10 @@ if ($task->isOverdue()) <?php } } ?> - </td> - </tr> -</table> + </div> + </div> + </div> +</div> <?php if (!$ticket) { ?> @@ -279,14 +283,18 @@ if (!$ticket) { ?> } ?> <div class="clear"></div> <div id="task_thread_container"> - <div id="task_thread_content" data-thread-id="<?php echo - $task->getThread()->getId(); ?>" class="tab_content"> - <?php - $task->getThread()->render(array('M', 'R', 'N')); - ?> + <div id="task_thread_content" class="tab_content"> + <?php + $task->getThread()->render(array('M', 'R', 'N'), + array( + 'mode' => Thread::MODE_STAFF, + 'container' => 'taskThread' + ) + ); + ?> </div> </div> -<div class="clear" style="padding-bottom:10px;"></div> +<div class="clear"></div> <?php if($errors['err']) { ?> <div id="msg_error"><?php echo $errors['err']; ?></div> <?php }elseif($msg) { ?> @@ -301,7 +309,7 @@ if ($ticket) else $action = 'tasks.php?id='.$task->getId(); ?> -<div id="response_options"> +<div id="response_options" class="sticky bar stop"> <ul class="tabs"></ul> <form id="<?php echo $ticket? 'ticket_task_note': 'task_note'; ?>" action="<?php echo $action; ?>" @@ -367,7 +375,8 @@ else <script type="text/javascript"> $(function() { - $(document).on('click', 'li.active a#ticket_tasks, a#tasks', function(e) { + $(document).off('.tasks-content'); + $(document).on('click.tasks-content', 'a#ticket-tasks', function(e) { e.preventDefault(); $('div#task_content').hide().empty(); $('div#tasks_content').show(); diff --git a/include/staff/ticket-tasks.inc.php b/include/staff/ticket-tasks.inc.php index 802ea24989c6da9017493a42e418291722395c4e..84300a10d52a1ebb1d416bfa97670a7cf8c2f215 100644 --- a/include/staff/ticket-tasks.inc.php +++ b/include/staff/ticket-tasks.inc.php @@ -132,14 +132,20 @@ if ($count) { ?> </div> <script type="text/javascript"> $(function() { + + $(document).off('click.tasks'); $(document).on('click.tasks', 'tbody.tasks a, a#reload-task', function(e) { e.preventDefault(); var url = 'ajax.php/'+$(this).attr('href').substr(1); var $container = $('div#task_content'); - $container.load(url, function () { + var $stop = $('ul#ticket_tabs').offset().top; + $.pjax({url: url, container: $container, push: false, scrollTo: $stop}) + .done( + function() { + $container.show(); $('.tip_box').remove(); $('div#tasks_content').hide(); - }).show(); + }); return false; }); // Ticket Tasks diff --git a/include/staff/ticket-view.inc.php b/include/staff/ticket-view.inc.php index 72bef8fb101573a5d9f52b23c01aa5057e5e059d..49d30eb1a5e65a3cea74367d514ef6d540f3e2f7 100644 --- a/include/staff/ticket-view.inc.php +++ b/include/staff/ticket-view.inc.php @@ -164,9 +164,6 @@ if($ticket->isOverdue()) }?> </ul> </div> - <a class="only sticky scroll-up" href="#" onclick="javascript: $('html, body').animate({scrollTop: 0}, 'fast'); return false;" - ><i class="icon-chevron-up icon-large"></i> - </a> </div> <div class="flush-left"> <h2><a href="tickets.php?id=<?php echo $ticket->getId(); ?>" diff --git a/scp/js/scp.js b/scp/js/scp.js index b76f236ee41ae6fe5cb49b7a8881f1303e191725..2d93705cdbbe88dfc41d3e5e57faf06e5f1b40a4 100644 --- a/scp/js/scp.js +++ b/scp/js/scp.js @@ -435,6 +435,15 @@ var scp_prep = function() { } }); + // Scroll to a stop or top on scroll-up click + $(document).off('click.scroll-up'); + $(document).on('click.scroll-up', 'a.scroll-up', function() { + $stop = $(this).data('stop'); + $('html, body').animate({scrollTop: ($stop ? $stop : 0)}, 'fast'); + return false; + }); + + // Make translatable fields translatable $('input[data-translate-tag], textarea[data-translate-tag]').translatable(); @@ -449,10 +458,15 @@ var scp_prep = function() { placeholder = $('<div class="sticky placeholder">').insertBefore($that), offset = $that.offset(), top = offset.top - parseFloat($that.css('marginTop').replace(/auto/, 100)), - stop = $('div.sticky.bar.stop'), + stop = $('div.sticky.bar.stop').filter(':visible'), stopAt, visible = false; + // Append scroll-up icon and set stop point for this sticky + $('.content', $that) + .append($('<a class="only sticky scroll-up" href="#" data-stop=' + + (placeholder.offset().top-75) +' ><i class="icon-chevron-up icon-large"></i></a>')); + if (stop.length) { var onmove = function() { // Recalc when pictures pop in @@ -465,7 +479,7 @@ var scp_prep = function() { } // Drop the sticky bar on PJAX navigation - $(document).on('pjax:click', function() { + $(document).on('pjax:start', function() { placeholder.removeAttr('style'); $that.stop().removeClass('fixed'); $(window).off('.sticky');