[Rt-commit] rt branch, 4.2/explicit-body-class, created. rt-4.2.10-196-g8336828
Jesse Vincent
jesse at bestpractical.com
Sat Mar 21 02:40:27 EDT 2015
The branch, 4.2/explicit-body-class has been created
at 833682812a08c2e778a57aee354c7146bf1d535b (commit)
- Log -----------------------------------------------------------------
commit 833682812a08c2e778a57aee354c7146bf1d535b
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..d48c862 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