[Rt-commit] rt branch, combine-select-create, created. rt-3.9.6-241-gde41237

Thomas Sibley trs at bestpractical.com
Tue Nov 30 18:30:15 EST 2010


The branch, combine-select-create has been created
        at  de412378361c242359ac929f2ccd722807af4da9 (commit)

- Log -----------------------------------------------------------------
commit de412378361c242359ac929f2ccd722807af4da9
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Tue Nov 30 18:21:27 2010 -0500

    Add a create form to the admin groups page
    
    This refactors the group modify page to split the form out into a
    reusable component EditGroup.  Modify.html still does all the work and
    the form is submitted there.  Now we don't need the annoying
    Select/Create submenus in the admin menu.
    
    The layout on the admin groups page needs some love, but the
    functionality is present.

diff --git a/share/html/Admin/Elements/EditGroup b/share/html/Admin/Elements/EditGroup
new file mode 100644
index 0000000..3374377
--- /dev/null
+++ b/share/html/Admin/Elements/EditGroup
@@ -0,0 +1,48 @@
+<%args>
+$Group
+</%args>
+<%init>
+my $Create = $Group->Id ? 0 : 1;
+</%init>
+<form action="<%RT->Config->Get('WebPath')%>/Admin/Groups/Modify.html" method="post" enctype="multipart/form-data" id="editgroup">
+
+% if ($Create) {
+<input type="hidden" class="hidden" name="id" value="new" />
+% } else {
+<input type="hidden" class="hidden" name="id" value="<%$Group->Id%>" />
+% }
+<table>
+<tr><td align="right">
+<&|/l&>Name</&>:
+</td>
+<td><input name="Name" value="<%$Group->Name||''%>" /></td>
+</tr>
+<tr>
+<td align="right">
+<&|/l&>Description</&>:</td><td colspan="3"><input name="Description" value="<%$Group->Description||''%>" size="60" /></td>
+</tr>
+% my $CFs = $Group->CustomFields;
+% while (my $CF = $CFs->Next) {
+<tr valign="top"><td align="right">
+<% loc($CF->Name) %>:
+</td><td>
+<& /Elements/EditCustomField, CustomField => $CF, 
+                              Object => $Group, 
+                              ($Create ? (NamePrefix => 'Object-RT::Group--CustomField-') 
+                                       : () )&>
+</td></tr>
+% }
+<tr>
+<td colspan="2">
+<input type="hidden" class="hidden" name="SetEnabled" value="1" />
+<input type="checkbox" class="checkbox" name="Enabled" value="1" <% $Group->Disabled ? '' : 'checked' %> /> <&|/l&>Enabled (Unchecking this box disables this group)</&><br />
+</td>
+</tr>
+% $m->callback( %ARGS, GroupObj => $Group );
+</table>
+% if ($Create) {
+<& /Elements/Submit, Label => loc('Create'), Reset => 1 &>
+% } else {
+<& /Elements/Submit, Label => loc('Save Changes'), Reset => 1 &>
+% }
+</form>
diff --git a/share/html/Admin/Groups/Modify.html b/share/html/Admin/Groups/Modify.html
index 2d16cd5..185c81a 100755
--- a/share/html/Admin/Groups/Modify.html
+++ b/share/html/Admin/Groups/Modify.html
@@ -51,52 +51,12 @@
 <& /Elements/ListActions, actions => \@results &>
 
 
