[Rt-commit] rt branch, 4.6/inline-edit, updated. rt-4.4.1-182-g9b83476
Shawn Moore
shawn at bestpractical.com
Tue Sep 20 16:52:06 EDT 2016
The branch, 4.6/inline-edit has been updated
via 9b83476abadfe11a7b7336195a645e00b5c5b738 (commit)
via 723edf172bb4029c3c030cd3a753c85b173cc70f (commit)
via 8b879f1aad119193dc173090961f5957997ce4e6 (commit)
via b0dd30335d3cae848671fbfbb038b4ecf6b57735 (commit)
via 708ecc5cb1bad20aef8db864e402e280a7277aac (commit)
via 0ae1f598c648a1b9fe16a262c330a5e122b675fd (commit)
from 8d7505111638510a1b687e5018be6e0a334779c6 (commit)
Summary of changes:
share/html/Elements/CollectionAsTable/Row | 2 +-
share/html/Elements/EditLinks | 9 +++
share/html/Elements/ShowCustomFieldCustomGroupings | 22 ++++++-
share/html/Helpers/CollectionListRow | 14 ++--
share/html/Ticket/Display.html | 3 +-
share/html/Ticket/Elements/ShowSummary | 76 +++++++++++++++++++---
share/static/css/base/inline-edit.css | 10 +++
share/static/js/util.js | 16 ++++-
8 files changed, 133 insertions(+), 19 deletions(-)
- Log -----------------------------------------------------------------
commit 0ae1f598c648a1b9fe16a262c330a5e122b675fd
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Tue Sep 20 19:03:25 2016 +0000
Maintain InlineEdit on refresh rather than consulting prefs
The preference may have changed causing inconsistency
diff --git a/share/html/Elements/CollectionAsTable/Row b/share/html/Elements/CollectionAsTable/Row
index 29e6e13..3c1192f 100644
--- a/share/html/Elements/CollectionAsTable/Row
+++ b/share/html/Elements/CollectionAsTable/Row
@@ -55,7 +55,7 @@ $Warning => undef
$ColumnMap => {}
$Class => 'RT__Ticket'
$Classes => ''
-$InlineEdit => RT->Config->Get('InlineEdit', $session{CurrentUser})
+$InlineEdit => 0
</%ARGS>
<%init>
$m->out( '<tbody class="list-item" data-index="'.$m->interp->apply_escapes($i, 'h').'" ' . ( $record->can('id') ? ' data-record-id="'.$record->id.'"' : '' ) . ( $Warning ? ' data-warning=1' : ''). '>' );
diff --git a/share/html/Helpers/CollectionListRow b/share/html/Helpers/CollectionListRow
index b54ddc0..27aa1ae 100644
--- a/share/html/Helpers/CollectionListRow
+++ b/share/html/Helpers/CollectionListRow
@@ -49,6 +49,7 @@
$DisplayFormat => undef
$ObjectClass => undef
$MaxItems => undef
+$InlineEdit => undef
$i => undef
$ObjectId => undef
@@ -66,12 +67,13 @@ $record->Load($ObjectId);
$m->abort unless $record->id;
$m->comp('/Elements/CollectionAsTable/Row',
- i => $i,
- Format => \@Format,
- record => $record,
- maxitems => $MaxItems,
- Class => $record->ColumnMapClassName,
- Warning => $Warning,
+ i => $i,
+ Format => \@Format,
+ record => $record,
+ maxitems => $MaxItems,
+ Class => $record->ColumnMapClassName,
+ Warning => $Warning,
+ InlineEdit => $InlineEdit,
);
$m->abort;
</%INIT>
diff --git a/share/static/js/util.js b/share/static/js/util.js
index b97a35c..e1c79da 100644
--- a/share/static/js/util.js
+++ b/share/static/js/util.js
@@ -528,6 +528,7 @@ function refreshCollectionListRow(tbody, table, success, error) {
DisplayFormat : table.data('display-format'),
ObjectClass : table.data('class'),
MaxItems : table.data('max-items'),
+ InlineEdit : table.hasClass('inline-edit'),
i : tbody.data('index'),
ObjectId : tbody.data('record-id'),
commit 708ecc5cb1bad20aef8db864e402e280a7277aac
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Tue Sep 20 19:06:31 2016 +0000
Require table.inline-edit to enter inline edit
This keeps consistency with the CSS
diff --git a/share/static/js/util.js b/share/static/js/util.js
index e1c79da..fc57a18 100644
--- a/share/static/js/util.js
+++ b/share/static/js/util.js
@@ -730,7 +730,7 @@ jQuery(function () {
e.stopPropagation();
});
- jQuery(document).on('click', 'td.editable', function (e) {
+ jQuery(document).on('click', 'table.inline-edit td.editable', function (e) {
var cell = jQuery(this);
beginInlineEdit(cell);
});
commit b0dd30335d3cae848671fbfbb038b4ecf6b57735
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Tue Sep 20 20:31:08 2016 +0000
Add TwoColumn option to EditLinks for narrow displays
diff --git a/share/html/Elements/EditLinks b/share/html/Elements/EditLinks
index ab7fed7..7f094ca 100644
--- a/share/html/Elements/EditLinks
+++ b/share/html/Elements/EditLinks
@@ -45,9 +45,11 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
+% if ($TwoColumn) {
<table width="100%">
<tr>
<td valign="top" width="50%">
+% }
<h3><&|/l&>Current Links</&></h3>
<table>
@@ -105,13 +107,20 @@
</tr>
</table>
+% if ($TwoColumn) {
</td>
<td valign="top">
+% }
+
<h3><&|/l&>New Links</&></h3>
<& AddLinks, %ARGS &>
+
+% if ($TwoColumn) {
</td>
</tr>
</table>
+% }
<%ARGS>
$Object => undef
+$TwoColumn => 1
</%ARGS>
commit 8b879f1aad119193dc173090961f5957997ce4e6
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Tue Sep 20 20:40:27 2016 +0000
Inline edit for ticket basics
diff --git a/share/html/Ticket/Display.html b/share/html/Ticket/Display.html
index 1e821ae..8b0055c 100644
--- a/share/html/Ticket/Display.html
+++ b/share/html/Ticket/Display.html
@@ -71,7 +71,7 @@ my $titleright = qq{<a href="$url_html" data-show-label="$show_label" data-hide-
<div class="summary unset-fields-container<% $HideUnsetFields ? ' unset-fields-hidden' : '' %>">
<&| /Widgets/TitleBox, title => loc('Ticket metadata'), titleright_raw => $titleright &>
-<& /Ticket/Elements/ShowSummary, Ticket => $TicketObj, Attachments => $attachments &>
+<& /Ticket/Elements/ShowSummary, Ticket => $TicketObj, Attachments => $attachments, InlineEdit => $InlineEdit &>
</&>
</div>
<br />
@@ -116,6 +116,7 @@ $TicketObj => undef
$ShowHeaders => 0
$HideUnsetFields => RT->Config->Get('HideUnsetFieldsOnDisplay', $session{CurrentUser})
$ForceShowHistory => 0
+$InlineEdit => RT->Config->Get('InlineEdit', $session{CurrentUser})
</%ARGS>
<%INIT>
diff --git a/share/html/Ticket/Elements/ShowSummary b/share/html/Ticket/Elements/ShowSummary
index 528f36e..8275de8 100644
--- a/share/html/Ticket/Elements/ShowSummary
+++ b/share/html/Ticket/Elements/ShowSummary
@@ -49,10 +49,28 @@
<tr>
<td valign="top" class="boxcontainer">
% $m->callback( %ARGS, CallbackName => 'LeftColumnTop' );
+
+<%PERL>
+my $modify_url = RT->Config->Get('WebPath')."/Ticket/Modify.html?id=".$Ticket->Id;
+my $modify_inline = '<a class="inline-edit-toggle" data-edit-label="'.$edit_label.'" data-cancel-label="'.$cancel_label.'" href="'.$m->interp->apply_escapes($modify_url, 'h' ).'">'.$edit_label.'</a>';
+</%PERL>
+
<&| /Widgets/TitleBox, title => loc('The Basics'),
- (($can_modify || $can_modify_cf) ? (title_href => RT->Config->Get('WebPath')."/Ticket/Modify.html?id=".$Ticket->Id) : ()),
+ (($can_modify || $can_modify_cf) ? (title_href => $modify_url) : ()),
+ ($InlineEdit ? (titleright_raw => $modify_inline) : ()),
class => 'ticket-info-basics',
- &><& /Ticket/Elements/ShowBasics, Ticket => $Ticket &></&>
+ &>
+ <div <% $InlineEdit ? 'class="inline-edit-display"' : '' |n%>>
+ <& /Ticket/Elements/ShowBasics, Ticket => $Ticket &>
+ </div>
+% if ($InlineEdit) {
+ <form class="inline-edit" action="<%RT->Config->Get('WebPath')%>/Ticket/Display.html" method="post">
+ <input type="hidden" class="hidden" name="id" value="<% $Ticket->id %>" />
+ <& /Ticket/Elements/EditBasics, TicketObj => $Ticket &>
+ <div align="right"><input type="submit" class="button" value="<&|/l&>Save</&>" /></div>
+ </form>
+% }
+ </&>
% $m->callback( %ARGS, CallbackName => 'AfterBasics' );
<& /Elements/ShowCustomFieldCustomGroupings,
Object => $Ticket,
@@ -105,6 +123,7 @@
<%ARGS>
$Ticket => undef
$Attachments => undef
+$InlineEdit => 0
</%ARGS>
<%INIT>
my $can_modify = $Ticket->CurrentUserHasRight('ModifyTicket');
@@ -112,4 +131,7 @@ my $can_modify_cf = $Ticket->CurrentUserHasRight('ModifyCustomField');
my $can_modify_owner = $Ticket->CurrentUserCanSetOwner();
my $can_modify_people = $Ticket->CurrentUserHasRight('Watch')
|| $Ticket->CurrentUserHasRight('WatchAsAdminCc');
+
+my $edit_label = $m->interp->apply_escapes( loc("Edit"), 'h' );
+my $cancel_label = $m->interp->apply_escapes( loc("Cancel"), 'h' );
</%INIT>
diff --git a/share/static/css/base/inline-edit.css b/share/static/css/base/inline-edit.css
index 35fcb6e..26e3a91 100644
--- a/share/static/css/base/inline-edit.css
+++ b/share/static/css/base/inline-edit.css
@@ -76,3 +76,13 @@ td.editable > form.editor > .cancel {
td.editable.loading > form.editor > .cancel {
display: none;
}
+
+.titlebox .inline-edit,
+.titlebox.editing .inline-edit-display {
+ display: none;
+}
+
+.titlebox.editing .inline-edit,
+.titlebox .inline-edit-display {
+ display: block;
+}
diff --git a/share/static/js/util.js b/share/static/js/util.js
index fc57a18..08743f2 100644
--- a/share/static/js/util.js
+++ b/share/static/js/util.js
@@ -782,6 +782,19 @@ jQuery(function () {
});
table.css('table-layout', 'fixed');
});
+
+ jQuery('.inline-edit-toggle').click(function (e) {
+ e.preventDefault();
+ var link = jQuery(this);
+ var container = link.closest('.titlebox');
+ container.toggleClass('editing');
+ if (container.hasClass('editing')) {
+ link.text(link.data('cancel-label'));
+ }
+ else {
+ link.text(link.data('edit-label'));
+ }
+ });
});
// focus jquery object in window, only moving the screen when necessary
commit 723edf172bb4029c3c030cd3a753c85b173cc70f
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Tue Sep 20 20:40:42 2016 +0000
Inline edit for custom field groupings
diff --git a/share/html/Elements/ShowCustomFieldCustomGroupings b/share/html/Elements/ShowCustomFieldCustomGroupings
index 6e20156..ad1df06 100644
--- a/share/html/Elements/ShowCustomFieldCustomGroupings
+++ b/share/html/Elements/ShowCustomFieldCustomGroupings
@@ -47,22 +47,36 @@
%# END BPS TAGGED BLOCK }}}
<%perl>
for my $group ( @Groupings ) {
+ my $modify_url = $title_href ? "$title_href?id=".$Object->id.($group?";Grouping=".$m->interp->apply_escapes($group,'u')."#".CSSClass("$css_class-$group") : "#".$css_class) : undef;
+ my $modify_inline = '<a class="inline-edit-toggle" data-edit-label="'.$edit_label.'" data-cancel-label="'.$cancel_label.'" href="'.$m->interp->apply_escapes(($modify_url||'#'), 'h' ).'">'.$edit_label.'</a>';
+
my %grouping_args = (
title => $group? loc($group) : loc('Custom Fields'),
class => $css_class .' '. ($group? CSSClass("$css_class-$group") : ''),
hide_empty => 1,
- title_href => $title_href ? "$title_href?id=".$Object->id.($group?";Grouping=".$m->interp->apply_escapes($group,'u')."#".CSSClass("$css_class-$group") : "#".$css_class) : undef,
+ title_href => $modify_url,
+ ($InlineEdit ? (titleright_raw => $modify_inline) : ()),
%$TitleBoxARGS,
);
$m->callback( CallbackName => 'TitleBox', Object => $Object, Grouping => $group, ARGSRef => \%grouping_args );
</%perl>
<&| /Widgets/TitleBox, %grouping_args &>
-<& ShowCustomFields, %ARGS, Object => $Object, Grouping => $group &>
+ <div <% $InlineEdit ? 'class="inline-edit-display"' : '' |n%>>
+ <& ShowCustomFields, %ARGS, Object => $Object, Grouping => $group &>
+ </div>
+% if ($InlineEdit) {
+ <form class="inline-edit" action="<%RT->Config->Get('WebPath')%>/Ticket/Display.html" method="post">
+ <input type="hidden" class="hidden" name="id" value="<% $Object->id %>" />
+ <& /Elements/EditCustomFields, Object => $Object, Grouping => $group, InTable => 0 &>
+ <div align="right"><input type="submit" class="button" value="<&|/l&>Save</&>" /></div>
+ </form>
+% }
</&>
% }
<%ARGS>
$Object
$title_href => ""
+$InlineEdit => 0
@Groupings => ()
</%ARGS>
<%INIT>
@@ -74,5 +88,9 @@ $css_class .= '-info-cfs';
my $TitleBoxARGS = delete $ARGS{TitleBoxARGS} || {};
+$InlineEdit = 0 unless $Object->isa('RT::Ticket');
+my $edit_label = $m->interp->apply_escapes( loc("Edit"), 'h' );
+my $cancel_label = $m->interp->apply_escapes( loc("Cancel"), 'h' );
+
@Groupings = (RT::CustomField->CustomGroupings( $Object ), '') unless @Groupings;
</%INIT>
diff --git a/share/html/Ticket/Elements/ShowSummary b/share/html/Ticket/Elements/ShowSummary
index 8275de8..0716c5f 100644
--- a/share/html/Ticket/Elements/ShowSummary
+++ b/share/html/Ticket/Elements/ShowSummary
@@ -75,6 +75,7 @@ my $modify_inline = '<a class="inline-edit-toggle" data-edit-label="'.$edit_labe
<& /Elements/ShowCustomFieldCustomGroupings,
Object => $Ticket,
title_href => ($can_modify || $can_modify_cf) ? RT->Config->Get('WebPath')."/Ticket/Modify.html" : "",
+ InlineEdit => $InlineEdit,
&>
<&| /Widgets/TitleBox, title => loc('People'),
commit 9b83476abadfe11a7b7336195a645e00b5c5b738
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Tue Sep 20 20:40:51 2016 +0000
Inline edit for ticket dates and links
diff --git a/share/html/Ticket/Elements/ShowSummary b/share/html/Ticket/Elements/ShowSummary
index 0716c5f..9c5c7c7 100644
--- a/share/html/Ticket/Elements/ShowSummary
+++ b/share/html/Ticket/Elements/ShowSummary
@@ -103,20 +103,57 @@ my $modify_inline = '<a class="inline-edit-toggle" data-edit-label="'.$edit_labe
</&>
% }
% $m->callback( %ARGS, CallbackName => 'AfterReminders' );
+
+<%PERL>
+my $dates_url = RT->Config->Get('WebPath')."/Ticket/ModifyDates.html?id=".$Ticket->Id;
+my $dates_inline = '<a class="inline-edit-toggle" data-edit-label="'.$edit_label.'" data-cancel-label="'.$cancel_label.'" href="'.$m->interp->apply_escapes($dates_url, 'h' ).'">'.$edit_label.'</a>';
+</%PERL>
<&| /Widgets/TitleBox, title => loc("Dates"),
- ($can_modify ? (title_href => RT->Config->Get('WebPath')."/Ticket/ModifyDates.html?id=".$Ticket->Id) : ()),
+ ($can_modify ? (title_href => $dates_url) : ()),
class => 'ticket-info-dates',
- &><& /Ticket/Elements/ShowDates, Ticket => $Ticket &></&>
+ ($InlineEdit ? (titleright_raw => $dates_inline) : ()),
+ &>
+ <div <% $InlineEdit ? 'class="inline-edit-display"' : '' |n%>>
+ <& /Ticket/Elements/ShowDates, Ticket => $Ticket &>
+ </div>
+% if ($InlineEdit) {
+ <form class="inline-edit" action="<%RT->Config->Get('WebPath')%>/Ticket/Display.html" method="post">
+ <input type="hidden" class="hidden" name="id" value="<% $Ticket->id %>" />
+ <& /Ticket/Elements/EditDates, TicketObj => $Ticket &>
+ <div align="right"><input type="submit" class="button" value="<&|/l&>Save</&>" /></div>
+ </form>
+% }
+</&>
% $m->callback( %ARGS, CallbackName => 'AfterDates' );
-% my (@extra);
-% push @extra, titleright_raw => '<a href="'. RT->Config->Get('WebPath'). '/Ticket/Graphs/index.html?id='.$Ticket->id.'">'.loc('Graph').'</a>' unless RT->Config->Get('DisableGraphViz');
<& /Ticket/Elements/ShowAssets, Ticket => $Ticket &>
+<%PERL>
+my $links_url = RT->Config->Get('WebPath')."/Ticket/ModifyLinks.html?id=".$Ticket->Id;
+my $links_inline = '<a class="inline-edit-toggle" data-edit-label="'.$edit_label.'" data-cancel-label="'.$cancel_label.'" href="'.$m->interp->apply_escapes($links_url, 'h' ).'">'.$edit_label.'</a>';
+my $links_graph = '<a href="'. RT->Config->Get('WebPath'). '/Ticket/Graphs/index.html?id='.$Ticket->id.'">'.loc('Graph').'</a>';
+
+my $links_titleright = join ' ',
+ ($InlineEdit ? $links_inline : ()),
+ (RT->Config->Get('DisableGraphViz') ? () : $links_graph);
+my @extra;
+push @extra, (titleright_raw => $links_titleright) if $links_titleright;
+</%PERL>
% $m->callback( %ARGS, CallbackName => 'LinksExtra', extra => \@extra );
<&| /Widgets/TitleBox, title => loc('Links'),
- ($can_modify ? (title_href => RT->Config->Get('WebPath')."/Ticket/ModifyLinks.html?id=".$Ticket->Id) : ()),
+ ($can_modify ? (title_href => $links_url) : ()),
class => 'ticket-info-links',
@extra,
- &><& /Elements/ShowLinks, Object => $Ticket &></&>
+ &>
+ <div <% $InlineEdit ? 'class="inline-edit-display"' : '' |n%>>
+ <& /Elements/ShowLinks, Object => $Ticket &>
+ </div>
+% if ($InlineEdit) {
+ <form class="inline-edit" action="<%RT->Config->Get('WebPath')%>/Ticket/Display.html" method="post">
+ <input type="hidden" class="hidden" name="id" value="<% $Ticket->id %>" />
+ <& /Elements/EditLinks, Object => $Ticket, TwoColumn => 0 &>
+ <div align="right"><input type="submit" class="button" value="<&|/l&>Save</&>" /></div>
+ </form>
+% }
+</&>
% $m->callback( %ARGS, CallbackName => 'RightColumn' );
</td>
</tr>
-----------------------------------------------------------------------
More information about the rt-commit
mailing list