[Rt-commit] rt branch, 4.4/enhance-roles-input-fields, repushed
Maureen Mirville
maureen at bestpractical.com
Mon Feb 11 16:23:39 EST 2019
The branch 4.4/enhance-roles-input-fields was deleted and repushed:
was 3b4d8059b033288aa498ae97db07549ed8770613
now dd14e1140feccb8d21768a684e83814f869e8b7a
1: e81709086 = 1: e81709086 Add the Selectize JS library source code to RT
2: 066876684 ! 2: dc3a89a40 Add a new config to format user input on ticket create/update/forward pages
@@ -1,6 +1,6 @@
Author: Maureen E. Mirville <maureen at bestpractical.com>
- Add a new config to format user input fields on ticket create/update pages
+ Add a new config to format user input on ticket create/update/forward pages
diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
--- a/etc/RT_Config.pm.in
3: 4998089e4 = 3: 9d71bcd65 Add jQuery UI Sortable library source code to RT
4: 3b4d8059b ! 4: 10d58c9ff Improve style of user input fields using Selectize.js library
@@ -1,6 +1,11 @@
Author: Maureen E. Mirville <maureen at bestpractical.com>
Improve style of user input fields using Selectize.js library
+
+ This library adds a bubble around each selected user in all of the
+ roles fields on ticket create, update, and forward pages. Additionally,
+ it enables 'drag and drop' to reorder users within a field, and adds
+ an 'x' to remove a user.
diff --git a/share/html/Elements/FormatRolesInputFields b/share/html/Elements/FormatRolesInputFields
new file mode 100644
@@ -60,20 +65,19 @@
+
+<script>
+
-+jQuery(document).ready( function() {
++jQuery(document).ready(function() {
+ jQuery('<% $fields %>').selectize({
+ plugins: ['remove_button', 'restore_on_backspace', 'drag_drop'],
+ valueField: 'value',
-+ labelField: 'label',
++ labelField: 'value',
+ searchField: 'value',
+ value: '',
+ label: '',
+ id: '',
+ create: true,
-+ maxOptions: 10, // MAKE THIS CONFIGURABLE
+ closeAfterSelect: true,
+ render: {
-+ option: function( data, escape ) {
++ option: function(data, escape) {
+ return '<div>' + escape(data.value) + '</div>';
+ },
+ },
@@ -89,28 +93,38 @@
+ term: input,
+ return: '<% $user_format %>'
+ },
-+ error: function( err ) {
-+ console.log( err );
++ error: function() {
+ callback();
+ },
+ success: function(res) {
-+ callback( res );
++ callback(res);
+ }
+ });
+ }
+ });
-+
+});
+
+</script>
+
+<%INIT>
-+my @roles = $QueueObj->Roles;
-+# Add the 'Requestors' to roles as this field comes in without an 's'
-+push @roles, 'Requestors';
++my $path = $m->request_path;
++
++# Get roles from current ticket page
++my @roles;
++if ( $path =~ /Create/ ) {
++ @roles = $QueueObj->Roles;
++ push @roles, 'Requestors';
++
++ # Remove Owner from @roles as this field is a dropdown
++ # and the selectize library should not be applied
++ my $owner = loc( 'Owner' );
++ @roles = grep {!/$owner/} @roles;
++}
++ at roles = qw( UpdateCc UpdateBcc ) if ( $path =~ /Update/ );
++ at roles = qw( To Cc Bcc ) if ( $path =~ /Forward/ );
+
+# Prepend '#' for each role to create the selector name
-+my $fields = join(",", map { '#' . $_ } @roles);
++my $fields = join( ",", map { '#' . $_ } @roles );
+
+# Escape the :: for jquery from custom roles
+$fields =~ s/\:/\\\\\:/g;
@@ -120,6 +134,7 @@
+
+<%ARGS>
+$QueueObj
++$ARGSRef
+</%ARGS>
diff --git a/share/html/Ticket/Create.html b/share/html/Ticket/Create.html
@@ -129,7 +144,7 @@
</div>
-+<& /Elements/FormatRolesInputFields, %ARGS, QueueObj => $QueueObj, &>
++<& /Elements/FormatRolesInputFields, ARGSRef => \%ARGS, QueueObj => $QueueObj, &>
<div id="ticket-create-message">
<&| /Widgets/TitleBox, title => $title, class => 'messagedetails' &>
+<div class="roles-input">
@@ -144,3 +159,29 @@
</&>
<& /Elements/Submit, Label => loc("Create"), id => 'SubmitTicket' &>
</div>
+
+diff --git a/share/html/Ticket/Forward.html b/share/html/Ticket/Forward.html
+--- a/share/html/Ticket/Forward.html
++++ b/share/html/Ticket/Forward.html
+@@
+ <tr><td align="right"><&|/l&>Subject</&>:</td>
+ <td><input name="Subject" size="60" value="<% $ARGS{'Subject'} || $subject %>" /></td></tr>
+
++<& /Elements/FormatRolesInputFields, ARGSRef => \%ARGS, QueueObj => $TicketObj->QueueObj, &>
++
+ <tr><td align="right"><&|/l&>To</&>:</td>
+ <td><& /Elements/EmailInput, Name => "To", AutocompleteMultiple => 1, Default => $ARGS{'To'} &></td></tr>
+
+
+diff --git a/share/html/Ticket/Update.html b/share/html/Ticket/Update.html
+--- a/share/html/Ticket/Update.html
++++ b/share/html/Ticket/Update.html
+@@
+
+ <&|/Widgets/TitleBox, title => loc('Message'), class => 'messagedetails' &>
+ <table width="100%" border="0">
++<& /Elements/FormatRolesInputFields, ARGSRef => \%ARGS, QueueObj => $TicketObj->QueueObj, &>
+ <& /Ticket/Elements/UpdateCc, %ARGS, TicketObj => $TicketObj &>
+
+ % if ( $gnupg_widget ) {
+
-: ------- > 5: dd14e1140 Add CSS to Theme.html for stylized user input field bubbles
More information about the rt-commit
mailing list