diff options
author | Uģis Ozols <ugis.ozolss@gmail.com> | 2012-02-04 21:22:51 +0200 |
---|---|---|
committer | Uģis Ozols <ugis.ozolss@gmail.com> | 2012-02-04 21:22:51 +0200 |
commit | 34fd7b7b89da669b09cbd910cea109ff106bd85f (patch) | |
tree | 6a61422c88ce095a2ac9ab17a7f1ddf324c9dad7 /app | |
parent | 6cfebfae84491e4aa9aed8f3a7c019431dbb39c0 (diff) | |
download | refinerycms-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')
-rw-r--r-- | app/helpers/refinery/blog/posts_helper.rb | 2 | ||||
-rw-r--r-- | app/mailers/refinery/blog/comment_mailer.rb | 2 | ||||
-rw-r--r-- | app/models/refinery/blog/category.rb | 8 | ||||
-rw-r--r-- | app/models/refinery/blog/comment.rb | 2 | ||||
-rw-r--r-- | app/models/refinery/blog/post.rb | 23 | ||||
-rw-r--r-- | app/views/refinery/blog/comment_mailer/notification.html.erb | 2 | ||||
-rw-r--r-- | app/views/refinery/blog/posts/index.html.erb | 6 | ||||
-rw-r--r-- | app/views/refinery/blog/posts/index.rss.builder | 4 |
8 files changed, 20 insertions, 29 deletions
diff --git a/app/helpers/refinery/blog/posts_helper.rb b/app/helpers/refinery/blog/posts_helper.rb index ee19cec..4847ab2 100644 --- a/app/helpers/refinery/blog/posts_helper.rb +++ b/app/helpers/refinery/blog/posts_helper.rb @@ -22,7 +22,7 @@ module Refinery post.custom_teaser.html_safe else truncate(post.body, { - :length => Refinery::Setting.find_or_set(:blog_post_teaser_length, 250), + :length => Refinery::Blog.post_teaser_length, :preserve_html_tags => true }).html_safe end diff --git a/app/mailers/refinery/blog/comment_mailer.rb b/app/mailers/refinery/blog/comment_mailer.rb index 5b0ce7a..d868354 100644 --- a/app/mailers/refinery/blog/comment_mailer.rb +++ b/app/mailers/refinery/blog/comment_mailer.rb @@ -6,7 +6,7 @@ module Refinery @comment = comment mail :subject => Blog::Comment::Notification.subject, :recipients => Blog::Comment::Notification.recipients, - :from => "\"#{Refinery::Core.config.site_name}\" <no-reply@#{request.domain}>" + :from => "\"#{Refinery::Core.site_name}\" <no-reply@#{request.domain}>" end end 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 diff --git a/app/views/refinery/blog/comment_mailer/notification.html.erb b/app/views/refinery/blog/comment_mailer/notification.html.erb index a129d34..8bf642e 100644 --- a/app/views/refinery/blog/comment_mailer/notification.html.erb +++ b/app/views/refinery/blog/comment_mailer/notification.html.erb @@ -12,6 +12,6 @@ <%=raw t('.comment_ends') %> <%=raw t('.closing_line') %>, -<%=raw Refinery::Core.config.site_name %> +<%=raw Refinery::Core.site_name %> <%=raw t('.ps') %> diff --git a/app/views/refinery/blog/posts/index.html.erb b/app/views/refinery/blog/posts/index.html.erb index 36c007b..2e8837c 100644 --- a/app/views/refinery/blog/posts/index.html.erb +++ b/app/views/refinery/blog/posts/index.html.erb @@ -1,5 +1,5 @@ <% content_for :body_content_left do %> - <%= raw @page.content_for(::Refinery::Pages.config.default_parts.first.to_sym) if ::Refinery::Pages.config.default_parts.any? %> + <%= raw @page.content_for(Refinery::Pages.default_parts.first.to_sym) if Refinery::Pages.default_parts.any? %> <% if @posts.any? %> <section id="blog_posts"> @@ -12,8 +12,8 @@ <% end %> <% content_for :body_content_right_prepend do -%> - <%= raw @page.content_for(::Refinery::Pages.config.default_parts.second.to_sym) %> -<% end if ::Refinery::Pages.config.default_parts.many? -%> + <%= raw @page.content_for(Refinery::Pages.default_parts.second.to_sym) %> +<% end if Refinery::Pages.default_parts.many? -%> <%= render :partial => '/refinery/blog/shared/body_content_right' %> <%= render :partial => "/refinery/content_page" %> diff --git a/app/views/refinery/blog/posts/index.rss.builder b/app/views/refinery/blog/posts/index.rss.builder index 867c6d6..8ffacd4 100644 --- a/app/views/refinery/blog/posts/index.rss.builder +++ b/app/views/refinery/blog/posts/index.rss.builder @@ -1,8 +1,8 @@ xml.instruct! :xml, :version => "1.0" xml.rss :version => "2.0" do xml.channel do - xml.title Refinery::Core.config.site_name - xml.description Refinery::Core.config.site_name + " Blog Posts" + xml.title Refinery::Core.site_name + xml.description Refinery::Core.site_name + " Blog Posts" xml.link refinery.blog_root_url @posts.each do |post| |