[Rt-commit] rt branch, 4.6/inline-edit, updated. rt-4.4.1-129-gff2dfc5
Shawn Moore
shawn at bestpractical.com
Mon Sep 12 15:24:30 EDT 2016
The branch, 4.6/inline-edit has been updated
via ff2dfc5ceed6783e8fe9bced3949dd6b1099f72b (commit)
via 864ed7cb309a3eb5d96abb3e8e91a7598be642d9 (commit)
via 33edb40664967414c42dc3dc96b4126ec4680cc2 (commit)
from cd25facc30b67c7290d215676237915f6b813748 (commit)
Summary of changes:
share/html/Elements/ColumnMap | 55 ++++++++++++++++++++++++++++---------------
1 file changed, 36 insertions(+), 19 deletions(-)
- Log -----------------------------------------------------------------
commit 33edb40664967414c42dc3dc96b4126ec4680cc2
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Mon Sep 12 19:20:26 2016 +0000
Factor out caching for Custom Roles with a load helper
Custom Fields have this too
diff --git a/share/html/Elements/ColumnMap b/share/html/Elements/ColumnMap
index ff29019..c50c64b 100644
--- a/share/html/Elements/ColumnMap
+++ b/share/html/Elements/ColumnMap
@@ -152,31 +152,30 @@ $WCOLUMN_MAP = $COLUMN_MAP = {
attribute => sub { return shift @_ },
title => sub { return pop @_ },
value => sub {
- my $object = shift;
+ my $self = $WCOLUMN_MAP->{CustomRole};
+ my $role = $self->{load}->(@_);
+ return unless $role->Id;
+ return \($m->scomp("/Elements/ShowPrincipal", Object => $_[0]->RoleGroup($role->GroupType) ) );
+ },
+ load => sub {
my $role_name = pop;
- my $role_type = do {
- # Cache the role object on a per-request basis, to avoid
- # having to load it for every row
- my $key = "RT::CustomRole-" . $role_name;
+ # Cache the role object on a per-request basis, to avoid
+ # having to load it for every row
+ my $key = "RT::CustomRole-" . $role_name;
- my $role_type = $m->notes($key);
- if (!$role_type) {
- my $role_obj = RT::CustomRole->new($object->CurrentUser);
- $role_obj->Load($role_name);
+ my $role_obj = $m->notes($key);
+ if (!$role_obj) {
+ $role_obj = RT::CustomRole->new($_[0]->CurrentUser);
+ $role_obj->Load($role_name);
- RT->Logger->notice("Unable to load custom role $role_name")
- unless $role_obj->Id;
+ RT->Logger->notice("Unable to load custom role $role_name")
+ unless $role_obj->Id;
- $role_type = $role_obj->GroupType;
- $m->notes($key, $role_type);
- }
-
- $role_type;
- };
+ $m->notes($key, $role_obj);
+ }
- return if !$role_type;
- return \($m->scomp("/Elements/ShowPrincipal", Object => $object->RoleGroup($role_type) ) );
+ return $role_obj;
},
},
commit 864ed7cb309a3eb5d96abb3e8e91a7598be642d9
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Mon Sep 12 19:21:19 2016 +0000
Inline edit for single-member custom roles
diff --git a/share/html/Elements/ColumnMap b/share/html/Elements/ColumnMap
index c50c64b..4b272cc 100644
--- a/share/html/Elements/ColumnMap
+++ b/share/html/Elements/ColumnMap
@@ -177,6 +177,17 @@ $WCOLUMN_MAP = $COLUMN_MAP = {
return $role_obj;
},
+ edit => sub {
+ my $self = $WCOLUMN_MAP->{CustomRole};
+ my $role = $self->{load}->(@_);
+ return unless $role->Id;
+ if ($role->SingleValue) {
+ return \($m->scomp("/Elements/SingleUserRoleInput", role => $role, Ticket => $_[0]));
+ }
+ else {
+ return undef;
+ }
+ },
},
CheckBox => {
commit ff2dfc5ceed6783e8fe9bced3949dd6b1099f72b
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Mon Sep 12 19:23:43 2016 +0000
Inline edit for generic owner role
This has slightly different behavior from RT__Ticket's OwnerName,
but both are available for inclusion in search results, so both must
be handled.
diff --git a/share/html/Elements/ColumnMap b/share/html/Elements/ColumnMap
index 4b272cc..f9a3cbb 100644
--- a/share/html/Elements/ColumnMap
+++ b/share/html/Elements/ColumnMap
@@ -275,6 +275,13 @@ if ($RecordClass->DOES("RT::Record::Role::Roles")) {
attribute => $attrs->{Column} || "$role.EmailAddress",
value => sub { return \($m->scomp("/Elements/ShowPrincipal", Object => $_[0]->RoleGroup($role) ) ) },
};
+
+ if ($role eq 'Owner') {
+ $ROLE_MAP->{$RecordClass}{$role}{edit} = sub {
+ return \($m->scomp('/Elements/SelectOwner', TicketObj => $_[0], Name => 'Owner', Default => $_[0]->OwnerObj->Id, DefaultValue => 0));
+ };
+ }
+
$ROLE_MAP->{$RecordClass}{$role . "s"} = $ROLE_MAP->{$RecordClass}{$role}
unless $attrs->{Single};
}
-----------------------------------------------------------------------
More information about the rt-commit
mailing list