Added ability to disable teaser independent of teaser length
I prefer full length articles at all times on blogs and don't like teasers. I added the ability for people to disable teasers so full articles will be shown by default. The teasers can e enabled just like comments from the admin page or trough the normal settings. However not sure if the post partial now is conform standards. Maybe the helper method "blog_post_teaser" could encapsulate the check which is now done in the view and return the full length article instead of a teaser if the teasers are disabled.
This commit is contained in:
parent
0e4dbb28e9
commit
8d031ed0c7
7 changed files with 62 additions and 2 deletions
|
@ -75,6 +75,19 @@ class BlogPost < ActiveRecord::Base
|
|||
:scoping => 'blog'
|
||||
})
|
||||
end
|
||||
|
||||
def teasers_enabled?
|
||||
RefinerySetting.find_or_set(:teasers_enabled, true, {
|
||||
:scoping => 'blog'
|
||||
})
|
||||
end
|
||||
|
||||
def teaser_enabled_toggle!
|
||||
currently = RefinerySetting.find_or_set(:teasers_enabled, true, {
|
||||
:scoping => 'blog'
|
||||
})
|
||||
RefinerySetting.set(:teasers_enabled, {:value => !currently, :scoping => 'blog'})
|
||||
end
|
||||
|
||||
def uncategorized
|
||||
BlogPost.live.reject { |p| p.categories.any? }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue