spree_cms 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. data/Gemfile +4 -0
  2. data/README.markdown +108 -0
  3. data/Rakefile +2 -0
  4. data/app/controllers/admin/cms_settings_controller.rb +11 -0
  5. data/app/controllers/admin/pages_controller.rb +54 -0
  6. data/app/controllers/admin/posts_controller.rb +55 -0
  7. data/app/controllers/pages_controller.rb +4 -0
  8. data/app/controllers/posts_controller.rb +26 -0
  9. data/app/helpers/cms_helper.rb +21 -0
  10. data/app/models/page.rb +38 -0
  11. data/app/models/post.rb +73 -0
  12. data/app/views/admin/cms_settings/edit.html.erb +40 -0
  13. data/app/views/admin/cms_settings/show.html.erb +42 -0
  14. data/app/views/admin/pages/_form.html.erb +51 -0
  15. data/app/views/admin/pages/edit.html.erb +7 -0
  16. data/app/views/admin/pages/index.html.erb +90 -0
  17. data/app/views/admin/pages/new.html.erb +28 -0
  18. data/app/views/admin/posts/_form.html.erb +66 -0
  19. data/app/views/admin/posts/_sub_menu.html.erb +7 -0
  20. data/app/views/admin/posts/edit.html.erb +9 -0
  21. data/app/views/admin/posts/index.html.erb +101 -0
  22. data/app/views/admin/posts/new.html.erb +45 -0
  23. data/app/views/admin/users/_display_name.html.erb +4 -0
  24. data/app/views/pages/show.html.erb +5 -0
  25. data/app/views/posts/_post.html.erb +13 -0
  26. data/app/views/posts/index.html.erb +14 -0
  27. data/app/views/posts/index.rss.builder +19 -0
  28. data/app/views/posts/show.html.erb +10 -0
  29. data/app/views/posts/tags.html.erb +18 -0
  30. data/app/views/shared/_cms_content_for.html.erb +7 -0
  31. data/app/views/shared/_recent_articles.html.erb +7 -0
  32. data/app/views/shared/_store_menu.html.erb +5 -0
  33. data/config/locales/en.yml +48 -0
  34. data/lib/extensions/string.rb +20 -0
  35. data/lib/generators/spree_cms/USAGE +8 -0
  36. data/lib/generators/spree_cms/install/install_generator.rb +40 -0
  37. data/lib/generators/spree_cms/install/templates/db/migrate/add_display_name_to_user.rb +9 -0
  38. data/lib/generators/spree_cms/install/templates/db/migrate/create_pages.rb +23 -0
  39. data/lib/generators/spree_cms/install/templates/db/migrate/create_posts.rb +26 -0
  40. data/lib/generators/spree_cms/install/templates/db/migrate/is_taggable_migration.rb +24 -0
  41. data/lib/generators/spree_cms/install/templates/public/images/icons/feed.gif +0 -0
  42. data/lib/generators/spree_cms/install/templates/public/stylesheets/sass/cms.sass +60 -0
  43. data/lib/spree_cms/version.rb +3 -0
  44. data/lib/spree_cms.rb +66 -0
  45. data/lib/spree_cms_hooks.rb +11 -0
  46. data/spree_cms.gemspec +25 -0
  47. metadata +154 -0
