[Rt-commit] rt branch, 4.2/explicit-body-class, created. rt-4.2.10-196-gcfe8564
Alex Vandiver
alexmv at bestpractical.com
Tue Mar 24 16:42:05 EDT 2015
The branch, 4.2/explicit-body-class has been created
at cfe8564cacca6659f09643216bedfc9d261bdeb1 (commit)
- Log -----------------------------------------------------------------
commit cfe8564cacca6659f09643216bedfc9d261bdeb1
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Sun Mar 15 16:49:07 2015 -0700
Add a new 'BodyClass' parameter to Elements/Header
Add a new 'BodyClass' parameter to Elements/Header to let extensions
(such as RTIR) pass in an explicit body class to all pages they
handle with a callback, so they can more easily style only their
own pages.
Extensions can add their own strings to this parameter by pushing
elements onto it, via the "Head" callback
We use the parameter as $ARGS{'BodyClass'} rather than @BodyClass
because the @BodyClass version is instantiated before the callback
gets a chance to add values to it.
diff --git a/share/html/Elements/Header b/share/html/Elements/Header
index d2ac21d..bf3e6f9 100644
--- a/share/html/Elements/Header
+++ b/share/html/Elements/Header
@@ -97,7 +97,7 @@
<& /Elements/Framekiller &>
</head>
- <body class="<% lc $style %><% RT->Config->Get("UseSideBySideLayout", $session{'CurrentUser'}) ? ' sidebyside' : '' %>" <% $id && qq[id="comp-$id"] |n %>>
+ <body class="<% join( ' ',@{$ARGS{'BodyClass'}}) %>" <% $id && qq[id="comp-$id"] |n %>>
% if ($ShowBar) {
<& /Elements/Logo, %ARGS &>
@@ -133,6 +133,14 @@ else {
@css_files = "/NoAuth/css/$style/squished-$key.css";
}
+# We use BodyClass in its $ARGS form so that callbacks have a chance to
+# massage it
+push @{$ARGS{'BodyClass'}}, lc $style;
+
+if (RT->Config->Get("UseSideBySideLayout", $session{'CurrentUser'})) {
+ push @{$ARGS{'BodyClass'}}, 'sidebyside';
+}
+
</%INIT>
<%ARGS>
@@ -147,4 +155,5 @@ $onload => undef
$LinkRel => undef
$SkipDoctype => 0
$RichText => 1
+$BodyClass => undef
</%ARGS>
-----------------------------------------------------------------------
More information about the rt-commit
mailing list