engrave 0.0.5 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/admin/authors_controller.rb +11 -0
- data/app/controllers/admin/pages_controller.rb +11 -0
- data/app/controllers/admin/posts_controller.rb +52 -0
- data/app/views/admin/authors/_author.html.erb +0 -0
- data/app/views/admin/authors/show.html.erb +0 -0
- data/app/views/admin/pages/_page.html.erb +7 -0
- data/app/views/admin/pages/show.html.erb +1 -0
- data/app/views/admin/posts/_form.html.erb +22 -0
- data/app/views/admin/posts/_post.html.erb +15 -0
- data/app/views/admin/posts/edit.html.erb +2 -0
- data/app/views/admin/posts/index.html.erb +10 -0
- data/app/views/admin/posts/new.html.erb +2 -0
- data/app/views/admin/posts/show.html.erb +2 -0
- data/config/routes.rb +7 -0
- data/lib/engrave/version.rb +1 -1
- metadata +53 -9
@@ -0,0 +1,52 @@
|
|
1
|
+
class Admin::PostsController < ApplicationController
|
2
|
+
respond_to :html, :json
|
3
|
+
|
4
|
+
load_and_authorize_resource :post
|
5
|
+
|
6
|
+
def index
|
7
|
+
@posts = Post.all
|
8
|
+
respond_with( @posts )
|
9
|
+
end
|
10
|
+
|
11
|
+
def show
|
12
|
+
@post = Post.find( params[:id] )
|
13
|
+
respond_with( @post )
|
14
|
+
end
|
15
|
+
|
16
|
+
def edit
|
17
|
+
@post = Post.find( params[:id] )
|
18
|
+
respond_with( @post )
|
19
|
+
end
|
20
|
+
|
21
|
+
def update
|
22
|
+
@post = Post.find( params[:id] )
|
23
|
+
|
24
|
+
if @post.update_attributes( post_params )
|
25
|
+
flash[:notice] = "Post updated successfully"
|
26
|
+
else
|
27
|
+
flash[:notice] = "Post failed to update"
|
28
|
+
end
|
29
|
+
|
30
|
+
respond_with( [:admin, @post] )
|
31
|
+
end
|
32
|
+
|
33
|
+
def create
|
34
|
+
@post = Post.new
|
35
|
+
|
36
|
+
if @post.update_attributes( post_params )
|
37
|
+
flash[:notice] = "Post created successfully"
|
38
|
+
else
|
39
|
+
flash[:notice] = "Post failed to update"
|
40
|
+
end
|
41
|
+
|
42
|
+
respond_with( [:admin, @post] )
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def post_params
|
49
|
+
params[:post].slice( :title, :story_link, :draft, :published_at, :body )
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render :partial => "page", :locals => { :page => @page } %>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<%= simple_form_for( [:admin, @post] ) do |f| %>
|
2
|
+
<%= f.label :title %>
|
3
|
+
<%= f.text_field :title %>
|
4
|
+
|
5
|
+
<%= f.label :story_link %>
|
6
|
+
<%= f.text_field :story_link %>
|
7
|
+
|
8
|
+
<%= f.label :published_at %>
|
9
|
+
<%= f.text_field :published_at %>
|
10
|
+
|
11
|
+
<%= f.label :draft %>
|
12
|
+
<%= f.check_box :draft %>
|
13
|
+
|
14
|
+
<%= f.label :body %>
|
15
|
+
<%= f.text_area :body, style: "width: 60em; height: 15em;" %>
|
16
|
+
|
17
|
+
|
18
|
+
<div>
|
19
|
+
<%= f.submit 'Save' %>
|
20
|
+
</div>
|
21
|
+
|
22
|
+
<% end %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<% cache [ "v1", post ] do %>
|
2
|
+
|
3
|
+
<article class="post">
|
4
|
+
<h1>
|
5
|
+
<div class="permalink_icon"><%= link_to ( raw " " ), post %></div>
|
6
|
+
<%= link_to post.title, ( ( post.story_link.nil? || post.story_link.blank? ) ? post : post.story_link ) %>
|
7
|
+
</h1>
|
8
|
+
<div class="meta">
|
9
|
+
<span class="published_at"><%= post.published_at.strftime( "%B %d, %Y") %></span>
|
10
|
+
</div>
|
11
|
+
<div class="body"><%= Kramdown::Document.new( post.body ).to_html.html_safe %></div>
|
12
|
+
</article>
|
13
|
+
|
14
|
+
|
15
|
+
<% end %>
|
data/config/routes.rb
CHANGED
data/lib/engrave/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: engrave
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
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: 2012-
|
12
|
+
date: 2012-08-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,31 @@ dependencies:
|
|
21
21
|
version: 3.2.3
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.2.3
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: kramdown
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: cancan
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
28
49
|
none: false
|
29
50
|
requirements:
|
30
51
|
- - ! '>='
|
@@ -32,10 +53,15 @@ dependencies:
|
|
32
53
|
version: '0'
|
33
54
|
type: :runtime
|
34
55
|
prerelease: false
|
35
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
36
62
|
- !ruby/object:Gem::Dependency
|
37
63
|
name: friendly_id
|
38
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
39
65
|
none: false
|
40
66
|
requirements:
|
41
67
|
- - ~>
|
@@ -43,7 +69,12 @@ dependencies:
|
|
43
69
|
version: 4.0.1
|
44
70
|
type: :runtime
|
45
71
|
prerelease: false
|
46
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 4.0.1
|
47
78
|
description: Yet another Ruby blog engine.
|
48
79
|
email:
|
49
80
|
- jeff.mcfadden@gmail.com
|
@@ -57,6 +88,9 @@ files:
|
|
57
88
|
- app/assets/stylesheets/authors.css
|
58
89
|
- app/assets/stylesheets/pages.css
|
59
90
|
- app/assets/stylesheets/posts.css
|
91
|
+
- app/controllers/admin/authors_controller.rb
|
92
|
+
- app/controllers/admin/pages_controller.rb
|
93
|
+
- app/controllers/admin/posts_controller.rb
|
60
94
|
- app/controllers/authors_controller.rb
|
61
95
|
- app/controllers/pages_controller.rb
|
62
96
|
- app/controllers/posts_controller.rb
|
@@ -67,6 +101,16 @@ files:
|
|
67
101
|
- app/models/author.rb
|
68
102
|
- app/models/page.rb
|
69
103
|
- app/models/post.rb
|
104
|
+
- app/views/admin/authors/_author.html.erb
|
105
|
+
- app/views/admin/authors/show.html.erb
|
106
|
+
- app/views/admin/pages/_page.html.erb
|
107
|
+
- app/views/admin/pages/show.html.erb
|
108
|
+
- app/views/admin/posts/_form.html.erb
|
109
|
+
- app/views/admin/posts/_post.html.erb
|
110
|
+
- app/views/admin/posts/edit.html.erb
|
111
|
+
- app/views/admin/posts/index.html.erb
|
112
|
+
- app/views/admin/posts/new.html.erb
|
113
|
+
- app/views/admin/posts/show.html.erb
|
70
114
|
- app/views/authors/_author.html.erb
|
71
115
|
- app/views/authors/show.html.erb
|
72
116
|
- app/views/pages/_page.html.erb
|
@@ -148,7 +192,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
192
|
version: '0'
|
149
193
|
requirements: []
|
150
194
|
rubyforge_project:
|
151
|
-
rubygems_version: 1.8.
|
195
|
+
rubygems_version: 1.8.23
|
152
196
|
signing_key:
|
153
197
|
specification_version: 3
|
154
198
|
summary: Yet another Ruby blog engine.
|