[Rt-commit] rt branch, 4.2/user-info-formatting, created. rt-4.1.6-299-g3e05ce3
Thomas Sibley
trs at bestpractical.com
Fri Mar 1 19:24:32 EST 2013
The branch, 4.2/user-info-formatting has been created
at 3e05ce3577a60c06652aaeb2a54e606bf15bb80d (commit)
- Log -----------------------------------------------------------------
commit 0647553528cd06b9c4f6b2b09cef3eb6bd3244da
Author: Thomas Sibley <trs at bestpractical.com>
Date: Fri Mar 1 15:51:21 2013 -0800
Revert "Switch from divs/spans to tables"
This reverts commit cb3b5a57b1e887fa28e648a8d35b7a0c9b06c86f.
Tables are annoying and hard to style well with CSS. We lose
flexibility going forward. The underlying reason for the poor
formatting noted in the reverted commit message is because the class
name was mistakenly changed in the refactor and the relevant CSS no
longer applied. The class name will be fixed in the following commit,
and all shall be well.
diff --git a/share/html/User/Elements/UserInfo b/share/html/User/Elements/UserInfo
index b5bd68b..c1322b8 100644
--- a/share/html/User/Elements/UserInfo
+++ b/share/html/User/Elements/UserInfo
@@ -45,7 +45,7 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
-<table class="<% $ClassPrefix %>-extra">
+<div class="<% $ClassPrefix %>-extra">
% for my $column (@formats) {
% my $title = $column->{title} || '';
% my $attr = $column->{'attribute'} || $column->{'last_attribute'};
@@ -53,8 +53,8 @@
% $title = $fetch_columnmap->($attr,'title',[$attr]);
% }
% $title = $m->comp('/Elements/ScrubHTML', Content => $title);
-<tr class="<% $ClassPrefix %> extra-field <% $fetch_columnmap->($attr,'attribute',[$attr]) %>" >
-<td class="label"><% loc($title) %></td>
+<div class="<% $ClassPrefix %> extra-field <% $fetch_columnmap->($attr,'attribute',[$attr]) %>" >
+<span class="label"><% loc($title) %></span>
% my @out;
% foreach my $subcol ( @{ $column->{output} } ) {
% my ($col) = ($subcol =~ /^__(.*?)__$/);
@@ -65,10 +65,10 @@
% push @out, $fetch_columnmap->($col, 'value', [$User]);
% }
% @out = grep { defined $_ and length $_ } @out;
-<td class="value"><% join(' ', at out) %></td>
-</tr>
+<span class="value"><% join(' ', at out) %></span>
+</div>
% }
-</table>
+</div>
<%INIT>
return unless $FormatConfig;
my $format = RT->Config->Get($FormatConfig);
commit 4e698e108af0ce3e6d7735f602eda91a2ab0fe25
Author: Thomas Sibley <trs at bestpractical.com>
Date: Fri Mar 1 15:53:45 2013 -0800
Restore a crucial hyphen mistakenly dropped during the refactor in cb3b5a5
Now the relevant CSS styles will apply again.
diff --git a/share/html/User/Elements/UserInfo b/share/html/User/Elements/UserInfo
index c1322b8..908739e 100644
--- a/share/html/User/Elements/UserInfo
+++ b/share/html/User/Elements/UserInfo
@@ -53,7 +53,7 @@
% $title = $fetch_columnmap->($attr,'title',[$attr]);
% }
% $title = $m->comp('/Elements/ScrubHTML', Content => $title);
-<div class="<% $ClassPrefix %> extra-field <% $fetch_columnmap->($attr,'attribute',[$attr]) %>" >
+<div class="<% $ClassPrefix %>-extra-field <% $fetch_columnmap->($attr,'attribute',[$attr]) %>" >
<span class="label"><% loc($title) %></span>
% my @out;
% foreach my $subcol ( @{ $column->{output} } ) {
commit 085d0b750be00a4278731aa8179b14e03be48488
Author: Thomas Sibley <trs at bestpractical.com>
Date: Fri Mar 1 15:55:49 2013 -0800
Sanitize the passed in CSS class prefix for robustness
diff --git a/share/html/User/Elements/UserInfo b/share/html/User/Elements/UserInfo
index 908739e..7175278 100644
--- a/share/html/User/Elements/UserInfo
+++ b/share/html/User/Elements/UserInfo
@@ -84,6 +84,8 @@ my $fetch_columnmap = sub {
);
return ProcessColumnMapValue( $tmp, Arguments => $arguments, Escape => 0 );
};
+
+$ClassPrefix = CSSClass($ClassPrefix) if $ClassPrefix;
</%INIT>
<%ARGS>
$User => undef
commit 1b1dfc5e98a9e9eb42deb0ad021722a0cb783752
Author: Thomas Sibley <trs at bestpractical.com>
Date: Fri Mar 1 16:14:18 2013 -0800
Call the ScrubHTML function directly
diff --git a/share/html/User/Elements/UserInfo b/share/html/User/Elements/UserInfo
index 7175278..1b2f0c7 100644
--- a/share/html/User/Elements/UserInfo
+++ b/share/html/User/Elements/UserInfo
@@ -52,7 +52,7 @@
% unless (defined $column->{title}) {
% $title = $fetch_columnmap->($attr,'title',[$attr]);
% }
-% $title = $m->comp('/Elements/ScrubHTML', Content => $title);
+% $title = ScrubHTML($title);
<div class="<% $ClassPrefix %>-extra-field <% $fetch_columnmap->($attr,'attribute',[$attr]) %>" >
<span class="label"><% loc($title) %></span>
% my @out;
commit 3e05ce3577a60c06652aaeb2a54e606bf15bb80d
Author: Thomas Sibley <trs at bestpractical.com>
Date: Fri Mar 1 16:20:08 2013 -0800
Allow HTML in the $MoreAboutRequestorsExtraInfo format string
This lets admins create links, use color, etc. Since the format string
is entirely RT server admin controlled, the HTML is not sanitized. This
allows greater flexibility for savvy admins.
Keeping with good practice, $fetch_columnmap now escapes by default.
The calls which fetch attributes instead of user record values turn off
escaping explicitly.
diff --git a/share/html/User/Elements/UserInfo b/share/html/User/Elements/UserInfo
index 1b2f0c7..1fc7476 100644
--- a/share/html/User/Elements/UserInfo
+++ b/share/html/User/Elements/UserInfo
@@ -50,10 +50,10 @@
% my $title = $column->{title} || '';
% my $attr = $column->{'attribute'} || $column->{'last_attribute'};
% unless (defined $column->{title}) {
-% $title = $fetch_columnmap->($attr,'title',[$attr]);
+% $title = $fetch_columnmap->($attr,'title',[$attr],'no_escape');
% }
% $title = ScrubHTML($title);
-<div class="<% $ClassPrefix %>-extra-field <% $fetch_columnmap->($attr,'attribute',[$attr]) %>" >
+<div class="<% $ClassPrefix %>-extra-field <% $fetch_columnmap->($attr,'attribute',[$attr],'no_escape') %>" >
<span class="label"><% loc($title) %></span>
% my @out;
% foreach my $subcol ( @{ $column->{output} } ) {
@@ -65,7 +65,7 @@
% push @out, $fetch_columnmap->($col, 'value', [$User]);
% }
% @out = grep { defined $_ and length $_ } @out;
-<span class="value"><% join(' ', at out) %></span>
+<span class="value"><% join(' ', at out) |n %></span>
</div>
% }
</div>
@@ -73,16 +73,19 @@
return unless $FormatConfig;
my $format = RT->Config->Get($FormatConfig);
return unless $format;
+
+# Note that we don't need to ScrubHTML($format), because it's only modifiable
+# by the RT server admin.
my @formats = $m->comp('/Elements/CollectionAsTable/ParseFormat', Format => $format);
my $fetch_columnmap = sub {
- my ($name, $attr, $arguments) = @_;
+ my ($name, $attr, $arguments, $no_escape) = @_;
my $tmp = $m->comp( '/Elements/ColumnMap',
Class => $Class,
Name => $name,
Attr => $attr,
);
- return ProcessColumnMapValue( $tmp, Arguments => $arguments, Escape => 0 );
+ return ProcessColumnMapValue( $tmp, Arguments => $arguments, Escape => !$no_escape );
};
$ClassPrefix = CSSClass($ClassPrefix) if $ClassPrefix;
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list