aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/alavetelitheme.rb13
-rw-r--r--lib/config/custom-routes.rb8
-rw-r--r--lib/gettext_setup.rb14
-rw-r--r--lib/public_body_categories_en.rb7
-rw-r--r--lib/views/help/_sidebar.rhtml21
-rw-r--r--lib/views/help/help_out.rhml9
-rw-r--r--lib/views/help/help_out.rhtml9
-rw-r--r--locale-theme/en/app.po7
8 files changed, 88 insertions, 0 deletions
diff --git a/lib/alavetelitheme.rb b/lib/alavetelitheme.rb
index fa2749c..58defaa 100644
--- a/lib/alavetelitheme.rb
+++ b/lib/alavetelitheme.rb
@@ -5,3 +5,16 @@ class ActionController::Base
self.prepend_view_path File.join(File.dirname(__FILE__), "views")
end
end
+
+# In order to have the theme lib/ folder ahead of the main app one,
+# inspired in Ruby Guides explanation: http://guides.rubyonrails.org/plugins.html
+%w{ . }.each do |dir|
+ path = File.join(File.dirname(__FILE__), dir)
+ $LOAD_PATH.insert(0, path)
+ ActiveSupport::Dependencies.autoload_paths << path
+ ActiveSupport::Dependencies.autoload_once_paths.delete(path)
+end
+
+
+# Plug theme-specific locale strings
+require 'gettext_setup.rb'
diff --git a/lib/config/custom-routes.rb b/lib/config/custom-routes.rb
new file mode 100644
index 0000000..2c1b9cc
--- /dev/null
+++ b/lib/config/custom-routes.rb
@@ -0,0 +1,8 @@
+# Here you can override or add to the pages in the core website
+
+ActionController::Routing::Routes.draw do |map|
+ # Additional help page example
+ map.with_options :controller => 'help' do |help|
+ help.help_out '/help/help_out', :action => 'help_out'
+ end
+end
diff --git a/lib/gettext_setup.rb b/lib/gettext_setup.rb
new file mode 100644
index 0000000..5b7a455
--- /dev/null
+++ b/lib/gettext_setup.rb
@@ -0,0 +1,14 @@
+# Add a callback - to be executed before each request in development,
+# and at startup in production - to plug in theme locale strings.
+require 'dispatcher'
+Dispatcher.to_prepare do
+ repos = [
+ FastGettext::TranslationRepository.build('app', :path=>File.join(File.dirname(__FILE__), '..', 'locale-theme'), :type => :po),
+ FastGettext::TranslationRepository.build('app', :path=>'locale', :type => :po)
+ ]
+ FastGettext.add_text_domain 'app', :type=>:chain, :chain=>repos
+ FastGettext.default_text_domain = 'app'
+end
+
+
+
diff --git a/lib/public_body_categories_en.rb b/lib/public_body_categories_en.rb
new file mode 100644
index 0000000..f3c0aa4
--- /dev/null
+++ b/lib/public_body_categories_en.rb
@@ -0,0 +1,7 @@
+PublicBodyCategories.add(:en, [
+ "Silly ministries",
+ [ "useless_agency", "Useless ministries", "a useless ministry" ],
+ [ "lonely_agency", "Lonely agencies", "a lonely agency"],
+ "Popular agencies",
+ [ "popular_agency", "Popular agencies", "a lonely agency"]
+])
diff --git a/lib/views/help/_sidebar.rhtml b/lib/views/help/_sidebar.rhtml
new file mode 100644
index 0000000..92dd49a
--- /dev/null
+++ b/lib/views/help/_sidebar.rhtml
@@ -0,0 +1,21 @@
+<div id="right_column_flip">
+ <h2>Help pages</h2>
+ <ul class="no_bullets">
+ <li><%= link_to_unless_current "Introduction", "/help/about" %></li>
+ <li><%= link_to_unless_current "Making requests", "/help/requesting" %></li>
+ <li><%= link_to_unless_current "Your privacy", "/help/privacy" %></li>
+ <li><%= link_to_unless_current "FOI officers", "/help/officers" %></li>
+ <li><%= link_to_unless_current "About the software", "/help/alaveteli" %></li>
+ <li><%= link_to_unless_current "Credits", "/help/credits" %></li>
+ <li><%= link_to_unless_current "Programmers API", "/help/api" %></li>
+ <li><%= link_to_unless_current "Help us", "/help/help_out" %></li>
+ <li><%= link_to_unless_current "Advanced search", "/search" %></li>
+ </ul>
+
+ <h2 id="contact">Contact us</h2>
+ <p>If your question isn't answered here, or you just wanted to let us know
+ something about the site, <a href="/help/contact">contact&nbsp;us</a>.
+ </p>
+</div>
+
+
diff --git a/lib/views/help/help_out.rhml b/lib/views/help/help_out.rhml
new file mode 100644
index 0000000..6744a27
--- /dev/null
+++ b/lib/views/help/help_out.rhml
@@ -0,0 +1,9 @@
+<% @title = "Help out" %>
+
+<%= render :partial => 'sidebar' %>
+
+<h1>Help us!</h1>
+
+<p>This is a custom "help out" page, showing how you can add new pages to Alaveteli from a theme. There's no navigation to it, though! You'd need to add that in your own custom <code>_sidebar.rhtml</code></p>
+
+
diff --git a/lib/views/help/help_out.rhtml b/lib/views/help/help_out.rhtml
new file mode 100644
index 0000000..6fadca4
--- /dev/null
+++ b/lib/views/help/help_out.rhtml
@@ -0,0 +1,9 @@
+<% @title = "Help out" %>
+
+<%= render :partial => 'sidebar' %>
+<div id="left_column_flip">
+ <h1>Help us!</h1>
+
+ <p>This is a custom "help out" page, showing how you can add new pages to Alaveteli from within a theme.</p>
+</div>
+
diff --git a/locale-theme/en/app.po b/locale-theme/en/app.po
new file mode 100644
index 0000000..d2da165
--- /dev/null
+++ b/locale-theme/en/app.po
@@ -0,0 +1,7 @@
+# Your theme's locale files will override the core locale files. This
+# is a good place to put both translations specific to your theme, and
+# "translations" of the core English words (e.g. you might want to
+# call FOI "RTI" throughougout, like this:
+
+msgid "Make and browse Freedom of Information (FOI) requests"
+msgstr "Make and browse Right to Know (RTI) requests" \ No newline at end of file