cartoonist-blog 0.0.9 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,16 +1,20 @@
1
1
  class BlogController < CartoonistController
2
2
  def archives
3
3
  @posts = BlogPost.archives
4
- render :layout => "blog_archives"
5
- cache_page_as "blog/archives.#{cache_type}.tmp.html"
4
+
5
+ cache_page_as "blog/archives.#{cache_type}.tmp.html" do
6
+ render :layout => "blog_archives"
7
+ end
6
8
  end
7
9
 
8
10
  def show
9
11
  @post = BlogPost.from_url_title params[:id]
10
12
  @disabled_prev = @post.oldest?
11
13
  @disabled_next = @post.newest?
12
- render
13
- cache_show_page
14
+
15
+ cache_page_as show_page_cache_path do
16
+ render
17
+ end
14
18
  rescue
15
19
  redirect_to "/blog"
16
20
  end
@@ -20,9 +24,11 @@ class BlogController < CartoonistController
20
24
  @disabled_prev = true if @post.oldest?
21
25
  @disabled_next = true
22
26
  @title = "Blog for #{Setting[:site_name]}"
23
- render :show
24
- cache_page_as ".#{cache_type}.tmp.html" if Cartoonist::RootPath.current_key == :blog
25
- cache_page_as "blog.#{cache_type}.tmp.html"
27
+
28
+ cache_page_as "blog.#{cache_type}.tmp.html" do
29
+ render :show
30
+ cache_page_as ".#{cache_type}.tmp.html" if Cartoonist::RootPath.current_key == :blog
31
+ end
26
32
  end
27
33
 
28
34
  def feed
@@ -49,11 +55,11 @@ class BlogController < CartoonistController
49
55
  @@blog_cache ||= ActiveSupport::Cache::MemoryStore.new(:expires_in => 2.hours)
50
56
  end
51
57
 
52
- def cache_show_page
58
+ def show_page_cache_path
53
59
  if @disabled_next
54
- cache_page_as "blog/#{@post.url_title}.#{cache_type}.tmp.html"
60
+ "blog/#{@post.url_title}.#{cache_type}.tmp.html"
55
61
  else
56
- cache_page_as "blog/#{@post.url_title}.#{cache_type}.html"
62
+ "blog/#{@post.url_title}.#{cache_type}.html"
57
63
  end
58
64
  end
59
65
  end
@@ -21,7 +21,7 @@ class BlogFeed
21
21
 
22
22
  def initialize(post)
23
23
  @title = post.title
24
- @content = Markdown.render post.content, false
24
+ @content = Markdown.render post.content, :html_safe => false, :link_to_absolute => true
25
25
  @url_title = post.url_title
26
26
  @pub_date = post.posted_at.localtime.strftime "%a, %d %b %Y %H:%M:00 %z"
27
27
  end
@@ -9,6 +9,12 @@ class BlogPost < ActiveRecord::Base
9
9
  attr_accessor :for_preview
10
10
  attr_accessible :title, :url_title, :author, :posted_at, :content, :locked
11
11
 
12
+ def to_backup_entries
13
+ post = Backup::Entry.new id, url_title, "markdown", content
14
+ meta = Backup::Entry.new id, "#{url_title}.meta", "json", to_json(:except => :content)
15
+ [post, meta]
16
+ end
17
+
12
18
  def url
13
19
  "/blog/#{url_title}"
14
20
  end
@@ -7,7 +7,7 @@ module CartoonistBlog
7
7
  Cartoonist::Migration.add_for self
8
8
 
9
9
  Cartoonist::Backup.for :blog_posts do
10
- BlogPost.order(:id).all
10
+ BlogPost.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-blog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
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-15 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: &15371600 !ruby/object:Gem::Requirement
16
+ requirement: &16264880 !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: *15371600
24
+ version_requirements: *16264880
25
25
  description: This core plugin for Cartoonist adds a simple blog.
26
26
  email: reasonnumber@gmail.com
27
27
  executables: []