[Rt-commit] rt branch, 4.4/timer-comments, created. rt-4.4.0-228-g89adaad

Shawn Moore shawn at bestpractical.com
Wed Jun 1 17:35:05 EDT 2016


The branch, 4.4/timer-comments has been created
        at  89adaadd22cca0e54a9b348be867a87e5394d627 (commit)

- Log -----------------------------------------------------------------
commit 68362a50927e632cfc60ba63460fa43903cd0cb4
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Jun 1 21:23:57 2016 +0000

    Add Placeholder argument to /Elements/MessageBox

diff --git a/share/html/Elements/MessageBox b/share/html/Elements/MessageBox
index 78753ab..c36bcd6 100644
--- a/share/html/Elements/MessageBox
+++ b/share/html/Elements/MessageBox
@@ -45,7 +45,7 @@
 %# those contributions and any derivatives thereof.
 %#
 %# END BPS TAGGED BLOCK }}}
-<textarea autocomplete="off" class="messagebox <% $Type eq 'text/html' ? 'richtext' : '' %>" <% $width_attr %>="<% $Width %>" rows="<% $Height %>" <% $wrap_type |n %> name="<% $Name %>" id="<% $Name %>">
+<textarea autocomplete="off" class="messagebox <% $Type eq 'text/html' ? 'richtext' : '' %>" <% $width_attr %>="<% $Width %>" rows="<% $Height %>" <% $wrap_type |n %> name="<% $Name %>" id="<% $Name %>" placeholder="<% $Placeholder %>">
 % $m->comp('/Articles/Elements/IncludeArticle', %ARGS) if $IncludeArticle;
 % $m->callback( %ARGS, SignatureRef => \$signature, DefaultRef => \$Default, MessageRef => $message );
 % if (RT->Config->Get("SignatureAboveQuote", $session{'CurrentUser'})) {
@@ -124,4 +124,5 @@ $IncludeSignature          => RT->Config->Get('MessageBoxIncludeSignature');
 $IncludeArticle            => 1;
 $Type                      => RT->Config->Get('MessageBoxRichText',  $session{'CurrentUser'}) ? 'text/html' : 'text/plain';
 $SuppressAttachmentWarning => 0
+$Placeholder               => ''
 </%ARGS>

commit 89adaadd22cca0e54a9b348be867a87e5394d627
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Wed Jun 1 21:32:15 2016 +0000

    Add comment box to ticket timer
    
    Fixes: I#31714

diff --git a/share/html/Helpers/AddTimeWorked b/share/html/Helpers/AddTimeWorked
index 5c764d2..2fca50a 100644
--- a/share/html/Helpers/AddTimeWorked
+++ b/share/html/Helpers/AddTimeWorked
@@ -48,6 +48,7 @@
 <%ARGS>
 $id
 $seconds => 0
+$comment => undef
 </%ARGS>
 <%INIT>
 my $Ticket = RT::Ticket->new($session{'CurrentUser'});
@@ -61,10 +62,25 @@ if ($minutes == 0) {
     # avoid "That is already the current value" error
     $ok = 1;
     $msg = loc("Worked [quant,_1,minute,minutes]", 0);
+
+    if ($comment) {
+        my ($comment_ok, $comment_msg) = $Ticket->Comment(Content => $comment);
+        if (!$comment_ok) {
+            ($ok, $msg) = ($comment_ok, $comment_msg);
+        }
+    }
 }
 else {
-    my $total_worked = $Ticket->TimeWorked + $minutes;
-    ($ok, $msg) = $Ticket->SetTimeWorked($total_worked);
+    if ($comment) {
+        ($ok, $msg) = $Ticket->Comment(
+            Content   => $comment,
+            TimeTaken => $minutes,
+        );
+    }
+    else {
+        my $total_worked = $Ticket->TimeWorked + $minutes;
+        ($ok, $msg) = $Ticket->SetTimeWorked($total_worked);
+    }
 
     if ($ok) {
         if ($minutes < 60) {
diff --git a/share/html/Helpers/TicketTimer b/share/html/Helpers/TicketTimer
index 2a8b0d6..7807ecc 100644
--- a/share/html/Helpers/TicketTimer
+++ b/share/html/Helpers/TicketTimer
@@ -141,7 +141,8 @@ jQuery( function() {
 
         var Payload = {
             id: <% $Ticket->id %>,
-            seconds: CommittedSeconds
+            seconds: CommittedSeconds,
+            comment: jQuery('#Comment').val()
         };
 
         Readout.text('<% loc("Submitting") %>');
@@ -204,6 +205,17 @@ jQuery( function() {
             <a href="#" class="submit-time"><img src="<% RT->Config->Get('WebPath') %>/static/images/submit.png" alt="<% loc('Submit Timer') %>" title="<% loc('Submit Timer') %>" /></a>
             <a href="#" class="close-popup hidden"><img src="<% RT->Config->Get('WebPath') %>/static/images/close.png" alt="<% loc('Close Window') %>" title="<% loc('Close Window') %>" /></a>
         </div>
+
+        <& /Elements/MessageBox,
+            Name => 'Comment',
+            Type => 'text/plain',
+            Height => 3,
+            Width => undef, # sets width:100% CSS
+            Placeholder => loc('Comments for the ticket'),
+            SuppressAttachmentWarning => 1,
+            IncludeSignature => 0,
+            IncludeArticle => 0,
+        &>
     </div>
 
     <div class="extra"><&|/l, $Now->AsString &>Started at [_1].</&></div>
diff --git a/share/static/css/rudder/ticket-timer.css b/share/static/css/rudder/ticket-timer.css
index e2fe8dd..81613da 100644
--- a/share/static/css/rudder/ticket-timer.css
+++ b/share/static/css/rudder/ticket-timer.css
@@ -27,7 +27,7 @@
 .ticket-timer .gutter {
     border-bottom: 1px solid #ccc;
     background-color: #eee;
-    padding: 0.5em 0;
+    padding: 0.5em;
 }
 
 .ticket-timer .extra,

-----------------------------------------------------------------------


More information about the rt-commit mailing list