configurable places of usefulness so that tuxbliki is more generic

master
Coleman 2008-07-23 04:09:30 -05:00
parent c3eae8c1fe
commit c7c4152c21
5 changed files with 18 additions and 10 deletions

View File

@ -21,4 +21,8 @@ class Application < Merb::Controller
img img
end end
def tuxconfig
Merb::Plugins.config[:tuxbliki]
end
end end

View File

@ -6,9 +6,13 @@ class News < Application
@page_count = (ncount.to_f / per_page.to_f).ceil.to_i @page_count = (ncount.to_f / per_page.to_f).ceil.to_i
@page = 0 if @page >= @page_count @page = 0 if @page >= @page_count
@url_key = :news @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' @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) @tags = Page.popular_tags(30)
render render
end end

View File

@ -92,5 +92,9 @@ module Merb
def indicator def indicator
"<img src='/images/ajax-loader.gif' id='indicator' alt='indicator' style='display: none;' />" "<img src='/images/ajax-loader.gif' id='indicator' alt='indicator' style='display: none;' />"
end end
def tuxconfig
Merb::Plugins.config[:tuxbliki]
end
end end
end end

View File

@ -2,7 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us">
<head> <head>
<title>PenguinCoder's TuxBliki<% if @page_title -%> :: <%= @page_title -%><% end -%><% if @secondary_title -%> :: <%= @secondary_title -%><% end -%></title> <title><%= tuxconfig[:site_name] -%><% if @page_title -%> :: <%= @page_title -%><% end -%><% if @secondary_title -%> :: <%= @secondary_title -%><% end -%></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="/stylesheets/application.css" type="text/css" media="screen" charset="utf-8" /> <link rel="stylesheet" href="/stylesheets/application.css" type="text/css" media="screen" charset="utf-8" />
@ -44,7 +44,7 @@ function addLoadEvent(func) {
<% end -%> <% end -%>
<div id="header"> <div id="header">
<span style="float: left; margin: 0px 20px 0px 0px"><img src="/images/penguincoder-logo.png" /></span> <span style="float: left; margin: 0px 20px 0px 0px"><img src="/images/<%= tuxconfig[:logo] -%>" /></span>
<h1><%= @page_title or 'TuxBliki' -%></h1> <h1><%= @page_title or 'TuxBliki' -%></h1>
<% if @secondary_title -%><h2><%= @secondary_title -%></h2><% end -%> <% if @secondary_title -%><h2><%= @secondary_title -%></h2><% end -%>
<br style="clear: both" /> <br style="clear: both" />

View File

@ -5,17 +5,13 @@
</div> </div>
<div id="related_links"> <div id="related_links">
<div class="title">Things I Do</div> <div class="title"><%= tuxconfig[:related_links_title] -%></div>
<p> <p>
<a href="http://github.com/penguincoder"><img src="/images/utilities-terminal.png" /> Code on Github</a><br /> <%= tuxconfig[:related_links].join('<br />') %>
<a href="http://del.icio.us/penguincoder"><img src="/images/delicious.med.gif" /> Del.icio.us Feed</a><br />
<a href="http://barleysodas.com">BarleySodas</a> Beer Wiki With Lots More<br />
</p> </p>
</div> </div>
<% end -%> <% end -%>
<% @secondary_title = "Demolishing innocence for #{time_lost_in_words(Time.now, @oldest_date)}" unless @oldest_date.nil? -%>
<% if @news.empty? -%> <% if @news.empty? -%>
<p><strong><em>There are no news posts, yet.</em></strong></p> <p><strong><em>There are no news posts, yet.</em></strong></p>