kealy_cms 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/categories_controller.rb +9 -0
- data/app/controllers/cms_controller.rb +1 -1
- data/app/controllers/comments_controller.rb +20 -0
- data/app/controllers/pages_controller.rb +9 -0
- data/app/controllers/posts_controller.rb +18 -0
- data/app/controllers/tags_controller.rb +14 -0
- data/app/models/comment.rb +1 -0
- data/app/models/page.rb +1 -2
- data/app/models/page_part.rb +2 -0
- data/app/models/post.rb +3 -0
- data/app/views/comments/_comment.html.erb +7 -0
- data/app/views/comments/create.js.erb +2 -0
- data/app/views/pages/show.html.erb +12 -0
- data/app/views/posts/blog/_no_post.html.erb +1 -0
- data/app/views/posts/blog/_post.html.erb +6 -0
- data/app/views/posts/blog/post/_comment.html.erb +0 -0
- data/app/views/posts/blog/post/_comments.html.erb +1 -0
- data/app/views/posts/blog/post/_meta.html.erb +1 -0
- data/app/views/posts/comments/_form.html.erb +13 -0
- data/app/views/posts/index.html.erb +6 -0
- data/app/views/posts/show.html.erb +28 -0
- data/app/views/tags/_tag.html.erb +1 -0
- data/config/routes.rb +7 -5
- data/lib/rails/generators/kealy_cms/templates/create_cms.rb +2 -1
- data/test/dummy/log/development.log +20 -0
- metadata +27 -9
- data/app/views/cms/blog.html.erb +0 -1
@@ -0,0 +1,20 @@
|
|
1
|
+
class CommentsController < ApplicationController
|
2
|
+
protect_from_forgery
|
3
|
+
def show
|
4
|
+
@comment = Comment.find(params[:id])
|
5
|
+
respond_to do |format|
|
6
|
+
format.html # index.html.erb
|
7
|
+
end
|
8
|
+
end
|
9
|
+
def index
|
10
|
+
@comments = Comment.all
|
11
|
+
respond_to do |format|
|
12
|
+
format.html # index.html.erb
|
13
|
+
end
|
14
|
+
end
|
15
|
+
def create
|
16
|
+
@comment = Comment.new(params[:comment])
|
17
|
+
@comment.post_id = Post.find(params[:post_id]).id
|
18
|
+
@comment.save
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class PostsController < ApplicationController
|
2
|
+
protect_from_forgery
|
3
|
+
def show
|
4
|
+
@post = Post.find(params[:id])
|
5
|
+
@comment = Comment.new
|
6
|
+
@comments = @post.comments.where(:approved=>true)
|
7
|
+
@tags = @post.tags
|
8
|
+
respond_to do |format|
|
9
|
+
format.html # index.html.erb
|
10
|
+
end
|
11
|
+
end
|
12
|
+
def index
|
13
|
+
@posts = Post.all
|
14
|
+
respond_to do |format|
|
15
|
+
format.html # index.html.erb
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class TagsController < ApplicationController
|
2
|
+
protect_from_forgery
|
3
|
+
def show
|
4
|
+
@tag = Tag.find(params[:id])
|
5
|
+
@posts = @tag.posts
|
6
|
+
render '/posts/index'
|
7
|
+
end
|
8
|
+
def index
|
9
|
+
@tags = Tag.find(:all)
|
10
|
+
respond_to do |format|
|
11
|
+
format.html # index.html.erb
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/app/models/comment.rb
CHANGED
data/app/models/page.rb
CHANGED
data/app/models/page_part.rb
CHANGED
data/app/models/post.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
Sorry there are no posts matching your criteria.
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
comments
|
@@ -0,0 +1 @@
|
|
1
|
+
meta
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<%= form_for [@post, @comment], :remote=>true do |f| %>
|
2
|
+
<div class="field">
|
3
|
+
<%= f.label :author %><br />
|
4
|
+
<%= f.text_field :author %>
|
5
|
+
</div>
|
6
|
+
<div class="field">
|
7
|
+
<%= f.label :content %><br />
|
8
|
+
<%= f.text_area :content %>
|
9
|
+
</div>
|
10
|
+
<div class="actions">
|
11
|
+
<%= f.submit %>
|
12
|
+
</div>
|
13
|
+
<% end %>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<h2><%= @post.title %></h2>
|
2
|
+
<div class="post">
|
3
|
+
<%= raw @post.content %>
|
4
|
+
</div>
|
5
|
+
|
6
|
+
<div class="tags">
|
7
|
+
<%= render :partial => "/tags/tag", :collection => @post.tags, :as => "tag" %>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
<% if @comments.first %>
|
14
|
+
There are <span id="comments-count"><%= @comments.count %></span> comments.
|
15
|
+
<% else %>
|
16
|
+
There are no comments.
|
17
|
+
<% end %>
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
<%= render :partial => "/comments/comment", :collection => @post.comments, :as => "comment" %>
|
22
|
+
|
23
|
+
|
24
|
+
<div id="comments-container"></div>
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
<%= render '/posts/comments/form' %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= link_to tag.name, tag %><br />
|
data/config/routes.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
Rails.application.routes.draw do
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
# resources :pages
|
3
|
+
resources :posts, :only => [:show, :index] do
|
4
|
+
resources :comments
|
5
|
+
end
|
6
|
+
resources :categories, :only => [:show, :index]
|
7
|
+
resources :tags, :only => [:show, :index]
|
8
|
+
resources :pages, :only => [:show], :path => "/"
|
7
9
|
end
|
@@ -3,6 +3,7 @@ class CreateCms < ActiveRecord::Migration
|
|
3
3
|
create_table :posts do |t|
|
4
4
|
t.string :title
|
5
5
|
t.text :content
|
6
|
+
t.integer :post_id
|
6
7
|
|
7
8
|
t.timestamps
|
8
9
|
end
|
@@ -49,7 +50,7 @@ class CreateCms < ActiveRecord::Migration
|
|
49
50
|
t.integer :parent_id
|
50
51
|
t.integer :post_id
|
51
52
|
t.boolean :approved
|
52
|
-
t.string :
|
53
|
+
t.string :author
|
53
54
|
t.string :author_website
|
54
55
|
t.string :author_email
|
55
56
|
t.text :content
|
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
Started GET "/" for 127.0.0.1 at 2011-10-29 12:54:10 +0530
|
4
|
+
|
5
|
+
SQLite3::CantOpenException (unable to open database file):
|
6
|
+
|
7
|
+
|
8
|
+
Rendered /home/john/.rvm/gems/ruby-1.9.2-p290@thrasys/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/_trace.erb (2.4ms)
|
9
|
+
Rendered /home/john/.rvm/gems/ruby-1.9.2-p290@thrasys/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (32.4ms)
|
10
|
+
Rendered /home/john/.rvm/gems/ruby-1.9.2-p290@thrasys/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (61.9ms)
|
11
|
+
|
12
|
+
|
13
|
+
Started GET "/foo" for 127.0.0.1 at 2011-10-29 12:54:13 +0530
|
14
|
+
|
15
|
+
SQLite3::CantOpenException (unable to open database file):
|
16
|
+
|
17
|
+
|
18
|
+
Rendered /home/john/.rvm/gems/ruby-1.9.2-p290@thrasys/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/_trace.erb (0.9ms)
|
19
|
+
Rendered /home/john/.rvm/gems/ruby-1.9.2-p290@thrasys/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (0.6ms)
|
20
|
+
Rendered /home/john/.rvm/gems/ruby-1.9.2-p290@thrasys/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (3.0ms)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kealy_cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-10-
|
12
|
+
date: 2011-10-30 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &21506920 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.1.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *21506920
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: sqlite3
|
27
|
-
requirement: &
|
27
|
+
requirement: &21503960 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *21503960
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: friendly_id
|
38
|
-
requirement: &
|
38
|
+
requirement: &21501880 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *21501880
|
47
47
|
description: ditto above
|
48
48
|
email:
|
49
49
|
- jdkealy@gmail.com
|
@@ -51,8 +51,24 @@ executables: []
|
|
51
51
|
extensions: []
|
52
52
|
extra_rdoc_files: []
|
53
53
|
files:
|
54
|
+
- app/controllers/comments_controller.rb
|
55
|
+
- app/controllers/pages_controller.rb
|
56
|
+
- app/controllers/posts_controller.rb
|
57
|
+
- app/controllers/categories_controller.rb
|
58
|
+
- app/controllers/tags_controller.rb
|
54
59
|
- app/controllers/cms_controller.rb
|
55
|
-
- app/views/
|
60
|
+
- app/views/tags/_tag.html.erb
|
61
|
+
- app/views/pages/show.html.erb
|
62
|
+
- app/views/comments/_comment.html.erb
|
63
|
+
- app/views/comments/create.js.erb
|
64
|
+
- app/views/posts/show.html.erb
|
65
|
+
- app/views/posts/comments/_form.html.erb
|
66
|
+
- app/views/posts/blog/_no_post.html.erb
|
67
|
+
- app/views/posts/blog/_post.html.erb
|
68
|
+
- app/views/posts/blog/post/_comment.html.erb
|
69
|
+
- app/views/posts/blog/post/_meta.html.erb
|
70
|
+
- app/views/posts/blog/post/_comments.html.erb
|
71
|
+
- app/views/posts/index.html.erb
|
56
72
|
- app/views/cms/page.html.erb
|
57
73
|
- app/models/page_part.rb
|
58
74
|
- app/models/comment.rb
|
@@ -92,6 +108,7 @@ files:
|
|
92
108
|
- test/dummy/app/controllers/application_controller.rb
|
93
109
|
- test/dummy/app/views/layouts/application.html.erb
|
94
110
|
- test/dummy/config.ru
|
111
|
+
- test/dummy/log/development.log
|
95
112
|
- test/dummy/Rakefile
|
96
113
|
- test/dummy/config/environment.rb
|
97
114
|
- test/dummy/config/locales/en.yml
|
@@ -157,6 +174,7 @@ test_files:
|
|
157
174
|
- test/dummy/app/controllers/application_controller.rb
|
158
175
|
- test/dummy/app/views/layouts/application.html.erb
|
159
176
|
- test/dummy/config.ru
|
177
|
+
- test/dummy/log/development.log
|
160
178
|
- test/dummy/Rakefile
|
161
179
|
- test/dummy/config/environment.rb
|
162
180
|
- test/dummy/config/locales/en.yml
|
data/app/views/cms/blog.html.erb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
hi
|