spree_essential_cms 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -1,7 +1,4 @@
1
- SpreeEssentialCms
2
- =================
3
-
4
- SpreeEssentialCms is a full featured CMS for managing pages and content on your [Spree](http://spreecommerce.com) site.
1
+ # Spree Essential CMS [![Build Status](https://secure.travis-ci.org/citrus/spree_essential_cms.png)](http://travis-ci.org/citrus/spree_essential_cms)
5
2
 
6
3
 
7
4
  Installation
@@ -11,17 +8,20 @@ If you don't already have an existing Spree site, [click here](https://gist.gith
11
8
 
12
9
  Otherwise, follow these steps to get up and running with SpreeEssentialCms:
13
10
 
14
- Add the necessary gems to your Gemfile:
11
+ Add spree_essential_cms to your Gemfile:
12
+
13
+ gem 'spree_essential_cms', '>= 0.2.0'
15
14
 
16
- gem 'spree_essentials', '~> 0.2.3'
17
- gem 'spree_essential_cms', '~> 0.1.2'
15
+ Now, bundle up with:
16
+
17
+ bundle install
18
18
 
19
- Run the generators to create the migration files.
19
+ Then run the generators to create the migration files:
20
20
 
21
21
  rails g spree_essentials:install
22
22
  rails g spree_essentials:cms
23
23
 
24
- Now migrate your database...
24
+ Now migrate your database:
25
25
 
26
26
  rake db:migrate
27
27
 
@@ -34,6 +34,11 @@ Boot your server and checkout the admin!
34
34
  Usage
35
35
  -----
36
36
 
37
+ [todo] add basic usage stuff here
38
+
39
+
40
+ ### Here's some tips for making content really customized...
41
+
37
42
 
38
43
  #### Contexts
39
44
 
@@ -108,9 +113,10 @@ You can easily use the test/dummy app as a demo of spree_essential_cms. Just `cd
108
113
  Change Log
109
114
  ----------
110
115
 
111
- **0.1.2 - 2012/1/6**
116
+ **0.2.0 - 2011/12/15**
112
117
 
113
- * Removed automatic attachment config with SpreeHeroku
118
+ * Add 0.70.x compatibility
119
+ * Removed spork dev dependency
114
120
 
115
121
 
116
122
  **0.1.1 - 2011/6/2**
@@ -154,4 +160,4 @@ If you'd like to help out feel free to fork and send me pull requests!
154
160
  License
155
161
  -------
156
162
 
157
- Copyright (c) 2011 Spencer Steffen, released under the New BSD License All rights reserved.
163
+ Copyright (c) 2011 Spencer Steffen & Citrus, released under the New BSD License All rights reserved.
@@ -36,4 +36,4 @@ body.one-col #content {
36
36
  .slideshow.slide {
37
37
  width: 950px;
38
38
  height: 250px;
39
- }
39
+ }
@@ -26,7 +26,7 @@ class ::Admin::ContentsController < ::Admin::ResourceController
26
26
  params[:search] ||= {}
27
27
  params[:search][:meta_sort] ||= "page.asc"
28
28
  @search = parent.contents.metasearch(params[:search])
29
- @collection = @search.paginate(:per_page => Spree::Config[:orders_per_page], :page => params[:page])
29
+ @collection = @search.page(params[:page]).per(Spree::Config[:orders_per_page])
30
30
  end
31
31
 
32
32
  end
@@ -35,7 +35,7 @@ class ::Admin::PagesController < ::Admin::ResourceController
35
35
  params[:search] ||= {}
36
36
  params[:search][:meta_sort] ||= "page.asc"
37
37
  @search = Page.metasearch(params[:search])
38
- @collection = @search.paginate(:per_page => Spree::Config[:orders_per_page], :page => params[:page])
38
+ @collection = @search.page(params[:page]).per(Spree::Config[:orders_per_page])
39
39
  end
40
40
 
41
41
  end
@@ -2,13 +2,24 @@ class Content < ActiveRecord::Base
2
2
 
3
3
  belongs_to :page
4
4
  validates_associated :page
5
- validates_presence_of :title
5
+ validates_presence_of :title, :page
6
6
 
7
7
  default_scope order(:position)
8
8
 
9
- has_attached_file :attachment,
10
- :styles => Proc.new{ |clip| clip.instance.attachment_sizes },
11
- :default_style => :preview
9
+ if defined?(SpreeHeroku)
10
+ has_attached_file :attachment,
11
+ :styles => Proc.new{ |clip| clip.instance.attachment_sizes },
12
+ :default_style => :preview,
13
+ :path => "assets/contents/:id/:style/:basename.:extension",
14
+ :storage => "s3",
15
+ :s3_credentials => "#{Rails.root}/config/s3.yml"
16
+ else
17
+ has_attached_file :attachment,
18
+ :styles => Proc.new{ |clip| clip.instance.attachment_sizes },
19
+ :default_style => :preview,
20
+ :url => "/assets/contents/:id/:style/:basename.:extension",
21
+ :path => ":rails_root/public/assets/contents/:id/:style/:basename.:extension"
22
+ end
12
23
 
13
24
 
14
25
  cattr_reader :per_page
@@ -1,15 +1,26 @@
1
- class PageImage < Asset
1
+ class PageImage < Image
2
2
 
3
3
  validate :no_attachement_errors
4
4
 
5
- has_attached_file :attachment,
6
- :styles => Proc.new{ |clip| clip.instance.attachment_sizes },
7
- :default_style => :medium
8
-
5
+ if defined?(SpreeHeroku)
6
+ has_attached_file :attachment,
7
+ :styles => Proc.new{ |clip| clip.instance.attachment_sizes },
8
+ :default_style => :medium,
9
+ :path => "assets/pages/:id/:style/:basename.:extension",
10
+ :storage => "s3",
11
+ :s3_credentials => "#{Rails.root}/config/s3.yml"
12
+ else
13
+ has_attached_file :attachment,
14
+ :styles => Proc.new{ |clip| clip.instance.attachment_sizes },
15
+ :default_style => :medium,
16
+ :url => "/assets/pages/:id/:style/:basename.:extension",
17
+ :path => ":rails_root/public/assets/pages/:id/:style/:basename.:extension"
18
+ end
19
+
9
20
  def image_content?
10
21
  attachment_content_type.match(/\/(jpeg|png|gif|tiff|x-photoshop)/)
11
22
  end
12
-
23
+
13
24
  def attachment_sizes
14
25
  sizes = {}
15
26
  sizes.merge!(:mini => '48x48>', :small => '150x150>', :medium => '420x300>', :large => '900x650>') if image_content?
@@ -35,7 +35,7 @@
35
35
  </tbody>
36
36
  </table>
37
37
 
38
- <%= will_paginate(@contents, :prev => "&#171; #{t('previous')}", :next => "#{t('next')} &#187;") %>
38
+ <%= paginate @collection %>
39
39
 
40
40
  <% content_for :sidebar do %>
41
41
 
@@ -44,16 +44,11 @@
44
44
 
45
45
  <% @content = Content.metasearch %>
46
46
  <%= form_for [:admin, @page, @content] do |f| %>
47
- <%- locals = {:f => f} %>
48
- <%= hook :admin_contents_index_search, locals do %>
49
- <p>
50
- <label><%= t('content.title') %></label><br />
51
- <%= f.text_field :title_like, :size => 25 %>
52
- </p>
53
- <% end %>
54
- <%= hook :admin_contents_index_search_buttons, locals do %>
55
- <p><%= button t("search") %></p>
56
- <% end %>
47
+ <p>
48
+ <label><%= t('content.title') %></label><br />
49
+ <%= f.text_field :title_like, :size => 25 %>
50
+ </p>
51
+ <p><%= button t("search") %></p>
57
52
  <% end %>
58
53
  </div>
59
54
  <% end %>
@@ -39,7 +39,7 @@
39
39
  </tbody>
40
40
  </table>
41
41
 
42
- <%= will_paginate(:prev => "&#171; #{t('previous')}", :next => "#{t('next')} &#187;") %>
42
+ <%= paginate @collection %>
43
43
 
44
44
  <% content_for :sidebar do %>
45
45
  <div class="box">
@@ -47,16 +47,11 @@
47
47
 
48
48
  <% @page = Page.metasearch %>
49
49
  <%= form_for [:admin, @page] do |f| %>
50
- <%- locals = {:f => f} %>
51
- <%= hook :admin_pages_index_search, locals do %>
52
- <p>
53
- <label><%= t '.title_contains' %></label><br />
54
- <%= f.text_field :title_contains, :size => 25 %>
55
- </p>
56
- <% end %>
57
- <%= hook :admin_pages_index_search_buttons, locals do %>
58
- <p><%= button t("search") %></p>
59
- <% end %>
50
+ <p>
51
+ <label><%= t '.title_contains' %></label><br />
52
+ <%= f.text_field :title_contains, :size => 25 %>
53
+ </p>
54
+ <p><%= button t("search") %></p>
60
55
  <% end %>
61
56
  </div>
62
57
  <% end %>
@@ -6,17 +6,15 @@
6
6
  <br clear="clear" />
7
7
 
8
8
  <ul class="sidebar post-menu">
9
- <%= hook :admin_page_tabs, {:current => current} do %>
10
- <li<%== ' class="active"' if current == t('.page_details') %>>
11
- <%= link_to t('.page_details'), edit_admin_page_url(@page) %>
12
- </li>
13
- <li<%== ' class="active"' if current == "Contents" %>>
14
- <%= link_to t('.contents'), admin_page_contents_url(@page) %>
15
- </li>
16
- <li<%== ' class="active"' if current == "Images" %>>
17
- <%= link_to t('.images'), admin_page_images_url(@page) %>
18
- </li>
19
- <% end %>
9
+ <li<%== ' class="active"' if current == t('.page_details') %>>
10
+ <%= link_to t('.page_details'), edit_admin_page_url(@page) %>
11
+ </li>
12
+ <li<%== ' class="active"' if current == "Contents" %>>
13
+ <%= link_to t('.contents'), admin_page_contents_url(@page) %>
14
+ </li>
15
+ <li<%== ' class="active"' if current == "Images" %>>
16
+ <%= link_to t('.images'), admin_page_images_url(@page) %>
17
+ </li>
20
18
  </ul>
21
19
  <br clear="clear" />
22
20
 
@@ -25,4 +25,4 @@
25
25
  <%= render :partial => 'news/articles/preview', :collection => @articles, :as => :article %>
26
26
  </div>
27
27
  <% end %>
28
- </div>
28
+ </div>
@@ -1,3 +1,3 @@
1
1
  <div class="for-<%= @page.to_param %>">
2
2
  <%= render :partial => 'shared/content', :collection => @page.contents %>
3
- </div>
3
+ </div>
@@ -4,4 +4,4 @@
4
4
  <li<%= ' class="active"'.html_safe if page.matches?(request.path) %>><%= link_to page.nav_title, page.path %></li>
5
5
  <% end %>
6
6
  </ul>
7
- <% end %>
7
+ <% end %>
@@ -5,4 +5,4 @@
5
5
  <%= image_tag image.attachment.url(size), :alt => image.alt %>
6
6
  <% end %>
7
7
  </div>
8
- <% end %>
8
+ <% end %>
@@ -14,4 +14,4 @@ module SpreeEssentials
14
14
 
15
15
  end
16
16
  end
17
- end
17
+ end
@@ -3,41 +3,31 @@ require 'spree_essentials'
3
3
  module SpreeEssentialCms
4
4
 
5
5
  def self.tab
6
- [ :pages ]
6
+ { :label => "Pages", :route => :admin_pages }
7
7
  end
8
8
 
9
9
  def self.sub_tab
10
10
  [ :pages, { :match_path => '/pages' }]
11
11
  end
12
12
 
13
- def self.independent?
14
- return true unless defined?(SpreeEssentials)
15
- !SpreeEssentials.respond_to?(:register)
16
- end
17
-
18
13
  class Engine < Rails::Engine
19
- config.autoload_paths += %W(#{config.root}/lib)
20
14
 
21
- initializer "static assets" do |app|
22
- app.middleware.insert_before ::Rack::Lock, ::ActionDispatch::Static, "#{config.root}/public"
23
- end
15
+ config.autoload_paths += %W(#{config.root}/lib)
24
16
 
25
- def self.activate
26
-
27
- Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator.rb")) do |c|
28
- Rails.env.production? ? require(c) : load(c)
17
+ config.to_prepare do
18
+ #loads application's model / class decorators
19
+ Dir.glob File.expand_path("../../app/**/*_decorator*.rb") do |c|
20
+ Rails.configuration.cache_classes ? require(c) : load(c)
29
21
  end
30
-
31
- end
32
22
 
33
- config.to_prepare &method(:activate).to_proc
23
+ #loads application's deface view overrides
24
+ Dir.glob File.expand_path("../../app/overrides/*.rb", __FILE__) do |c|
25
+ Rails.application.config.cache_classes ? require(c) : load(c)
26
+ end
27
+ end
34
28
 
35
29
  end
36
30
 
37
31
  end
38
32
 
39
- if SpreeEssentialCms.independent?
40
- require 'spree_essential_press/custom_hooks'
41
- else
42
- SpreeEssentials.register :cms, SpreeEssentialCms
43
- end
33
+ SpreeEssentials.register :cms, SpreeEssentialCms
@@ -1,3 +1,3 @@
1
1
  module SpreeEssentialCms
2
- VERSION = "0.1.2"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -22,7 +22,9 @@ namespace :db do
22
22
  home.contents.first.update_attributes(:body => Faker::Lorem.paragraphs().join("\n\n"), :context => "main")
23
23
  home.contents.create(:title => Faker::Lorem.words(3 + rand(3)).join(" "), :body => Faker::Lorem.sentence, :context => "intro")
24
24
 
25
- images.each {|image| home.images.create(:attachment => File.open(image), :alt => "Sailing") }
25
+ images.each {|image|
26
+ PageImage.create(:viewable => home, :attachment => File.open(image), :alt => "Sailing")
27
+ }
26
28
 
27
29
  %w(About Contact).each do |title|
28
30
  page = Page.create(:title => title, :path => title.downcase)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_essential_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,33 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-06 00:00:00.000000000Z
12
+ date: 2011-12-15 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: spree_essentials
16
- requirement: &70280302826960 !ruby/object:Gem::Requirement
16
+ requirement: &70103086805240 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ~>
19
+ - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: 0.2.3
21
+ version: 0.3.1
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70280302826960
25
- - !ruby/object:Gem::Dependency
26
- name: spree_sample
27
- requirement: &70280302826460 !ruby/object:Gem::Requirement
28
- none: false
29
- requirements:
30
- - - ~>
31
- - !ruby/object:Gem::Version
32
- version: 0.60.0
33
- type: :development
34
- prerelease: false
35
- version_requirements: *70280302826460
24
+ version_requirements: *70103086805240
36
25
  - !ruby/object:Gem::Dependency
37
26
  name: dummier
38
- requirement: &70280302825700 !ruby/object:Gem::Requirement
27
+ requirement: &70103086804360 !ruby/object:Gem::Requirement
39
28
  none: false
40
29
  requirements:
41
30
  - - ! '>='
@@ -43,73 +32,51 @@ dependencies:
43
32
  version: 0.2.4
44
33
  type: :development
45
34
  prerelease: false
46
- version_requirements: *70280302825700
35
+ version_requirements: *70103086804360
47
36
  - !ruby/object:Gem::Dependency
48
37
  name: shoulda
49
- requirement: &70280302825240 !ruby/object:Gem::Requirement
38
+ requirement: &70103086803620 !ruby/object:Gem::Requirement
50
39
  none: false
51
40
  requirements:
52
41
  - - ! '>='
53
42
  - !ruby/object:Gem::Version
54
- version: 2.11.3
43
+ version: 3.0.0.beta2
55
44
  type: :development
56
45
  prerelease: false
57
- version_requirements: *70280302825240
46
+ version_requirements: *70103086803620
58
47
  - !ruby/object:Gem::Dependency
59
48
  name: factory_girl
60
- requirement: &70280302824780 !ruby/object:Gem::Requirement
49
+ requirement: &70103086803140 !ruby/object:Gem::Requirement
61
50
  none: false
62
51
  requirements:
63
52
  - - ! '>='
64
53
  - !ruby/object:Gem::Version
65
- version: 2.0.0.beta4
54
+ version: 2.3.2
66
55
  type: :development
67
56
  prerelease: false
68
- version_requirements: *70280302824780
57
+ version_requirements: *70103086803140
69
58
  - !ruby/object:Gem::Dependency
70
59
  name: capybara
71
- requirement: &70280302824320 !ruby/object:Gem::Requirement
60
+ requirement: &70103086802500 !ruby/object:Gem::Requirement
72
61
  none: false
73
62
  requirements:
74
63
  - - ! '>='
75
64
  - !ruby/object:Gem::Version
76
- version: 1.0.0
65
+ version: 1.1.2
77
66
  type: :development
78
67
  prerelease: false
79
- version_requirements: *70280302824320
68
+ version_requirements: *70103086802500
80
69
  - !ruby/object:Gem::Dependency
81
70
  name: sqlite3
82
- requirement: &70280302823860 !ruby/object:Gem::Requirement
83
- none: false
84
- requirements:
85
- - - ! '>='
86
- - !ruby/object:Gem::Version
87
- version: 1.3.3
88
- type: :development
89
- prerelease: false
90
- version_requirements: *70280302823860
91
- - !ruby/object:Gem::Dependency
92
- name: spork
93
- requirement: &70280302823400 !ruby/object:Gem::Requirement
94
- none: false
95
- requirements:
96
- - - ! '>='
97
- - !ruby/object:Gem::Version
98
- version: 0.9.0.rc9
99
- type: :development
100
- prerelease: false
101
- version_requirements: *70280302823400
102
- - !ruby/object:Gem::Dependency
103
- name: spork-testunit
104
- requirement: &70280302822940 !ruby/object:Gem::Requirement
71
+ requirement: &70103086801820 !ruby/object:Gem::Requirement
105
72
  none: false
106
73
  requirements:
107
74
  - - ! '>='
108
75
  - !ruby/object:Gem::Version
109
- version: 0.0.5
76
+ version: 1.3.5
110
77
  type: :development
111
78
  prerelease: false
112
- version_requirements: *70280302822940
79
+ version_requirements: *70103086801820
113
80
  description: SpreeEssentialCms is a full featured content management system for Spree
114
81
  Commerce. It's designed to be used with the spree_essentials base.
115
82
  email:
@@ -122,7 +89,6 @@ files:
122
89
  - LICENSE
123
90
  - config/locales/en.yml
124
91
  - config/routes.rb
125
- - lib/generators/essentials_base.rb
126
92
  - lib/generators/spree_essentials/cms_generator.rb
127
93
  - lib/generators/templates/db/migrate/create_contents.rb
128
94
  - lib/generators/templates/db/migrate/create_pages.rb
@@ -132,6 +98,7 @@ files:
132
98
  - lib/tasks/sample/sailing2.jpg
133
99
  - lib/tasks/sample/sailing3.jpg
134
100
  - lib/tasks/sample.rake
101
+ - app/assets/stylesheets/essentials/cms.css
135
102
  - app/controllers/admin/contents_controller.rb
136
103
  - app/controllers/admin/page_images_controller.rb
137
104
  - app/controllers/admin/pages_controller.rb
@@ -161,7 +128,6 @@ files:
161
128
  - app/views/shared/_content.html.erb
162
129
  - app/views/shared/_main_menu.html.erb
163
130
  - app/views/shared/_slideshow.html.erb
164
- - public/stylesheets/essentials/cms.css
165
131
  - Rakefile
166
132
  homepage: http://github.com/citrus/spree_essential_cms
167
133
  licenses: []
@@ -177,7 +143,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
177
143
  version: '0'
178
144
  segments:
179
145
  - 0
180
- hash: 239260853434187353
146
+ hash: -660690764498914347
181
147
  required_rubygems_version: !ruby/object:Gem::Requirement
182
148
  none: false
183
149
  requirements:
@@ -186,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
186
152
  version: '0'
187
153
  segments:
188
154
  - 0
189
- hash: 239260853434187353
155
+ hash: -660690764498914347
190
156
  requirements: []
191
157
  rubyforge_project:
192
158
  rubygems_version: 1.8.10
@@ -1,23 +0,0 @@
1
- module SpreeEssentials
2
- module Generators
3
- class EssentialsBase < Rails::Generators::Base
4
-
5
- include Rails::Generators::Migration
6
-
7
- def self.count!
8
- @count ||= 0
9
- (@count += 1) * 3
10
- end
11
-
12
- def self.next_migration_number(path)
13
- @time ||= Time.new.utc
14
- if ActiveRecord::Base.timestamped_migrations
15
- (@time + self.count!).strftime("%Y%m%d%H%M%S")
16
- else
17
- "%.3d" % (current_migration_number(dirname) + 1)
18
- end
19
- end
20
-
21
- end
22
- end
23
- end