From c7c4152c21d8f4255cc358a8fc1062364ab10433 Mon Sep 17 00:00:00 2001 From: Coleman Date: Wed, 23 Jul 2008 04:09:30 -0500 Subject: [PATCH] configurable places of usefulness so that tuxbliki is more generic --- app/controllers/application.rb | 4 ++++ app/controllers/news.rb | 8 ++++++-- app/helpers/global_helpers.rb | 4 ++++ app/views/layout/application.html.erb | 4 ++-- app/views/news/index.html.erb | 8 ++------ 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/app/controllers/application.rb b/app/controllers/application.rb index 737fcb7..c5da8b9 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application.rb @@ -21,4 +21,8 @@ class Application < Merb::Controller img end + + def tuxconfig + Merb::Plugins.config[:tuxbliki] + end end \ No newline at end of file diff --git a/app/controllers/news.rb b/app/controllers/news.rb index f95ff50..4e59f39 100644 --- a/app/controllers/news.rb +++ b/app/controllers/news.rb @@ -6,9 +6,13 @@ class News < Application @page_count = (ncount.to_f / per_page.to_f).ceil.to_i @page = 0 if @page >= @page_count @url_key = :news - @page_title = 'Blogging!' + @page_title = tuxconfig[:news_heading] @news = Page.find :all, :limit => per_page, :offset => (@page * per_page), :conditions => [ 'published = ?', true ], :order => 'created_at DESC' - @oldest_date = Page.find(:first, :order => 'created_at ASC').created_at rescue nil + oldest_date = Page.find(:first, :select => 'created_at', :order => 'created_at ASC').created_at rescue nil + @secondary_title = tuxconfig[:motto] + if tuxconfig[:motto_with_date] and oldest_date + @secondary_title += " #{time_lost_in_words(Time.now, oldest_date)}" + end @tags = Page.popular_tags(30) render end diff --git a/app/helpers/global_helpers.rb b/app/helpers/global_helpers.rb index 4321bec..f0a8eab 100644 --- a/app/helpers/global_helpers.rb +++ b/app/helpers/global_helpers.rb @@ -92,5 +92,9 @@ module Merb def indicator "" end + + def tuxconfig + Merb::Plugins.config[:tuxbliki] + end end end diff --git a/app/views/layout/application.html.erb b/app/views/layout/application.html.erb index 585f0e5..f7cbf01 100644 --- a/app/views/layout/application.html.erb +++ b/app/views/layout/application.html.erb @@ -2,7 +2,7 @@ -PenguinCoder's TuxBliki<% if @page_title -%> :: <%= @page_title -%><% end -%><% if @secondary_title -%> :: <%= @secondary_title -%><% end -%> +<%= tuxconfig[:site_name] -%><% if @page_title -%> :: <%= @page_title -%><% end -%><% if @secondary_title -%> :: <%= @secondary_title -%><% end -%> @@ -44,7 +44,7 @@ function addLoadEvent(func) { <% end -%> <% end -%> -<% @secondary_title = "Demolishing innocence for #{time_lost_in_words(Time.now, @oldest_date)}" unless @oldest_date.nil? -%> - <% if @news.empty? -%>

There are no news posts, yet.