aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorUģis Ozols <ugis.ozolss@gmail.com>2012-02-04 21:22:51 +0200
committerUģis Ozols <ugis.ozolss@gmail.com>2012-02-04 21:22:51 +0200
commit34fd7b7b89da669b09cbd910cea109ff106bd85f (patch)
tree6a61422c88ce095a2ac9ab17a7f1ddf324c9dad7 /app/models
parent6cfebfae84491e4aa9aed8f3a7c019431dbb39c0 (diff)
downloadrefinerycms-blog-34fd7b7b89da669b09cbd910cea109ff106bd85f.tar.gz
refinerycms-blog-34fd7b7b89da669b09cbd910cea109ff106bd85f.tar.bz2
refinerycms-blog-34fd7b7b89da669b09cbd910cea109ff106bd85f.zip
Move some of the Refinery::Setting's over to Refinery::Blog.
Diffstat (limited to 'app/models')
-rw-r--r--app/models/refinery/blog/category.rb8
-rw-r--r--app/models/refinery/blog/comment.rb2
-rw-r--r--app/models/refinery/blog/post.rb23
3 files changed, 12 insertions, 21 deletions
diff --git a/app/models/refinery/blog/category.rb b/app/models/refinery/blog/category.rb
index dc85b50..55557c5 100644
--- a/app/models/refinery/blog/category.rb
+++ b/app/models/refinery/blog/category.rb
@@ -10,16 +10,16 @@ module Refinery
validates :title, :presence => true, :uniqueness => true
has_friendly_id :title, :use_slug => true,
- :default_locale => (::Refinery::I18n.default_frontend_locale rescue :en),
- :approximate_ascii => Refinery::Setting.find_or_set(:approximate_ascii, false, :scoping => 'blog'),
- :strip_non_ascii => Refinery::Setting.find_or_set(:strip_non_ascii, false, :scoping => 'blog')
+ :default_locale => (Refinery::I18n.default_frontend_locale rescue :en),
+ :approximate_ascii => Refinery::Blog.approximate_ascii,
+ :strip_non_ascii => Refinery::Blog.strip_non_ascii
def post_count
posts.select(&:live?).count
end
# how many items to show per page
- self.per_page = Refinery::Setting.find_or_set(:blog_posts_per_page, 10)
+ self.per_page = Refinery::Blog.posts_per_page
end
end
diff --git a/app/models/refinery/blog/comment.rb b/app/models/refinery/blog/comment.rb
index d2e9028..9187306 100644
--- a/app/models/refinery/blog/comment.rb
+++ b/app/models/refinery/blog/comment.rb
@@ -31,7 +31,7 @@ module Refinery
end
end
- self.per_page = Refinery::Setting.find_or_set(:blog_comments_per_page, 10)
+ self.per_page = Refinery::Blog.comments_per_page
def avatar_url(options = {})
options = {:size => 60}
diff --git a/app/models/refinery/blog/post.rb b/app/models/refinery/blog/post.rb
index 5c1c6c5..822ddf7 100644
--- a/app/models/refinery/blog/post.rb
+++ b/app/models/refinery/blog/post.rb
@@ -23,22 +23,22 @@ module Refinery
validates :title, :presence => true, :uniqueness => true
validates :body, :presence => true
- validates :source_url, :url => { :if => 'Refinery::Blog.config.validate_source_url',
+ validates :source_url, :url => { :if => 'Refinery::Blog.validate_source_url',
:update => true,
:allow_nil => true,
:allow_blank => true,
:verify => [:resolve_redirects]}
has_friendly_id :friendly_id_source, :use_slug => true,
- :default_locale => (::Refinery::I18n.default_frontend_locale rescue :en),
- :approximate_ascii => Refinery::Setting.find_or_set(:approximate_ascii, false, :scoping => 'blog'),
- :strip_non_ascii => Refinery::Setting.find_or_set(:strip_non_ascii, false, :scoping => 'blog')
+ :default_locale => (Refinery::I18n.default_frontend_locale rescue :en),
+ :approximate_ascii => Refinery::Blog.approximate_ascii,
+ :strip_non_ascii => Refinery::Blog.strip_non_ascii
attr_accessible :title, :body, :custom_teaser, :tag_list, :draft, :published_at, :custom_url, :author
attr_accessible :browser_title, :meta_keywords, :meta_description, :user_id, :category_ids
attr_accessible :source_url, :source_url_title
- self.per_page = Refinery::Setting.find_or_set(:blog_posts_per_page, 10)
+ self.per_page = Refinery::Blog.posts_per_page
def next
self.class.next(self).first
@@ -108,17 +108,8 @@ module Refinery
end
module ShareThis
- DEFAULT_KEY = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
-
- class << self
- def key
- Refinery::Setting.find_or_set(:share_this_key, Blog::Post::ShareThis::DEFAULT_KEY, :scoping => 'blog')
- end
-
- def enabled?
- key = Blog::Post::ShareThis.key
- key.present? and key != Blog::Post::ShareThis::DEFAULT_KEY
- end
+ def self.enabled?
+ Refinery::Blog.share_this_key != "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
end
end