Subject: | patch to make name of rubric instance configurable |
Date: | Sun, 18 Nov 2007 11:24:14 -0500 |
To: | bug-Rubric <bug-Rubric [...] rt.cpan.org> |
From: | John SJ Anderson <genehack [...] genehack.org> |
The following patch contains the changes needed to make the 'Rubric'
text in the <title> and at the top of the various templates a
configurable option. (I don't particularly like 'basename' for the name
of this option but it was the best I could come up with this morning.)
The patch also makes the title text within the page a link back to the
root of the Rubric instance.
diff --git a/lib/Rubric/Config.pm b/lib/Rubric/Config.pm
index 86325a4..6702b1c 100644
--- a/lib/Rubric/Config.pm
+++ b/lib/Rubric/Config.pm
@@ -68,6 +68,10 @@ the absolute URI for the root of the Rubric::WebApp install
the absolute URI for the stylesheet to be used by Rubric::WebApp pages
+=item * basename
+
+the text to display as the name of this Rubric instance. Defaults to 'Rubric'.
+
=item * template_path
the INCLUDE_PATH passed to Template when creating the template renderers
@@ -181,6 +185,7 @@ This method returns the default configuration has a hashref.
=cut
my $default = {
+ basename => 'Rubric',
css_href => undef,
db_user => undef,
db_pass => undef,
diff --git a/lib/Rubric/WebApp/URI.pm b/lib/Rubric/WebApp/URI.pm
index 3020b06..33fc0f0 100644
--- a/lib/Rubric/WebApp/URI.pm
+++ b/lib/Rubric/WebApp/URI.pm
@@ -41,6 +41,15 @@ sub stylesheet {
return Rubric::Config->uri_root . '/style/rubric.css';
}
+=head2 basename
+
+the text to display as the name of the rubric instance
+
+=cut
+
+sub basename { Rubric::Config->basename; }
+
+
=head2 logout
URI to log out
diff --git a/share/templates/header.html b/share/templates/header.html
index aa663ab..064b522 100644
--- a/share/templates/header.html
+++ b/share/templates/header.html
@@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
- <title>Rubric[% ": " _ query_description IF query_description %]</title>
+ <title>[% uri.basename %][% ": " _ query_description IF query_description %]</title>
[% IF uri.stylesheet %]
<link href='[% uri.stylesheet %]' rel='stylesheet' type='text/css' />
[% END %]
@@ -14,5 +14,5 @@
</head>
<body>
<h1>
- Rubric
+ <a href="[% uri.root %]">[% uri.basename %]</a>
</h1>
diff --git a/share/templates/links.html b/share/templates/links.html
index 1c687dc..ab47f7c 100644
--- a/share/templates/links.html
+++ b/share/templates/links.html
@@ -1,12 +1,12 @@
[% USE uri = Class('Rubric::WebApp::URI') %]
<html>
<head>
- <title>Rubric</title>
+ <title>[% uri.basename %]</title>
<link href='[% uri.stylesheet %]' rel='stylesheet' type='text/css' />
</head>
<body>
<h1>
- rubric
+ <a href="[% uri.root %]">[% uri.basename %]</a>
</h1>
[% PROCESS "toolbar.html" %]
john.
--
What matters is the worst case not the best case. Users will do non
optimal things on a regular basis. -- Alan Cox