[Rt-commit] rt branch, 4.2/explicit-body-class, created. rt-4.2.10-196-g8abef8f
Jesse Vincent
jesse at bestpractical.com
Sun Mar 15 19:57:35 EDT 2015
The branch, 4.2/explicit-body-class has been created
at 8abef8fd9e90d4fa340d8a1fe16d9f38f4aed83f (commit)
- Log -----------------------------------------------------------------
commit 8abef8fd9e90d4fa340d8a1fe16d9f38f4aed83f
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.
Callbacks can add their own strings to this parameter by pushing
elements onto it.
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