From db77e492c6f96c2fb7544ccde9241ca2434effef Mon Sep 17 00:00:00 2001
From: djones
Date: Tue, 14 Sep 2010 15:26:10 +1200
Subject: added built in ShareThis.com support
---
app/models/blog_post.rb | 17 +++++++++++++++++
app/views/blog/posts/show.html.erb | 13 +++++++++++++
2 files changed, 30 insertions(+)
diff --git a/app/models/blog_post.rb b/app/models/blog_post.rb
index ad31778..0470cf7 100644
--- a/app/models/blog_post.rb
+++ b/app/models/blog_post.rb
@@ -31,5 +31,22 @@ class BlogPost < ActiveRecord::Base
})
end
end
+
+ module ShareThis
+ DEFAULT_KEY = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
+
+ class << self
+ def key
+ RefinerySetting.find_or_set(:share_this_key, BlogPost::ShareThis::DEFAULT_KEY, {
+ :scoping => :blog
+ })
+ end
+
+ def enabled?
+ key = BlogPost::ShareThis.key
+ key.present? and key != BlogPost::ShareThis::DEFAULT_KEY
+ end
+ end
+ end
end
diff --git a/app/views/blog/posts/show.html.erb b/app/views/blog/posts/show.html.erb
index 163b6b3..ed2c082 100644
--- a/app/views/blog/posts/show.html.erb
+++ b/app/views/blog/posts/show.html.erb
@@ -1,3 +1,12 @@
+<% content_for :head do %>
+ <% if BlogPost::ShareThis.enabled? %>
+
+
+ <% end %>
+<% end %>
+
<% content_for :body_content_title, @blog_post.title %>
<% content_for :body_content_left do %>
@@ -15,6 +24,10 @@
<%= @blog_post.body %>
+ <% if BlogPost::ShareThis.enabled? %>
+
+ <% end %>
+
<% if BlogPost.comments_allowed? %>
<%= t('.comments.title') %>
--
cgit v1.2.3