cartoonist-comics 0.0.16 → 0.0.17

Sign up to get free protection for your applications and to get access to all the features.
@@ -43,27 +43,28 @@ class ComicController < CartoonistController
43
43
  end
44
44
 
45
45
  def feed
46
+ respond_to_feed "feed"
47
+ end
48
+
49
+ def mfeed
50
+ respond_to_feed "mfeed"
51
+ end
52
+
53
+ private
54
+ def respond_to_feed(name)
46
55
  respond_to do |format|
47
56
  format.html { redirect_to "/comic" }
48
57
 
49
58
  format.rss do
50
- @feed = feed_contents
51
- render :content_type => "application/xml", :layout => "cartoonist"
59
+ @feed = ComicFeed.new Comic.feed
60
+
61
+ cache_page_as "comic/#{name}.#{cache_type}.tmp.rss" do
62
+ render :content_type => "application/xml", :layout => "cartoonist"
63
+ end
52
64
  end
53
65
  end
54
66
  end
55
67
 
56
- private
57
- def feed_contents
58
- key = "feed"
59
- key = "#{key}-mobile" if mobile?
60
- result = comic_cache.read key
61
- return result if result
62
- result = ComicFeed.new Comic.feed
63
- comic_cache.write key, result
64
- result
65
- end
66
-
67
68
  def max_comic
68
69
  result = comic_cache.read "max-comic"
69
70
  return result if result
@@ -1,15 +1,5 @@
1
1
  module Admin::ComicHelper
2
- def lock_toggle_target
3
- if @comic.locked
4
- "unlock"
5
- else
6
- "lock"
7
- end
8
- end
9
-
10
2
  def lock_disabled
11
- if @comic.locked
12
- 'disabled="disabled"'.html_safe
13
- end
3
+ @comic.lock_disabled_html
14
4
  end
15
5
  end
data/app/models/comic.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  class Comic < ActiveRecord::Base
2
2
  include Postable
3
3
  include Entity
4
+ include Lockable
4
5
  entity_type :comic
5
6
  entity_global_url "/comic"
6
7
  entity_url &:url
@@ -26,16 +27,6 @@ class Comic < ActiveRecord::Base
26
27
  Markdown.render description
27
28
  end
28
29
 
29
- def lock!
30
- self.locked = true
31
- save!
32
- end
33
-
34
- def unlock!
35
- self.locked = false
36
- save!
37
- end
38
-
39
30
  def real?
40
31
  number
41
32
  end
@@ -92,7 +83,7 @@ class Comic < ActiveRecord::Base
92
83
 
93
84
  def update_comic(params)
94
85
  comic = from_number params[:id].to_i
95
- raise "Cannot update locked comic!" if comic.locked
86
+ comic.ensure_unlocked!
96
87
  comic.title = params[:title]
97
88
  comic.description = params[:description]
98
89
  comic.scene_description = params[:scene_description]
@@ -1,11 +1,11 @@
1
1
  <% Cartoonist::Entity.hooks_with(:edit_entity_before_partial).each do |hook| %>
2
- <%= render :partial => hook.edit_entity_before_partial, :locals => { :entity => @comic } %>
2
+ <%= partial hook.edit_entity_before_partial, :entity => @comic %>
3
3
  <hr />
4
4
  <% end %>
5
5
 
6
6
  <p>
7
- <%= form_tag "/admin/comic/#{@comic.number}/#{lock_toggle_target}", :method => :post do %>
8
- <input type="submit" value="<%= lock_toggle_target %>" />
7
+ <%= form_tag "/admin/comic/#{@comic.number}/#{@comic.toggle_lock_target}", :method => :post do %>
8
+ <input type="submit" value="<%= @comic.toggle_lock_target %>" />
9
9
  <% end %>
10
10
  </p>
11
11
 
@@ -65,5 +65,5 @@
65
65
 
66
66
  <% Cartoonist::Entity.hooks_with(:edit_entity_after_partial).each do |hook| %>
67
67
  <hr />
68
- <%= render :partial => hook.edit_entity_after_partial, :locals => { :entity => @comic } %>
68
+ <%= partial hook.edit_entity_after_partial, :entity => @comic %>
69
69
  <% end %>
@@ -1,4 +1,4 @@
1
- <% content_for :rss_title, "#{Setting[:site_name]} Comic#{" (Mobile Edition)" if mobile?}" %>
1
+ <% content_for :rss_title, "#{Setting[:site_name]} Comic" %>
2
2
  <% content_for :pub_date, @feed.pub_date %>
3
3
 
4
4
  <% @feed.items.each do |item| %>
@@ -12,13 +12,6 @@
12
12
  </p>
13
13
  #{item.description}
14
14
  } %>
15
- <% if mobile? %>
16
- <%= %{
17
- <p style="background: #eff8bd; width: 85%; margin: 20px auto 0 auto; border: 1px solid #d5eab7; padding: 4px 10px; display: block;">
18
- #{h item.title_text}
19
- </p>
20
- } %>
21
- <% end %>
22
15
  </description>
23
16
  <link>http://<%= Setting[:domain] %>/comic/<%= item.number %></link>
