public
Fork of halorgium/mephisto
Description: A mirror of the mephisto code-base
Homepage: http://mephistoblog.com/
Clone URL: git://github.com/technoweenie/mephisto.git
Click here to lend your support to: mephisto and make a donation at www.pledgie.com !
beginnings of template admin controller

git-svn-id: http://svn.techno-weenie.net/projects/mephisto@537 
567b1171-46fb-0310-a4c9-b4bef9110e78
technoweenie (author)
Fri Dec 30 21:02:57 -0800 2005
commit  8f52fe9272ad5604fa5b2fc634d66085c9b1f5f7
tree    789447700aebe0adcacd20da1c7973d1d6432d33
parent  959eb817f66fe316d3e648965fc3b428545c1dae
...
2
3
4
5
6
7
8
9
10
11
12
 
 
 
 
 
 
 
13
14
15
16
17
18
 
 
19
20
 
21
22
23
...
2
3
4
 
 
 
 
 
 
 
 
5
6
7
8
9
10
11
12
13
14
15
16
 
17
18
19
20
21
22
23
24
0
@@ -2,22 +2,23 @@ class MephistoController < ApplicationController
0
   layout 'default'
0
 
0
   def dispatch
0
- articles(params[:tags].blank? ? :main : :tag)
0
- end
0
-
0
- protected
0
- def articles(template_type = :main)
0
- @tag = params[:tags].blank? ?
0
- Tag.find_by_name('home') :
0
- Tag.find_by_name(params[:tags].join('/'))
0
+ if params[:tags].blank?
0
+ @tag = Tag.find_by_name('home')
0
+ template_type = :main
0
+ else
0
+ @tag = Tag.find_by_name(params[:tags].join('/'))
0
+ template_type = :tag
0
+ end
0
 
0
     @article_pages = Paginator.new self, @tag.articles.size, 15, params[:page]
0
     @articles = @tag.articles.find_by_date(
0
                   :limit => @article_pages.items_per_page,
0
                   :offset => @article_pages.current.offset).collect { |a| a.attributes }
0
- render_liquid_template_for :main, 'tag' => @tag, 'articles' => @articles
0
+
0
+ render_liquid_template_for(template_type, 'tag' => @tag, 'articles' => @articles)
0
   end
0
 
0
+ protected
0
   def render_liquid_template_for(template_type, assigns = {})
0
     headers["Content-Type"] ||= 'text/html; charset=utf-8'
0
     templates = Template.templates_for(template_type)
...
31
32
33
 
 
34
35
...
31
32
33
34
35
36
37
0
@@ -31,5 +31,7 @@ class MephistoControllerTest < Test::Unit::TestCase
0
     get :dispatch, :tags => []
0
     assert_tag :tag => 'h1', :content => 'This is the layout'
0
     assert_tag :tag => 'p', :content => 'home'
0
+ get :dispatch, :tags => %w(about)
0
+ assert_tag :tag => 'p', :content => 'tag'
0
   end
0
 end

Comments

    No one has commented yet.