11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/spree_wordsmith.rb', line 11
def self.activate
Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
Rails.env.production? ? require(c) : load(c)
end
if config = WORDSMITH_CONFIG[Rails.env.to_sym]
= config[:disqus]
Disqus::defaults[:account], Disqus::defaults[:api_key], Disqus::defaults[:developer] =
[:account], [:api_key], [:developer] if && ![:disable]
end
Spree::BaseController.class_eval do
helper WordsmithHelper
before_filter :render_page_if_exists
def render_page_if_exists
@page = Page.publish.find_by_permalink(params[:path]) if params[:path]
@page = Page.publish.find_by_permalink(request.path) unless @page
render :template => 'content/show' if @page
end
end
AppConfiguration.class_eval do
preference :wordsmith_permalink, :string, :default => 'blog'
preference :wordsmith_posts_per_page, :integer, :default => 5
preference :wordsmith_posts_recent, :integer, :default => 15
preference :wordsmith_post_comment_default, :integer, :default => 1
preference :wordsmith_post_status_default, :integer, :default => 0
preference :wordsmith_page_status_default, :integer, :default => 0
preference :wordsmith_page_comment_default, :integer, :default => 0
preference :wordsmith_rss_description, :string, :default => 'description about your main post rss.'
end
User.class_eval do
has_many :ws_items
attr_accessible :display_name
end
end
|