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 !
add users

git-svn-id: http://svn.techno-weenie.net/projects/mephisto@549 
567b1171-46fb-0310-a4c9-b4bef9110e78
technoweenie (author)
Sun Jan 01 14:29:40 -0800 2006
commit  182ae2f540ab94a7937c091972f203147bc331f2
tree    e3a26e4c6f63c4eca5fdf5c86c895fefad12d9ea
parent  6410b79f972227371dcd6e5584dfdb46a847a65d
...
1
 
2
3
4
...
 
1
2
3
4
0
@@ -1,4 +1,4 @@
0
-class Admin::ArticlesController < ApplicationController
0
+class Admin::ArticlesController < Admin::BaseController
0
   def index
0
     @tags = Tag.find :all
0
     @article = Article.new
...
1
 
2
3
4
...
 
1
2
3
4
0
@@ -1,4 +1,4 @@
0
-class Admin::TagsController < ApplicationController
0
+class Admin::TagsController < Admin::BaseController
0
   in_place_edit_for :tag, :name
0
   
0
   def index
...
1
 
2
3
4
...
 
1
2
3
4
0
@@ -1,4 +1,4 @@
0
-class Admin::TemplatesController < ApplicationController
0
+class Admin::TemplatesController < Admin::BaseController
0
   before_filter :select_template, :except => :index
0
   verify :params => :id, :only => [:edit, :update],
0
          :add_flash => { :error => 'Template required' },
...
30
31
32
33
34
 
 
 
35
36
37
...
30
31
32
 
 
33
34
35
36
37
38
0
@@ -30,8 +30,9 @@ class MephistoController < ApplicationController
0
   end
0
 
0
   def show
0
- @article = Article.find_by_permalink(params[:year], params[:month], params[:day], params[:permalink]).to_liquid
0
- render_liquid_template_for(:single, 'articles' => [@article])
0
+ @article = Article.find_by_permalink(params[:year], params[:month], params[:day], params[:permalink])
0
+ @comments = @article.comments.collect { |c| c.to_liquid }
0
+ render_liquid_template_for(:single, 'articles' => [@article.to_liquid], 'comments' => @comments)
0
   end
0
 
0
   protected
...
1
2
3
 
4
5
6
...
1
2
3
4
5
6
7
0
@@ -1,6 +1,7 @@
0
 class Article < ActiveRecord::Base
0
   has_many :taggings
0
   has_many :tags, :through => :taggings
0
+ has_many :comments
0
 
0
   class << self
0
     def find_by_permalink(year, month, day, permalink)
...
2
3
4
5
 
6
7
8
...
2
3
4
 
5
6
7
8
0
@@ -2,7 +2,7 @@
0
 
0
 <%= render :partial => 'templates' %>
0
 
0
-<% form_for :template, @tmpl, :url => { :action => 'update' } do |f| -%>
0
+<% form_for :template, @tmpl, :url => { :action => 'update', :id => @tmpl } do |f| -%>
0
   <h1><%=h @tmpl.name %></h1>
0
   <p><%= f.text_area :data %></p>
0
   <p><%= submit_tag 'Save' %></p>
...
14
15
16
 
 
 
 
17
18
19
...
31
32
33
 
 
 
 
 
 
 
 
 
 
 
34
...
14
15
16
17
18
19
20
21
22
23
...
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
0
@@ -14,6 +14,10 @@ ActiveRecord::Schema.define() do
0
     t.column "updated_at", :datetime
0
     t.column "published_at", :datetime
0
     t.column "type", :string, :limit => 20
0
+ t.column "author", :string, :limit => 100
0
+ t.column "author_url", :string
0
+ t.column "author_email", :string
0
+ t.column "author_ip", :string, :limit => 100
0
   end
0
 
0
   create_table "taggings", :force => true do |t|
0
@@ -31,4 +35,15 @@ ActiveRecord::Schema.define() do
0
     t.column "data", :text
0
   end
0
 