-
-<form action="<%RT->Config->Get('WebPath')%>/Admin/Groups/Modify.html" method="post" enctype="multipart/form-data">
-
-%unless ($Group->Id) {
-<input type="hidden" class="hidden" name="id" value="new" />
-% } else {
-<input type="hidden" class="hidden" name="id" value="<%$Group->Id%>" />
-% }
-<table>
-<tr><td align="right">
-<&|/l&>Name</&>:
-</td>
-<td><input name="Name" value="<%$Group->Name||''%>" /></td>
-</tr>
-<tr>
-<td align="right">
-<&|/l&>Description</&>:</td><td colspan="3"><input name="Description" value="<%$Group->Description||''%>" size="60" /></td>
-</tr>
-% my $CFs = $Group->CustomFields;
-% while (my $CF = $CFs->Next) {
-<tr valign="top"><td align="right">
-<% loc($CF->Name) %>:
-</td><td>
-<& /Elements/EditCustomField, CustomField => $CF, 
-                              Object => $Group, 
-                              ($Create ? (NamePrefix => 'Object-RT::Group--CustomField-') 
-                                       : () )&>
-</td></tr>
-% }
-<tr>
-<td colspan="2">
-<input type="hidden" class="hidden" name="SetEnabled" value="1" />
-<input type="checkbox" class="checkbox" name="Enabled" value="1" <%$EnabledChecked%> /> <&|/l&>Enabled (Unchecking this box disables this group)</&><br />
-</td>
-</tr>
+<& /Admin/Elements/EditGroup, Group => $Group &>
 % $m->callback( %ARGS, GroupObj => $Group, results => \@results );
-</table>
-% if ( $Create ) {
-<& /Elements/Submit, Label => loc('Create'), Reset => 1 &>
-% } else {
-<& /Elements/Submit, Label => loc('Save Changes'), Reset => 1 &>
-% }
-</form>
+
 <%INIT>
 
-my  ($title, @results, @warnings, $Disabled, $EnabledChecked);
+my  ($title, @results, @warnings, $Disabled);
 
 my $Group = RT::Group->new($session{'CurrentUser'});
 
@@ -163,12 +123,6 @@ $m->comp(
 );
 
 push @results, @warnings;
-
-unless ($Group->Disabled()) {
-    $EnabledChecked ='checked="checked"';
-}
-
-
 </%INIT>
 
 
diff --git a/share/html/Admin/Groups/index.html b/share/html/Admin/Groups/index.html
index 34d8f98..6713266 100755
--- a/share/html/Admin/Groups/index.html
+++ b/share/html/Admin/Groups/index.html
@@ -47,7 +47,11 @@
 %# END BPS TAGGED BLOCK }}}
 <& /Admin/Elements/Header, Title => $title &>
 <& /Elements/Tabs &>
-<% $caption %>:<br />
+
+<h3><&|/l&>Create a new group</&></h3>
+<& /Admin/Elements/EditGroup, Group => RT::Group->new($session{'CurrentUser'}) &>
+
+<h3><% $caption %></h3>
 
 % unless ( $Groups->Count ) {
 <em><&|/l&>No groups matching search criteria found.</&></em>
@@ -83,7 +87,7 @@
 <%INIT>
 my $Groups = RT::Groups->new($session{'CurrentUser'});
 $Groups->LimitToUserDefinedGroups();
-my $title = loc('Select a group');
+my $title = loc('Groups');
 my $caption;
 
 if ($FindDisabledGroups) {
diff --git a/share/html/Elements/Tabs b/share/html/Elements/Tabs
index 47cf083..17ac316 100755
--- a/share/html/Elements/Tabs
+++ b/share/html/Elements/Tabs
@@ -119,9 +119,6 @@ if ( $request_path !~ qr{^/SelfService/} ) {
         }
         my $groups = $admin->child( loc('Groups'), path => '/Admin/Groups/', );
 
-        $groups->child( select => title => loc('Select'), path => "/Admin/Groups/" );
-        $groups->child( create => title => loc('Create'), path => "/Admin/Groups/Modify.html?Create=1" );
-
         my $queues = $admin->child( queues => title => loc('Queues'), path => '/Admin/Queues/', );
         $queues->child( select => title => loc('Select'), path => "/Admin/Queues/" );
         $queues->child( create => title => loc('Create'), path => "/Admin/Queues/Modify.html?Create=1" );

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


More information about the Rt-commit mailing list