data/lib/spree_cms.rb ADDED
@@ -0,0 +1,66 @@
1
+ require 'spree_core'
2
+ require 'spree_cms_hooks'
3
+
4
+ module SpreeCms
5
+ class Engine < Rails::Engine
6
+
7
+ config.autoload_paths += %W(#{config.root}/lib)
8
+
9
+ initializer "cms" do
10
+ require 'extensions/string'
11
+ end
12
+
13
+ def self.activate
14
+
15
+ Disqus::defaults[:account] = "my_disqus_account_name"
16
+ # Optional, only if you're using the API
17
+ Disqus::defaults[:api_key] = "my_disqus_api_key"
18
+ Disqus::defaults[:developer] = (RAILS.env != "production")
19
+
20
+ Spree::BaseController.class_eval do
21
+ helper CmsHelper
22
+
23
+ before_filter :render_page_if_exists
24
+
25
+ def render_page_if_exists
26
+ # Using request.path allows us to override dynamic pages including
27
+ # the home page, product and taxon pages. params[:path] is only good
28
+ # for requests that get as far as content_controller. params[:path]
29
+ # query left in for backwards compatibility for slugs that don't start
30
+ # with a slash.
31
+ @page = Page.publish.find_by_permalink(params[:path]) if params[:path]
32
+ @page = Page.publish.find_by_permalink(request.path) unless @page
33
+ render :template => 'content/show' if @page
34
+ end
35
+
36
+ # Returns post.title for use in the <title> element.
37
+ def title_with_cms_post_check
38
+ return "#{@post.title} - #{Spree::Config[:site_name]}" if @post && !@post.title.blank?
39
+ title_without_cms_post_check
40
+ end
41
+ alias_method_chain :title, :cms_post_check
42
+
43
+ end
44
+
45
+ AppConfiguration.class_eval do
46
+ preference :cms_permalink, :string, :default => 'blog'
47
+ preference :cms_posts_per_page, :integer, :default => 5
48
+ preference :cms_posts_recent, :integer, :default => 15
49
+ preference :cms_post_comment_default, :integer, :default => 1
50
+ preference :cms_post_status_default, :integer, :default => 0
51
+ preference :cms_page_status_default, :integer, :default => 0
52
+ preference :cms_page_comment_default, :integer, :default => 0
53
+ preference :cms_rss_description, :string, :default => 'description about your main post rss.'
54
+ end
55
+
56
+ User.class_eval do
57
+ has_many :posts
58
+
59
+ attr_accessible :display_name
60
+ end
61
+
62
+ end
63
+
64
+ config.to_prepare &method(:activate).to_proc
65
+ end
66
+ end
@@ -0,0 +1,11 @@
1
+ class SpreeCmsHooks < Spree::ThemeSupport::HookListener
2
+ insert_after :admin_tabs do
3
+ %(<%= tab(:posts) %>)
4
+ end
5
+
6
+ insert_after :admin_tabs do
7
+ %(<%= tab(:pages) %>)
8
+ end
9
+
10
+ insert_after :admin_user_form_fields, "admin/users/display_name"
11
+ end
data/spree_cms.gemspec ADDED
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "spree_cms/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "spree_cms"
7
+ s.version = SpreeCms::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Gunner Technology, Cody Swann"]
10
+ s.email = ["developers@gunnertech.com"]
11
+ s.homepage = ""
12
+ s.summary = %q{Adds a simple CMS to your Spree Store with Disqus commenting}
13
+ s.description = %q{This gem will add simple Content Management System functionality like blog posts, pages and commenting to your spree store}
14
+
15
+ s.rubyforge_project = "spree_cms"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+
22
+ s.add_dependency('is_taggable', "~>0.1.0")
23
+ s.add_dependency("RedCloth", "~>4.2.7")
24
+ s.add_dependency("disqus", "~>1.0.4")
25
+ end
metadata ADDED
@@ -0,0 +1,154 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: spree_cms
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 3
9
+ version: 0.0.3
10
+ platform: ruby
11
+ authors:
12
+ - Gunner Technology, Cody Swann
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2011-03-01 00:00:00 -08:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: is_taggable
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
30
+ - 1
31
+ - 0
32
+ version: 0.1.0
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: RedCloth
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ segments:
44
+ - 4
45
+ - 2
46
+ - 7
47
+ version: 4.2.7
48
+ type: :runtime
49
+ version_requirements: *id002
50
+ - !ruby/object:Gem::Dependency
51
+ name: disqus
52
+ prerelease: false
53
+ requirement: &id003 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ~>
57
+ - !ruby/object:Gem::Version
58
+ segments:
59
+ - 1
60
+ - 0
61
+ - 4
62
+ version: 1.0.4
63
+ type: :runtime
64
+ version_requirements: *id003
65
+ description: This gem will add simple Content Management System functionality like blog posts, pages and commenting to your spree store
66
+ email:
67
+ - developers@gunnertech.com
68
+ executables: []
69
+
70
+ extensions: []
71
+
72
+ extra_rdoc_files: []
73
+
74
+ files:
75
+ - Gemfile
76
+ - README.markdown
77
+ - Rakefile
78
+ - app/controllers/admin/cms_settings_controller.rb
79
+ - app/controllers/admin/pages_controller.rb
80
+ - app/controllers/admin/posts_controller.rb
81
+ - app/controllers/pages_controller.rb
82
+ - app/controllers/posts_controller.rb
83
+ - app/helpers/cms_helper.rb
84
+ - app/models/page.rb
85
+ - app/models/post.rb
86
+ - app/views/admin/cms_settings/edit.html.erb
87
+ - app/views/admin/cms_settings/show.html.erb
88
+ - app/views/admin/pages/_form.html.erb
89
+ - app/views/admin/pages/edit.html.erb
90
+ - app/views/admin/pages/index.html.erb
91
+ - app/views/admin/pages/new.html.erb
92
+ - app/views/admin/posts/_form.html.erb
93
+ - app/views/admin/posts/_sub_menu.html.erb
94
+ - app/views/admin/posts/edit.html.erb
95
+ - app/views/admin/posts/index.html.erb
96
+ - app/views/admin/posts/new.html.erb
97
+ - app/views/admin/users/_display_name.html.erb
98
+ - app/views/pages/show.html.erb
99
+ - app/views/posts/_post.html.erb
100
+ - app/views/posts/index.html.erb
101
+ - app/views/posts/index.rss.builder
102
+ - app/views/posts/show.html.erb
103
+ - app/views/posts/tags.html.erb
104
+ - app/views/shared/_cms_content_for.html.erb
105
+ - app/views/shared/_recent_articles.html.erb
106
+ - app/views/shared/_store_menu.html.erb
107
+ - config/locales/en.yml
108
+ - lib/extensions/string.rb
109
+ - lib/generators/spree_cms/USAGE
110
+ - lib/generators/spree_cms/install/install_generator.rb
111
+ - lib/generators/spree_cms/install/templates/db/migrate/add_display_name_to_user.rb
112
+ - lib/generators/spree_cms/install/templates/db/migrate/create_pages.rb
113
+ - lib/generators/spree_cms/install/templates/db/migrate/create_posts.rb
114
+ - lib/generators/spree_cms/install/templates/db/migrate/is_taggable_migration.rb
115
+ - lib/generators/spree_cms/install/templates/public/images/icons/feed.gif
116
+ - lib/generators/spree_cms/install/templates/public/stylesheets/sass/cms.sass
117
+ - lib/spree_cms.rb
118
+ - lib/spree_cms/version.rb
119
+ - lib/spree_cms_hooks.rb
120
+ - spree_cms.gemspec
121
+ has_rdoc: true
122
+ homepage: ""
123
+ licenses: []
124
+
125
+ post_install_message:
126
+ rdoc_options: []
127
+
128
+ require_paths:
129
+ - lib
130
+ required_ruby_version: !ruby/object:Gem::Requirement
131
+ none: false
132
+ requirements:
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ segments:
136
+ - 0
137
+ version: "0"
138
+ required_rubygems_version: !ruby/object:Gem::Requirement
139
+ none: false
140
+ requirements:
141
+ - - ">="
142
+ - !ruby/object:Gem::Version
143
+ segments:
144
+ - 0
145
+ version: "0"
146
+ requirements: []
147
+
148
+ rubyforge_project: spree_cms
149
+ rubygems_version: 1.3.7
150
+ signing_key:
151
+ specification_version: 3
152
+ summary: Adds a simple CMS to your Spree Store with Disqus commenting
153
+ test_files: []
154
+