24
17
  <guid>http://<%= Setting[:domain] %>/comic/<%= item.number %></guid>
@@ -0,0 +1,23 @@
1
+ <% content_for :rss_title, "#{Setting[:site_name]} Comic (Mobile Edition)" %>
2
+ <% content_for :pub_date, @feed.pub_date %>
3
+
4
+ <% @feed.items.each do |item| %>
5
+ <item>
6
+ <title><%= item.title %></title>
7
+ <description>
8
+ <%= %{
9
+ <h1>#{h item.title}</h1>
10
+ <p>
11
+ <img src="#{h item.img_url}" title="#{h item.title_text}" />
12
+ </p>
13
+ #{item.description}
14
+ <p style="background: #eff8bd; width: 85%; margin: 20px auto 0 auto; border: 1px solid #d5eab7; padding: 4px 10px; display: block;">
15
+ #{h item.title_text}
16
+ </p>
17
+ } %>
18
+ </description>
19
+ <link>http://<%= Setting[:domain] %>/comic/<%= item.number %></link>
20
+ <guid>http://<%= Setting[:domain] %>/comic/<%= item.number %></guid>
21
+ <pubDate><%= item.pub_date %></pubDate>
22
+ </item>
23
+ <% end %>
@@ -13,7 +13,7 @@
13
13
 
14
14
  <% content_for :content do %>
15
15
  <% Cartoonist::Entity.hooks_with(:show_entity_before_partial).each do |hook| %>
16
- <%= render :partial => hook.show_entity_before_partial, :locals => { :entity => @comic } %>
16
+ <%= partial hook.show_entity_before_partial, :entity => @comic %>
17
17
  <hr />
18
18
  <% end %>
19
19
 
@@ -70,7 +70,7 @@
70
70
  </div>
71
71
 
72
72
  <% Cartoonist::Entity.hooks_with(:show_entity_after_partial).each do |hook| %>
73
- <%= render :partial => hook.show_entity_after_partial, :locals => { :entity => @comic } %>
73
+ <%= partial hook.show_entity_after_partial, :entity => @comic %>
74
74
  <hr />
75
75
  <% end %>
76
76
  <% end %>
@@ -34,6 +34,7 @@ module CartoonistComics
34
34
  collection do
35
35
  get "random"
36
36
  get "feed", :defaults => { :format => "rss" }
37
+ get "mfeed", :defaults => { :format => "rss" }
37
38
  end
38
39
  end
39
40
 
@@ -2,7 +2,7 @@ module CartoonistComics
2
2
  class Version
3
3
  class << self
4
4
  def to_s
5
- "0.0.16"
5
+ "0.0.17"
6
6
  end
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,37 +1,38 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: cartoonist-comics
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.17
4
5
  prerelease:
5
- version: 0.0.16
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Mike Virata-Stone
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2012-12-15 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
12
+ date: 2013-02-13 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
16
15
  name: cartoonist
17
- prerelease: false
18
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
19
17
  none: false
20
- requirements:
21
- - - "="
22
- - !ruby/object:Gem::Version
23
- version: 0.0.16
18
+ requirements:
19
+ - - '='
20
+ - !ruby/object:Gem::Version
21
+ version: 0.0.17
24
22
  type: :runtime
25
- version_requirements: *id001
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - '='
28
+ - !ruby/object:Gem::Version
29
+ version: 0.0.17
26
30
  description: This core plugin for Cartoonist adds comics.
27
31
  email: reasonnumber@gmail.com
28
32
  executables: []
29
-
30
33
  extensions: []
31
-
32
34
  extra_rdoc_files: []
33
-
34
- files:
35
+ files:
35
36
  - app/controllers/admin/comic_controller.rb
36
37
  - app/controllers/comic_controller.rb
37
38
  - app/helpers/admin/comic_helper.rb
@@ -42,6 +43,7 @@ files:
42
43
  - app/views/admin/comic/index.html.erb
43
44
  - app/views/admin/comic/new.html.erb
44
45
  - app/views/comic/feed.rss.erb
46
+ - app/views/comic/mfeed.rss.erb
45
47
  - app/views/comic/show.html.erb
46
48
  - app/views/layouts/admin/comic.html.erb
47
49
  - app/views/layouts/comic.html.erb
@@ -54,30 +56,26 @@ files:
54
56
  - lib/cartoonist-comics/version.rb
55
57
  homepage: http://reasonnumber.com/cartoonist
56
58
  licenses: []
57
-
58
59
  post_install_message:
59
60
  rdoc_options: []
60
-
61
- require_paths:
61
+ require_paths:
62
62
  - lib
63
- required_ruby_version: !ruby/object:Gem::Requirement
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
64
  none: false
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: "0"
69
- required_rubygems_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
70
  none: false
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- version: "0"
71
+ requirements:
72
+ - - ! '>='
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
75
  requirements: []
76
-
77
76
  rubyforge_project:
78
77
  rubygems_version: 1.8.24
79
78
  signing_key:
80
79
  specification_version: 3
81
80
  summary: Cartoonist Comics
82
81
  test_files: []
83
-