cartoonist-comics 0.0.9.1 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,9 +4,11 @@ class ComicController < CartoonistController
4
4
  @disabled_prev = true if @comic.oldest?
5
5
  @disabled_next = true
6
6
  @title = Setting[:site_name]
7
- render :show
8
- cache_page_as ".#{cache_type}.tmp.html" if Cartoonist::RootPath.current_key == :comics
9
- cache_page_as "comic.#{cache_type}.tmp.html"
7
+
8
+ cache_page_as "comic.#{cache_type}.tmp.html" do
9
+ render :show
10
+ cache_page_as ".#{cache_type}.tmp.html" if Cartoonist::RootPath.current_key == :comics
11
+ end
10
12
  end
11
13
 
12
14
  def random
@@ -21,8 +23,10 @@ class ComicController < CartoonistController
21
23
  @comic = Comic.from_number params[:id], true
22
24
  @disabled_prev = true if @comic.oldest?
23
25
  @disabled_next = @comic.maybe_newest?
24
- render
25
- cache_show_page
26
+
27
+ cache_page_as show_page_cache_path do
28
+ render
29
+ end
26
30
  rescue
27
31
  redirect_to "/comic"
28
32
  end
@@ -30,8 +34,10 @@ class ComicController < CartoonistController
30
34
 
31
35
  format.png do
32
36
  comic = Comic.from_number params[:id], true
33
- send_data comic.database_file.content, :filename => "comic_#{comic.number}.png", :type => "image/png", :disposition => "inline"
34
- cache_page_as "static/comic/#{comic.number}.png"
37
+
38
+ cache_page_as "static/comic/#{comic.number}.png" do
39
+ send_data comic.database_file.content, :filename => "comic_#{comic.number}.png", :type => "image/png", :disposition => "inline"
40
+ end
35
41
  end
36
42
  end
37
43
  end
@@ -68,11 +74,11 @@ class ComicController < CartoonistController
68
74
  @@comic_cache ||= ActiveSupport::Cache::MemoryStore.new(:expires_in => 2.hours)
69
75
  end
70
76
 
71
- def cache_show_page
77
+ def show_page_cache_path
72
78
  if @disabled_next
73
- cache_page_as "comic/#{@comic.number}.#{cache_type}.tmp.html"
79
+ "comic/#{@comic.number}.#{cache_type}.tmp.html"
74
80
  else
75
- cache_page_as "comic/#{@comic.number}.#{cache_type}.html"
81
+ "comic/#{@comic.number}.#{cache_type}.html"
76
82
  end
77
83
  end
78
84
  end
data/app/models/comic.rb CHANGED
@@ -78,7 +78,7 @@ class Comic < ActiveRecord::Base
78
78
 
79
79
  def create_comic(params)
80
80
  last = current_created
81
- create :number => next_number(last), :title => params[:title], :posted_at => next_post_date(last), :description => params[:description], :scene_description => params[:scene_description], :dialogue => params[:dialogue], :title_text => params[:title_text], :database_file => DatabaseFile.create(:content => params[:image].read), :locked => true
81
+ create :number => next_number(last), :title => params[:title], :posted_at => next_post_date(last), :description => params[:description], :scene_description => params[:scene_description], :dialogue => params[:dialogue], :title_text => params[:title_text], :database_file => DatabaseFile.create_from_param(params[:image], :allowed_extensions => ["png"]), :locked => true
82
82
  end
83
83
 
84
84
  def update_comic(params)
@@ -90,7 +90,7 @@ class Comic < ActiveRecord::Base
90
90
  comic.dialogue = params[:dialogue]
91
91
  comic.title_text = params[:title_text]
92
92
  comic.locked = true
93
- comic.database_file = DatabaseFile.create(:content => params[:image].read) if params[:image]
93
+ comic.database_file = DatabaseFile.create_from_param params[:image], :allowed_extensions => ["png"]
94
94
  comic.save!
95
95
  comic
96
96
  end
@@ -24,7 +24,7 @@ class ComicFeed
24
24
  @title = comic.title
25
25
  @img_url = comic.absolute_img_url
26
26
  @title_text = comic.title_text
27
- @description = comic.formatted_description
27
+ @description = Markdown.render comic.description, :link_to_absolute => true
28
28
  @pub_date = comic.posted_at.to_time.strftime "%a, %d %b %Y 00:00:01 %z"
29
29
  end
30
30
  end
@@ -2,8 +2,7 @@ Gem::Specification.new do |s|
2
2
  raise "Cannot find version file!" unless File.exists?(File.join(File.dirname(__FILE__), "../CARTOONIST_VERSION"))
3
3
  cartoonist_version = File.read(File.join(File.dirname(__FILE__), "../CARTOONIST_VERSION")).strip
4
4
  s.name = "cartoonist-comics"
5
- #s.version = cartoonist_version
6
- s.version = "0.0.9.1"
5
+ s.version = cartoonist_version
7
6
  s.date = Time.now.strftime "%Y-%m-%d"
8
7
  s.summary = "Cartoonist Comics"
9
8
  s.description = "This core plugin for Cartoonist adds comics."
@@ -12,6 +11,5 @@ Gem::Specification.new do |s|
12
11
  s.files = `git ls-files`.split("\n")
13
12
  s.require_paths = ["lib"]
14
13
  s.homepage = "http://reasonnumber.com/cartoonist"
15
- #s.add_dependency "cartoonist", cartoonist_version
16
- s.add_dependency "cartoonist", "0.0.9"
14
+ s.add_dependency "cartoonist", cartoonist_version
17
15
  end
@@ -7,7 +7,7 @@ module CartoonistComics
7
7
  Cartoonist::Migration.add_for self
8
8
 
9
9
  Cartoonist::Backup.for :comics do
10
- Comic.order(:id).all
10
+ Comic.order(:id)
11
11
  end
12
12
 
13
13
  Cartoonist::Sitemap.add do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cartoonist-comics
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9.1
4
+ version: 0.0.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,19 +9,19 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-20 00:00:00.000000000 Z
12
+ date: 2012-05-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cartoonist
16
- requirement: &18234840 !ruby/object:Gem::Requirement
16
+ requirement: &21009960 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - =
20
20
  - !ruby/object:Gem::Version
21
- version: 0.0.9
21
+ version: 0.0.10
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *18234840
24
+ version_requirements: *21009960
25
25
  description: This core plugin for Cartoonist adds comics.
26
26
  email: reasonnumber@gmail.com
27
27
  executables: []