0
+ create_table "users", :force => true do |t|
0
+ t.column "login", :string, :limit => 40
0
+ t.column "email", :string, :limit => 100
0
+ t.column "crypted_password", :string, :limit => 40
0
+ t.column "salt", :string, :limit => 40
0
+ t.column "activation_code", :string, :limit => 40
0
+ t.column "activated_at", :datetime
0
+ t.column "created_at", :datetime
0
+ t.column "updated_at", :datetime
0
+ end
0
+
0
 end
...
28
29
30
 
31
...
28
29
30
31
32
0
@@ -28,3 +28,4 @@ welcome_comment:
0
   created_at: <%= 3.days.ago.to_s(:db) %>
0
   updated_at: <%= 3.days.ago.to_s(:db) %>
0
   published_at: <%= 3.days.ago.to_s(:db) %>
0
+ type: Comment
0
\ No newline at end of file
...
5
6
7
8
 
9
10
11
12
13
 
14
15
16
...
5
6
7
 
8
9
10
11
12
13
14
15
16
17
0
@@ -5,12 +5,13 @@ require 'admin/articles_controller'
0
 class Admin::ArticlesController; def rescue_action(e) raise e end; end
0
 
0
 class Admin::ArticlesControllerTest < Test::Unit::TestCase
0
- fixtures :articles, :tags, :taggings
0
+ fixtures :articles, :tags, :taggings, :users
0
 
0
   def setup
0
     @controller = Admin::ArticlesController.new
0
     @request = ActionController::TestRequest.new
0
     @response = ActionController::TestResponse.new
0
+ login_as :quentin
0
   end
0
 
0
   def test_should_show_articles
...
5
6
7
8
 
9
10
11
12
13
 
14
15
16
...
5
6
7
 
8
9
10
11
12
13
14
15
16
17
0
@@ -5,12 +5,13 @@ require 'admin/tags_controller'
0
 class Admin::TagsController; def rescue_action(e) raise e end; end
0
 
0
 class Admin::TagsControllerTest < Test::Unit::TestCase
0
- fixtures :tags
0
+ fixtures :tags, :users
0
 
0
   def setup
0
     @controller = Admin::TagsController.new
0
     @request = ActionController::TestRequest.new
0
     @response = ActionController::TestResponse.new
0
+ login_as :quentin
0
   end
0
 
0
   def test_should_list_templates
...
5
6
7
8
 
9
10
11
12
13
 
14
15
16
...
5
6
7
 
8
9
10
11
12
13
14
15
16
17
0
@@ -5,12 +5,13 @@ require 'admin/templates_controller'
0
 class Admin::TemplatesController; def rescue_action(e) raise e end; end
0
 
0
 class Admin::TemplatesControllerTest < Test::Unit::TestCase
0
- fixtures :templates
0
+ fixtures :templates, :users
0
 
0
   def setup
0
     @controller = Admin::TemplatesController.new
0
     @request = ActionController::TestRequest.new
0
     @response = ActionController::TestResponse.new
0
+ login_as :quentin
0
   end
0
 
0
   def test_should_list_templates
...
45
46
47
48
 
49
50
51
...
45
46
47
 
48
49
50
51
0
@@ -45,7 +45,7 @@ class MephistoControllerTest < Test::Unit::TestCase
0
   def test_should_show_entry
0
     date = 3.days.ago
0
     get :show, :year => date.year, :month => date.month, :day => date.day, :permalink => 'welcome_to_mephisto'
0
- assert_equal articles(:welcome).to_liquid, assigns(:article)
0
+ assert_equal articles(:welcome), assigns(:article)
0
     assert_tag :tag => 'a', :attributes => { :href => articles(:welcome).full_permalink }, :content => articles(:welcome).title
0
   end
0
 end
...
3
4
5
 
6
7
8
...
3
4
5
6
7
8
9
0
@@ -3,6 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
0
 require 'test_help'
0
 
0
 class Test::Unit::TestCase
0
+ include AuthenticatedTestHelper
0
   self.use_transactional_fixtures = true
0
   self.use_instantiated_fixtures = false
0
 

Comments

    No one has commented yet.