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 !
added pages controller, not finished

git-svn-id: http://svn.techno-weenie.net/projects/mephisto@658 
567b1171-46fb-0310-a4c9-b4bef9110e78
technoweenie (author)
Wed Feb 01 10:08:28 -0800 2006
commit  a094cbb00d3e80ea15036ac2b4ff124efa3bad49
tree    2437d26778e0d698ada38c709180986b9cc974f1
parent  372e33d5f268f1c3d2a54a189f379642f79bfc69
...
20
21
22
 
 
 
 
 
 
 
 
23
24
25
...
20
21
22
23
24
25
26
27
28
29
30
31
32
33
0
@@ -20,6 +20,14 @@ class Tag < ActiveRecord::Base
0
     end
0
   end
0
 
0
+ class << self
0
+ def find_paged(options = {})
0
+ with_scope :find => { :conditions => ['show_paged_articles = ?', true] } do
0
+ block_given? ? yield : find(:all, options)
0
+ end
0
+ end
0
+ end
0
+
0
   def hash_for_url(options = {})
0
     { :tags => to_url }.merge(options)
0
   end
...
9
10
11
 
12
13
 
14
15
16
 
17
18
19
...
9
10
11
12
13
14
15
16
17
18
19
20
21
22
0
@@ -9,11 +9,14 @@
0
 <div id="wrapper">
0
   <div id="header">
0
     <div id="title">mephisto.</div>
0
+<% if logged_in? -%>
0
     <ul>
0
       <li><%= link_to 'articles', :controller => '/admin/articles' %></li>
0
+ <li><%= link_to 'pages', :controller => '/admin/pages' %></li>
0
       <li><%= link_to 'tags', :controller => '/admin/tags' %></li>
0
       <li><%= link_to 'templates', :controller => '/admin/templates' %></li>
0
     </ul>
0
+<% end -%>
0
   </div>
0
 <% if flash[:notice] -%>
0
   <div id="flash"><%= flash[:notice] %></div>
...
14
15
16
17
 
18
19
 
20
21
22
 
23
24
25
...
14
15
16
 
17
18
 
19
20
21
 
22
23
24
25
0
@@ -14,12 +14,12 @@ class Admin::TagsControllerTest < Test::Unit::TestCase
0
     login_as :quentin
0
   end
0
 
0
- def test_should_list_templates
0
+ def test_should_list_tags
0
     get :index
0
- assert_equal 2, assigns(:tags).length
0
+ assert_equal 1, assigns(:tags).length # the home tag is shifted off
0
   end
0
 
0
- def test_should_create_template
0
+ def test_should_create_tag
0
     assert_difference Tag, :count do
0
       post :create, :tag => { :name => 'foo' }
0
       assert_response :success
...
4
5
6
7
8
 
 
 
 
 
 
 
9
10
11
...
44
45
46
 
 
 
 
 
47
...
4
5
6
 
 
7
8
9
10
11
12
13
14
15
16
...
49
50
51
52
53
54
55
56
57
0
@@ -4,8 +4,13 @@ class TagTest < Test::Unit::TestCase
0
   fixtures :tags, :articles, :taggings
0
 
0
   def test_find_or_create_sanity_check
0
- assert_equal tags(:home), Tag.find_or_create_by_name('home')
0
- assert_equal 3, Tag.find_or_create_by_name('foo').id
0
+ assert_no_difference Tag, :count do
0
+ assert_equal tags(:home), Tag.find_or_create_by_name('home')
0
+ end
0
+
0
+ assert_difference Tag, :count do
0
+ Tag.find_or_create_by_name('foo')
0
+ end
0
   end
0
 
0
   def test_articles_association_by_published_at
0
@@ -44,4 +49,9 @@ class TagTest < Test::Unit::TestCase
0
     assert_equal({ :tags => [] }, tags(:home).hash_for_url)
0
     assert_equal({ :tags => %w(about) }, tags(:about).hash_for_url)
0
   end
0
+
0
+ def test_should_return_correct_tags
0
+ assert_equal [tags(:home), tags(:about)], Tag.find(:all)
0
+ assert_equal [tags(:about)], Tag.find_paged
0
+ end
0
 end

Comments

    No one has commented yet.