[Rt-commit] rt branch, 5.0/fix-anonymize-user-modal, created. rt-5.0.0beta1-4-gbf806f4958
Craig Kaiser
craig at bestpractical.com
Wed Jul 1 15:39:56 EDT 2020
The branch, 5.0/fix-anonymize-user-modal has been created
at bf806f4958ca97ebaf8504fd53ed5b45b64eacda (commit)
- Log -----------------------------------------------------------------
commit b209df7f9ea2a29461fe250bbeb4d5a874c4a569
Author: craig kaiser <craig at bestpractical.com>
Date: Tue Jun 2 09:43:22 2020 -0400
Remove modal mason component
This is no longer needed as we have the Bootstrap modal.
diff --git a/share/html/Elements/Modal b/share/html/Elements/Modal
deleted file mode 100644
index f749305d11..0000000000
--- a/share/html/Elements/Modal
+++ /dev/null
@@ -1,71 +0,0 @@
-%# BEGIN BPS TAGGED BLOCK {{{
-%#
-%# COPYRIGHT:
-%#
-%# This software is Copyright (c) 1996-2020 Best Practical Solutions, LLC
-%# <sales at bestpractical.com>
-%#
-%# (Except where explicitly superseded by other copyright notices)
-%#
-%#
-%# LICENSE:
-%#
-%# This work is made available to you under the terms of Version 2 of
-%# the GNU General Public License. A copy of that license should have
-%# been provided with this software, but in any event can be snarfed
-%# from www.gnu.org.
-%#
-%# This work is distributed in the hope that it will be useful, but
-%# WITHOUT ANY WARRANTY; without even the implied warranty of
-%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-%# General Public License for more details.
-%#
-%# You should have received a copy of the GNU General Public License
-%# along with this program; if not, write to the Free Software
-%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-%# 02110-1301 or visit their web page on the internet at
-%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
-%#
-%#
-%# CONTRIBUTION SUBMISSION POLICY:
-%#
-%# (The following paragraph is not intended to limit the rights granted
-%# to you to modify and distribute this software under the terms of
-%# the GNU General Public License and is only of importance to you if
-%# you choose to contribute your changes and enhancements to the
-%# community by submitting them to Best Practical Solutions, LLC.)
-%#
-%# By intentionally submitting any modifications, corrections or
-%# derivatives to this work, or any other work intended for use with
-%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-%# you are the copyright holder for those contributions and you grant
-%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
-%# royalty-free, perpetual, license to use, copy, create derivative
-%# works based on those contributions, and sublicense and distribute
-%# those contributions and any derivatives thereof.
-%#
-%# END BPS TAGGED BLOCK }}}
-<div id="<% $ModalId %>" class="<% $Class %>" align="center">
- <form action="<% $Action %>" method="<% $Method %>" id="<% $ModalId %>" name="<% $Name %>" >
-% foreach my $field (@Fields) {
- <p><% $field->{'Label'} %>
-% if ( $field->{'Input'} ) {
- <input type="<% $field->{'Input'} %>" class="<% $field->{'Class'} %>" name="<% $field->{'Name'} %>" value="<% $field->{'Value'} %>">
-% }
- </p>
-% }
- <a href="#" rel="modal:close" class="button"><% $Cancel %></a>
- <button type="Submit" class="button"><% $Accept %></button>
- </form>
-</div>
-
-<%ARGS>
- at Fields => ()
-$Name => ''
-$ModalId => ''
-$Class => 'modal'
-$Action => ''
-$Method => 'GET'
-$Accept => loc('OK')
-$Cancel => loc('Cancel')
-</%ARGS>
commit 9fe3ae1633ef851f27ee1d39465b40017e46d18d
Author: craig kaiser <craig at bestpractical.com>
Date: Wed Jul 1 15:36:55 2020 -0400
Use Bootstrap4 modal for Anonymize User button
diff --git a/share/html/Admin/Users/Modify.html b/share/html/Admin/Users/Modify.html
index 5d690c71a4..9afdd38f67 100644
--- a/share/html/Admin/Users/Modify.html
+++ b/share/html/Admin/Users/Modify.html
@@ -321,19 +321,37 @@
</form>
% if ( $UserObj->Id ) {
- <& /Elements/Modal, ModalId => "user-info-modal", Method => 'POST', Action => RT->Config->Get('WebPath') . '/Admin/Users/Modify.html', Fields => [
- { Label => loc("Are you sure you want to anonymize user: [_1]?", $UserObj->Name) },
- { Input => 'Hidden', Value => $UserObj->Id, Name => 'id' },
- { Input => 'Hidden', Value => 1, Name => 'Anonymize' },
- {
- Label => loc("Check to clear user custom fields") . ":",
- Input => 'checkbox',
- Class => 'checkbox',
- Name => 'clear_customfields',
- Value => 'On',
- },
-]
-&>
+<div id="user-info-modal" class="modal">
+ <div class="modal-dialog modal-dialog-centered">
+ <div class="modal-content p-2">
+ <div class="modal-header">
+ <h5 class="modal-title"><&|/l&>Anonymize User</&></h5>
+ <a class="close" data-dismiss="modal" aria-label="Close">
+ <span aria-hidden="true">×</span>
+ </a>
+ </div>
+ <div class="modal-body">
+ <form action="<% RT->Config->Get('WebPath') %>/Admin/Users/Modify.html" method="POST">
+ <input type="hidden" name="id" value="<% $UserObj->Id %>" />
+ <input type="hidden" name="Anonymize" value="1" />
+
+ <div class="form-row">
+ <div class="custom-control custom-checkbox">
+ <input class="custom-control-input" type="checkbox" id="clear_customfields" name="clear_customfields" />
+ <label class="custom-control-label" for="clear_customfields"><&|/l&>Check to clear user custom fields</&></label>
+ </div>
+ </div>
+ </div>
+
+ <div class="form-row justify-content-end">
+ <div class="col-auto">
+ <button type="Submit" class="button"><&|/l&>Anonymize</&></button>
+ </div>
+ </form>
+ </div>
+ </div>
+ </div>
+</div>
% }
<%INIT>
diff --git a/share/html/User/Elements/RelatedData b/share/html/User/Elements/RelatedData
index 20b47f54e1..61f935549f 100644
--- a/share/html/User/Elements/RelatedData
+++ b/share/html/User/Elements/RelatedData
@@ -69,9 +69,9 @@
% if ( $session{'CurrentUser'}->HasRight( Object => RT->System, Right => 'AdminUsers' ) ) {
<div class="title"><&|/l&>Remove User Information</&></div>
- <div class="inline-row form-row">
- <div class="inline-cell col-4">
- <a class="button btn btn-primary" href="#user-info-modal" rel="modal:open" name="anonymize_user"><&|/l&>Anonymize User</&></a>
+ <div class="form-row">
+ <div class="col-4">
+ <a href="javascript:void(0)" class="button btn btn-primary" data-toggle="modal" data-target="#user-info-modal" name="anonymize_user"><&|/l&>Anonymize User</&></a>
<i class="label"><&|/l&>Clear core user data, set anonymous username</&></i>
</div>
% if ( $session{'CurrentUser'}->HasRight( Object => RT->System, Right => 'SuperUser' ) ) {
commit 57bebc058ebed624bcce038a98f6db8308e14279
Author: craig kaiser <craig at bestpractical.com>
Date: Wed Jul 1 15:38:56 2020 -0400
Remove inline Bootstrap styling from RelatedData component
diff --git a/share/html/User/Elements/RelatedData b/share/html/User/Elements/RelatedData
index 61f935549f..d1ba88c191 100644
--- a/share/html/User/Elements/RelatedData
+++ b/share/html/User/Elements/RelatedData
@@ -52,16 +52,16 @@
<div id="manage-user-data">
<div class="title"><&|/l&>Download User Information</&></div>
- <div class="download-user-data-buttons inline-row form-row">
- <div class="inline-cell col-4">
+ <div class="download-user-data-buttons form-row">
+ <div class="col-4">
<a class="button btn btn-primary" href="/User/RelatedData.tsv?Type=User&id=<% $UserObj->id %>"><% $UserDataButton %></a>
<i class="label"><&|/l&>Core user data</&></i>
</div>
- <div class="inline-cell col-4">
+ <div class="col-4">
<a class="button btn btn-primary" href="/Search/Results.tsv?UserData=1&Query=Requestor.id=<% $UserObj->id %>&Format=<% $Format | un %>"><% $UserTicketsButton %></a>
<i class="label"><&|/l&>Tickets with this user as a requestor</&></i>
</div>
- <div class="inline-cell col-4">
+ <div class="col-4">
<a class="button btn btn-primary" href="/User/RelatedData.tsv?Type=Transaction&id=<% $UserObj->id %>"><% $UserTxnButton %></a>
<i class="label"><&|/l&>Ticket transactions this user created</&></i>
</div>
@@ -75,11 +75,11 @@
<i class="label"><&|/l&>Clear core user data, set anonymous username</&></i>
</div>
% if ( $session{'CurrentUser'}->HasRight( Object => RT->System, Right => 'SuperUser' ) ) {
- <div class="inline-cell col-4">
+ <div class="col-4">
<a class="button btn btn-primary" href="<%RT->Config->Get('WebPath')%>/Admin/Tools/Shredder/index.html?Plugin=Users&Users%3Astatus=<% $UserObj->Disabled ? 'disabled' : 'enabled' %>&Users%3Aname=<% $UserObj->Name %>&Users%3Areplace_relations=Nobody&Search=Search" name="replace-user"><&|/l&>Replace User</&></a>
<i class="label"><&|/l&>Replace this user's activity records with "Nobody" user</&></i>
</div>
- <div class="inline-cell col-4">
+ <div class="col-4">
<a class="button btn btn-primary" href="<%RT->Config->Get('WebPath')%>/Admin/Tools/Shredder/index.html?Plugin=Users&Users%3Astatus=<% $UserObj->Disabled ? 'disabled' : 'enabled' %>&Users%3Aname=<% $UserObj->Name %>&Users&Search=Search" name="replace-user"><&|/l&>Delete User</&></a>
<i class="label"><&|/l&>Delete this user, tickets associated with this user must be shredded first</&></i>
</div>
commit bf806f4958ca97ebaf8504fd53ed5b45b64eacda
Author: craig kaiser <craig at bestpractical.com>
Date: Tue Jun 2 12:05:39 2020 -0400
Update Anonymize user tests for Bootstrap modal
diff --git a/t/web/remove_user_info.t b/t/web/remove_user_info.t
index 4003f32d99..69eeb15faf 100644
--- a/t/web/remove_user_info.t
+++ b/t/web/remove_user_info.t
@@ -32,10 +32,9 @@ $agent->login( 'root' => 'password' );
my $user_id = $user->id;
- $agent->get_ok( $url . "Admin/Users/Modify.html?id=" . $user_id );
- $agent->follow_link_ok( { text => 'Anonymize User' } );
-
- $agent->submit_form_ok( { form_id => 'user-info-modal', }, "Anonymize user" );
+ $agent->post( $url . "Admin/Users/Modify.html?id=" . $user_id, [
+ Anonymize => 1
+ ]);
# UserId is still the same, but all other records should be anonimyzed for TestUser
my ( $ret, $msg ) = $user->Load($user_id);
@@ -74,15 +73,10 @@ $agent->login( 'root' => 'password' );
is( $user->FirstCustomFieldValue('TestCustomfield'), 'Testing', 'Customfield exists and has value for user.' );
- $agent->get_ok( $url . "Admin/Users/Modify.html?id=" . $user->id );
- $agent->follow_link_ok( { text => 'Anonymize User' } );
-
- $agent->submit_form_ok(
- { form_id => 'user-info-modal',
- fields => { clear_customfields => 'On' },
- },
- "Anonymize user and customfields"
- );
+ $agent->post( $url . "Admin/Users/Modify.html?id=" . $user->id, [
+ clear_customfields => 'On',
+ Anonymize => 1
+ ]);
is( $user->FirstCustomFieldValue('TestCustomfield'), undef, 'Customfield value cleared' );
}
-----------------------------------------------------------------------
More information about the rt-commit
mailing list