engrave 0.0.5 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,11 @@
1
+ class Admin::AuthorsController < ApplicationController
2
+ respond_to :html, :json
3
+
4
+ load_and_authorize_resource :author
5
+
6
+ def show
7
+ @author = Author.find( params[:id] )
8
+ respond_with( @author )
9
+ end
10
+
11
+ end
@@ -0,0 +1,11 @@
1
+ class Admin::PagesController < ApplicationController
2
+ respond_to :html, :json
3
+
4
+ load_and_authorize_resource :page
5
+
6
+ def show
7
+ @page = Page.find( params[:id] )
8
+ respond_with( @page )
9
+ end
10
+
11
+ end
@@ -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
@@ -0,0 +1,7 @@
1
+ <% cache [ "v1", page ] do %>
2
+
3
+ <article class="page">
4
+ <div class="body"><%= Kramdown::Document.new( page.body).to_html.html_safe %></div>
5
+ </article>
6
+
7
+ <% end %>
@@ -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 "&nbsp;" ), 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 %>
@@ -0,0 +1,2 @@
1
+ <h1>Edit Post</h1>
2
+ <%= render partial: "form", locals: { post: @post } %>
@@ -0,0 +1,10 @@
1
+ <table style="width: 100%">
2
+ <% @posts.each do |p| %>
3
+ <tr>
4
+ <td><%= link_to p.title, admin_post_path( p ) %></td>
5
+ <td>
6
+ <%= link_to 'Edit', edit_admin_post_path( p ) %>
7
+ </td>
8
+ </tr>
9
+ <% end %>
10
+ </table>
@@ -0,0 +1,2 @@
1
+ <h1>New Post</h1>
2
+ <%= render partial: "form", locals: { post: @post } %>
@@ -0,0 +1,2 @@
1
+ <%= link_to 'Edit This Post', edit_admin_post_path( @post ) %>
2
+ <%= render :partial => "post", :locals => { :post => @post } %>
@@ -2,4 +2,11 @@ Rails.application.routes.draw do
2
2
  resources :posts
3
3
  resources :pages
4
4
  resources :authors
5
+
6
+ namespace :admin do
7
+ resources :posts
8
+ resources :pages
9
+ resources :authors
10
+ end
11
+
5
12
  end
@@ -1,3 +1,3 @@
1
1
  module Engrave
2
- VERSION = "0.0.5"
2
+ VERSION = "1.0.0"
3
3
  end
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.5
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-06-05 00:00:00.000000000Z
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: &70175288038200 !ruby/object:Gem::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: *70175288038200
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: &70175288030960 !ruby/object:Gem::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: *70175288030960
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: &70175288030140 !ruby/object:Gem::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: *70175288030140
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.10
195
+ rubygems_version: 1.8.23
152
196
  signing_key:
153
197
  specification_version: 3
154
198
  summary: Yet another Ruby blog engine.