spree_essential_cms 0.1.0 → 0.1.2
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/LICENSE +21 -17
- data/README.md +82 -3
- data/app/controllers/admin/contents_controller.rb +11 -20
- data/app/controllers/admin/page_images_controller.rb +1 -2
- data/app/controllers/admin/pages_controller.rb +20 -17
- data/app/controllers/page_controller.rb +1 -1
- data/app/controllers/pages_controller.rb +3 -3
- data/app/controllers/spree_base_controller_decorator.rb +4 -3
- data/app/models/content.rb +4 -14
- data/app/models/page.rb +9 -5
- data/app/models/page_image.rb +7 -18
- data/app/views/admin/contents/_form.html.erb +6 -6
- data/app/views/admin/page_images/_form.html.erb +1 -1
- data/app/views/admin/page_images/index.html.erb +2 -0
- data/app/views/admin/pages/new.html.erb +1 -1
- data/app/views/pages/home.html.erb +1 -1
- data/app/views/shared/_content.html.erb +3 -2
- data/config/locales/en.yml +2 -0
- data/config/routes.rb +1 -1
- data/lib/spree_essential_cms.rb +2 -2
- data/lib/spree_essential_cms/version.rb +1 -1
- data/lib/tasks/sample.rake +36 -0
- data/lib/tasks/sample/sailing.jpg +0 -0
- data/lib/tasks/sample/sailing2.jpg +0 -0
- data/lib/tasks/sample/sailing3.jpg +0 -0
- data/public/stylesheets/essentials/cms.css +39 -0
- metadata +93 -132
- data/lib/dummy_hooks/after_migrate.rb +0 -1
- data/lib/dummy_hooks/after_migrate.rb.sample +0 -1
- data/lib/dummy_hooks/before_migrate.rb +0 -6
data/LICENSE
CHANGED
@@ -1,23 +1,27 @@
|
|
1
|
-
|
1
|
+
Copyright (c) 2011 Spencer Steffen and Citrus Media Group.
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without modification,
|
2
5
|
are permitted provided that the following conditions are met:
|
3
6
|
|
4
|
-
* Redistributions of source code must retain the above copyright notice,
|
7
|
+
* Redistributions of source code must retain the above copyright notice,
|
5
8
|
this list of conditions and the following disclaimer.
|
6
|
-
|
7
|
-
|
9
|
+
|
10
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
11
|
+
this list of conditions and the following disclaimer in the documentation
|
8
12
|
and/or other materials provided with the distribution.
|
9
|
-
|
10
|
-
|
13
|
+
|
14
|
+
* Neither the name of Citrus Media Group nor the names of its
|
15
|
+
contributors may be used to endorse or promote products derived from this
|
11
16
|
software without specific prior written permission.
|
12
17
|
|
13
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
18
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
19
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
20
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
21
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
22
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
23
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
24
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
25
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
26
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
27
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
CHANGED
@@ -11,10 +11,10 @@ If you don't already have an existing Spree site, [click here](https://gist.gith
|
|
11
11
|
|
12
12
|
Otherwise, follow these steps to get up and running with SpreeEssentialCms:
|
13
13
|
|
14
|
-
Add the necessary gems to your Gemfile
|
14
|
+
Add the necessary gems to your Gemfile:
|
15
15
|
|
16
|
-
gem 'spree_essentials',
|
17
|
-
gem 'spree_essential_cms',
|
16
|
+
gem 'spree_essentials', '~> 0.2.3'
|
17
|
+
gem 'spree_essential_cms', '~> 0.1.2'
|
18
18
|
|
19
19
|
Run the generators to create the migration files.
|
20
20
|
|
@@ -29,6 +29,67 @@ Boot your server and checkout the admin!
|
|
29
29
|
|
30
30
|
rails s
|
31
31
|
|
32
|
+
|
33
|
+
|
34
|
+
Usage
|
35
|
+
-----
|
36
|
+
|
37
|
+
|
38
|
+
#### Contexts
|
39
|
+
|
40
|
+
Contexts allow you to place different forms of content in various places of a page. A slideshow or a sidebar might be good examples...
|
41
|
+
|
42
|
+
You can set a content's context (say that ten times fast!) under the 'Optional Fields' tab in the edit content view.
|
43
|
+
|
44
|
+
In your view you'll be able to grab those bits of content like so:
|
45
|
+
|
46
|
+
|
47
|
+
.slideshow
|
48
|
+
- if @slides = @page.for_context('slideshow')
|
49
|
+
= render 'shared/content', :content => @slides
|
50
|
+
|
51
|
+
- if @sidebar = @page.for_context('sidebar').first
|
52
|
+
- content_for :sidebar do
|
53
|
+
= render 'shared/your_custom_sidebar', :content => @sidebar
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
#### Custom image sizes
|
59
|
+
|
60
|
+
Use a content decorator when you want different contexts to have their own image sizes:
|
61
|
+
|
62
|
+
|
63
|
+
Content.class_eval do
|
64
|
+
|
65
|
+
# override default image sizes
|
66
|
+
def default_attachment_sizes
|
67
|
+
{ :mini => '48x48>', :medium => '427x287>' }
|
68
|
+
end
|
69
|
+
|
70
|
+
# or set a custom size for each context
|
71
|
+
def attachment_sizes
|
72
|
+
case context
|
73
|
+
when 'slideshow'
|
74
|
+
sizes = default_attachment_sizes.merge(:slide => '955x476#')
|
75
|
+
when 'main'
|
76
|
+
sizes = default_attachment_sizes.merge(:custom => '580x289#')
|
77
|
+
when 'small-top'
|
78
|
+
sizes = default_attachment_sizes.merge(:custom => '364x177#')
|
79
|
+
when 'small-bottom'
|
80
|
+
sizes = default_attachment_sizes.merge(:custom => '364x109#')
|
81
|
+
else
|
82
|
+
sizes = default_attachment_sizes
|
83
|
+
end
|
84
|
+
sizes
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
32
93
|
|
33
94
|
Demo
|
34
95
|
----
|
@@ -47,6 +108,23 @@ You can easily use the test/dummy app as a demo of spree_essential_cms. Just `cd
|
|
47
108
|
Change Log
|
48
109
|
----------
|
49
110
|
|
111
|
+
**0.1.2 - 2012/1/6**
|
112
|
+
|
113
|
+
* Removed automatic attachment config with SpreeHeroku
|
114
|
+
|
115
|
+
|
116
|
+
**0.1.1 - 2011/6/2**
|
117
|
+
|
118
|
+
* Added the image_size option `shared/_content.html.erb`
|
119
|
+
* Improved documentation
|
120
|
+
|
121
|
+
|
122
|
+
**0.1.0 - 2011/6/1**
|
123
|
+
|
124
|
+
* Random cleanup
|
125
|
+
* Released 0.1.0 to rubygems
|
126
|
+
|
127
|
+
|
50
128
|
**2011/4/26**
|
51
129
|
|
52
130
|
* Extracted from the Spree Essentials core.
|
@@ -56,6 +134,7 @@ To Do
|
|
56
134
|
-----
|
57
135
|
|
58
136
|
* more tests... many many more.
|
137
|
+
* optimizations
|
59
138
|
* A 'create translation' button that clones the current page's contents into another language
|
60
139
|
* add widgets that you can drop into any page
|
61
140
|
* page and menu caching/sweeping
|
@@ -1,41 +1,32 @@
|
|
1
|
-
class Admin::ContentsController < Admin::
|
1
|
+
class ::Admin::ContentsController < ::Admin::ResourceController
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
create.response do |wants|
|
7
|
-
wants.html { redirect_to collection_url }
|
8
|
-
end
|
3
|
+
before_filter :load_resource
|
4
|
+
before_filter :parent, :only => :index
|
9
5
|
|
10
|
-
|
11
|
-
wants.html { redirect_to collection_url }
|
12
|
-
end
|
6
|
+
belongs_to :page
|
13
7
|
|
14
8
|
def update_positions
|
15
|
-
@page =
|
9
|
+
@page = parent
|
16
10
|
params[:positions].each do |id, index|
|
17
11
|
@page.contents.update_all(['position=?', index], ['id=?', id])
|
18
12
|
end
|
19
|
-
|
20
13
|
respond_to do |format|
|
21
14
|
format.html { redirect_to admin_page_contents_url(@oage) }
|
22
15
|
format.js { render :text => 'Ok' }
|
23
16
|
end
|
24
17
|
end
|
25
|
-
|
26
|
-
destroy.success.wants.js { render_js_for_destroy }
|
27
|
-
|
18
|
+
|
28
19
|
private
|
29
20
|
|
30
|
-
def
|
31
|
-
|
21
|
+
def parent
|
22
|
+
@page ||= Page.find_by_path(params[:page_id])
|
32
23
|
end
|
33
|
-
|
24
|
+
|
34
25
|
def collection
|
35
26
|
params[:search] ||= {}
|
36
27
|
params[:search][:meta_sort] ||= "page.asc"
|
37
|
-
@search =
|
28
|
+
@search = parent.contents.metasearch(params[:search])
|
38
29
|
@collection = @search.paginate(:per_page => Spree::Config[:orders_per_page], :page => params[:page])
|
39
30
|
end
|
40
31
|
|
41
|
-
end
|
32
|
+
end
|
@@ -10,7 +10,6 @@ class Admin::PageImagesController < Admin::ResourceController
|
|
10
10
|
params[:positions].each do |id, index|
|
11
11
|
PageImage.update_all(['position=?', index], ['id=?', id])
|
12
12
|
end
|
13
|
-
|
14
13
|
respond_to do |format|
|
15
14
|
format.js { render :text => 'Ok' }
|
16
15
|
end
|
@@ -34,4 +33,4 @@ class Admin::PageImagesController < Admin::ResourceController
|
|
34
33
|
@viewable = @page_image.viewable
|
35
34
|
end
|
36
35
|
|
37
|
-
end
|
36
|
+
end
|
@@ -1,38 +1,41 @@
|
|
1
|
-
class Admin::PagesController < Admin::
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
class ::Admin::PagesController < ::Admin::ResourceController
|
2
|
+
|
3
|
+
before_filter :load_resource
|
4
|
+
|
5
|
+
def index
|
6
|
+
@pages = collection
|
6
7
|
end
|
7
|
-
|
8
|
-
|
9
|
-
|
8
|
+
|
9
|
+
def location_after_save
|
10
|
+
case params[:action]
|
11
|
+
when "create"
|
12
|
+
edit_admin_page_content_path(@page, @page.contents.first)
|
13
|
+
else
|
14
|
+
admin_page_path(@page)
|
15
|
+
end
|
10
16
|
end
|
11
17
|
|
12
|
-
destroy.success.wants.js { render_js_for_destroy }
|
13
|
-
|
14
18
|
def update_positions
|
15
19
|
params[:positions].each do |id, index|
|
16
20
|
Page.update_all(['position=?', index], ['id=?', id])
|
17
21
|
end
|
18
|
-
|
19
22
|
respond_to do |format|
|
20
|
-
format.html { redirect_to
|
23
|
+
format.html { redirect_to admin_pages_path }
|
21
24
|
format.js { render :text => 'Ok' }
|
22
25
|
end
|
23
26
|
end
|
24
27
|
|
25
28
|
private
|
26
29
|
|
27
|
-
def
|
28
|
-
@
|
30
|
+
def find_resource
|
31
|
+
@page ||= Page.find_by_path(params[:id])
|
29
32
|
end
|
30
33
|
|
31
34
|
def collection
|
32
35
|
params[:search] ||= {}
|
33
36
|
params[:search][:meta_sort] ||= "page.asc"
|
34
|
-
@search =
|
35
|
-
@collection = @search.
|
37
|
+
@search = Page.metasearch(params[:search])
|
38
|
+
@collection = @search.paginate(:per_page => Spree::Config[:orders_per_page], :page => params[:page])
|
36
39
|
end
|
37
40
|
|
38
|
-
end
|
41
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class PagesController <
|
1
|
+
class PagesController < Spree::BaseController
|
2
2
|
|
3
3
|
before_filter :get_page, :only => :show
|
4
4
|
|
@@ -13,8 +13,8 @@ class PagesController < ApplicationController
|
|
13
13
|
private
|
14
14
|
|
15
15
|
def get_page
|
16
|
-
@page = Page.active.find_by_path(page_path) rescue nil
|
17
|
-
|
16
|
+
@page = Page.includes(:images, :contents).active.find_by_path(page_path) rescue nil
|
17
|
+
raise ActionController::RoutingError.new(page_path) if @page.nil?
|
18
18
|
end
|
19
19
|
|
20
20
|
def page_path
|
@@ -3,9 +3,10 @@ Spree::BaseController.class_eval do
|
|
3
3
|
before_filter :get_pages
|
4
4
|
|
5
5
|
def get_pages
|
6
|
-
|
7
|
-
|
6
|
+
admin = request.path =~ /^\/admin/
|
7
|
+
@page = Page.find_by_path(request.path) rescue nil unless admin
|
8
|
+
scope = admin ? Page.scoped : Page.visible
|
8
9
|
@pages = scope.order(:position).all
|
9
10
|
end
|
10
11
|
|
11
|
-
end
|
12
|
+
end
|
data/app/models/content.rb
CHANGED
@@ -4,21 +4,11 @@ class Content < ActiveRecord::Base
|
|
4
4
|
validates_associated :page
|
5
5
|
validates_presence_of :title
|
6
6
|
|
7
|
+
default_scope order(:position)
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
:default_style => :preview,
|
12
|
-
:path => "assets/contents/:id/:style/:basename.:extension",
|
13
|
-
:storage => "s3",
|
14
|
-
:s3_credentials => "#{Rails.root}/config/s3.yml"
|
15
|
-
else
|
16
|
-
has_attached_file :attachment,
|
17
|
-
:styles => Proc.new{ |clip| clip.instance.attachment_sizes },
|
18
|
-
:default_style => :preview,
|
19
|
-
:url => "/assets/contents/:id/:style/:basename.:extension",
|
20
|
-
:path => ":rails_root/public/assets/contents/:id/:style/:basename.:extension"
|
21
|
-
end
|
9
|
+
has_attached_file :attachment,
|
10
|
+
:styles => Proc.new{ |clip| clip.instance.attachment_sizes },
|
11
|
+
:default_style => :preview
|
22
12
|
|
23
13
|
|
24
14
|
cattr_reader :per_page
|
data/app/models/page.rb
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
class Page < ActiveRecord::Base
|
2
2
|
|
3
|
+
alias_attribute :name, :title
|
4
|
+
|
3
5
|
validates_presence_of :title
|
4
6
|
validates :path, :presence => true, :uniqueness => { :case_sensitive => false }
|
5
7
|
|
8
|
+
default_scope order(:position)
|
9
|
+
|
6
10
|
scope :active, where(:accessible => true)
|
7
11
|
scope :visible, active.where(:visible => true)
|
8
12
|
|
@@ -13,12 +17,12 @@ class Page < ActiveRecord::Base
|
|
13
17
|
after_create :create_default_content
|
14
18
|
|
15
19
|
def self.find_by_path(_path)
|
16
|
-
return super(
|
17
|
-
super
|
20
|
+
return super('/') if _path == '_home_' && Page.exists?(:path => '/')
|
21
|
+
super _path.to_s.sub(/^\/*/, '/').gsub('--', '/')
|
18
22
|
end
|
19
23
|
|
20
24
|
def to_param
|
21
|
-
return '
|
25
|
+
return '_home_' if path == '/'
|
22
26
|
path.sub(/^\//, '').gsub('/', '--')
|
23
27
|
end
|
24
28
|
|
@@ -34,7 +38,7 @@ class Page < ActiveRecord::Base
|
|
34
38
|
def has_context?(context)
|
35
39
|
contents.where(:context => context).count
|
36
40
|
end
|
37
|
-
|
41
|
+
|
38
42
|
def matches?(_path)
|
39
43
|
(root? && _path == "/") || (!root? && _path.match(path))
|
40
44
|
end
|
@@ -47,7 +51,7 @@ class Page < ActiveRecord::Base
|
|
47
51
|
|
48
52
|
def set_defaults
|
49
53
|
return if title.blank?
|
50
|
-
return errors.add(:path, "is reserved. Please use another") if path.to_s =~ /home/
|
54
|
+
#return errors.add(:path, "is reserved. Please use another") if path.to_s =~ /home/
|
51
55
|
self.nav_title = title if nav_title.blank?
|
52
56
|
self.path = nav_title.parameterize if path.blank?
|
53
57
|
self.path = "/" + path.sub(/^\//, '')
|
data/app/models/page_image.rb
CHANGED
@@ -1,30 +1,19 @@
|
|
1
|
-
class PageImage <
|
1
|
+
class PageImage < Asset
|
2
2
|
|
3
3
|
validate :no_attachement_errors
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
:path => "assets/posts/: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/posts/:id/:style/:basename.:extension",
|
17
|
-
:path => ":rails_root/public/assets/posts/:id/:style/:basename.:extension"
|
18
|
-
end
|
19
|
-
|
5
|
+
has_attached_file :attachment,
|
6
|
+
:styles => Proc.new{ |clip| clip.instance.attachment_sizes },
|
7
|
+
:default_style => :medium
|
8
|
+
|
20
9
|
def image_content?
|
21
10
|
attachment_content_type.match(/\/(jpeg|png|gif|tiff|x-photoshop)/)
|
22
11
|
end
|
23
|
-
|
12
|
+
|
24
13
|
def attachment_sizes
|
25
14
|
sizes = {}
|
26
15
|
sizes.merge!(:mini => '48x48>', :small => '150x150>', :medium => '420x300>', :large => '900x650>') if image_content?
|
27
|
-
sizes.merge!(:slide => '950x250#') if viewable.respond_to?(:
|
16
|
+
sizes.merge!(:slide => '950x250#') if viewable.respond_to?(:root?) && viewable.root?
|
28
17
|
sizes
|
29
18
|
end
|
30
19
|
|
@@ -20,6 +20,12 @@
|
|
20
20
|
|
21
21
|
<div class="optional" style="display: none;">
|
22
22
|
|
23
|
+
<%= form.field_container :context do %>
|
24
|
+
<%= form.label :context, t('content.context') %><br />
|
25
|
+
<%= form.text_field :context, :class => "text" %>
|
26
|
+
<%= error_message_on :content, :context %>
|
27
|
+
<% end %>
|
28
|
+
|
23
29
|
<%= form.field_container :attachment do %>
|
24
30
|
<%= form.label :attachment, t('content.attachment') %><br />
|
25
31
|
<%= form.file_field :attachment %>
|
@@ -42,12 +48,6 @@
|
|
42
48
|
<%= error_message_on :content, :link_text %>
|
43
49
|
<% end %>
|
44
50
|
|
45
|
-
<%= form.field_container :context do %>
|
46
|
-
<%= form.label :context, t('content.context') %><br />
|
47
|
-
<%= form.text_field :context, :class => "text" %>
|
48
|
-
<%= error_message_on :content, :context %>
|
49
|
-
<% end %>
|
50
|
-
|
51
51
|
<%= form.field_container :hide_title do %>
|
52
52
|
<%= form.check_box :hide_title, :class => "checkbox" %>
|
53
53
|
<%= form.label :hide_title, t('content.hide_title') %><br />
|
@@ -1,4 +1,5 @@
|
|
1
1
|
<% content ||= @content %>
|
2
|
+
<% image_size ||= :medium %>
|
2
3
|
<% html ||= false %>
|
3
4
|
<% content_counter ||= 0 %>
|
4
5
|
|
@@ -8,7 +9,7 @@
|
|
8
9
|
|
9
10
|
<% if content.has_image? %>
|
10
11
|
<div class="content-left">
|
11
|
-
<%= image_tag content.attachment.url(
|
12
|
+
<%= image_tag content.attachment.url(image_size), :alt => content.title, :class => 'in-content' %>
|
12
13
|
</div>
|
13
14
|
<% end %>
|
14
15
|
|
@@ -30,4 +31,4 @@
|
|
30
31
|
|
31
32
|
<br class="clear"/>
|
32
33
|
|
33
|
-
<% end %>
|
34
|
+
<% end %>
|
data/config/locales/en.yml
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
en:
|
2
2
|
page:
|
3
|
+
model_name: Page
|
3
4
|
contents: Contents
|
4
5
|
title: Title
|
5
6
|
nav_title: Navigation Title
|
@@ -13,6 +14,7 @@ en:
|
|
13
14
|
explain_visible: visible pages will show up in the main menu.
|
14
15
|
|
15
16
|
content:
|
17
|
+
model_name: Content
|
16
18
|
page_title: Page Title
|
17
19
|
page: Page
|
18
20
|
title: Title
|
data/config/routes.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
class PossiblePage
|
2
2
|
def self.matches?(request)
|
3
3
|
path = request.fullpath
|
4
|
-
return
|
4
|
+
return if path =~ /(^\/(admin|account|cart|checkout|content|login|pg\/|orders|products|s\/|session|signup|shipments|states|t\/|tax_categories|user)+)/
|
5
5
|
count = Page.active.where(:path => path).count
|
6
6
|
0 < count
|
7
7
|
end
|
data/lib/spree_essential_cms.rb
CHANGED
@@ -3,11 +3,11 @@ require 'spree_essentials'
|
|
3
3
|
module SpreeEssentialCms
|
4
4
|
|
5
5
|
def self.tab
|
6
|
-
[:pages
|
6
|
+
[ :pages ]
|
7
7
|
end
|
8
8
|
|
9
9
|
def self.sub_tab
|
10
|
-
[:pages, { :
|
10
|
+
[ :pages, { :match_path => '/pages' }]
|
11
11
|
end
|
12
12
|
|
13
13
|
def self.independent?
|
@@ -0,0 +1,36 @@
|
|
1
|
+
namespace :db do
|
2
|
+
namespace :sample do
|
3
|
+
desc "Create admin username and password"
|
4
|
+
task :cms => :environment do
|
5
|
+
|
6
|
+
# dependent on spree_core
|
7
|
+
require 'faker'
|
8
|
+
|
9
|
+
unless Page.count == 0
|
10
|
+
require 'highline/import'
|
11
|
+
continue = ask("Sample data will destroy existing data. Continue? [y/n]", String) do |q|
|
12
|
+
q.echo = true
|
13
|
+
q.whitespace = :strip
|
14
|
+
end
|
15
|
+
exit unless continue =~ /y/i
|
16
|
+
Page.destroy_all
|
17
|
+
end
|
18
|
+
|
19
|
+
images = Dir[File.expand_path("../sample", __FILE__) + "/*.jpg"]
|
20
|
+
|
21
|
+
home = Page.create(:title => "Home", :path => "/")
|
22
|
+
home.contents.first.update_attributes(:body => Faker::Lorem.paragraphs().join("\n\n"), :context => "main")
|
23
|
+
home.contents.create(:title => Faker::Lorem.words(3 + rand(3)).join(" "), :body => Faker::Lorem.sentence, :context => "intro")
|
24
|
+
|
25
|
+
images.each {|image| home.images.create(:attachment => File.open(image), :alt => "Sailing") }
|
26
|
+
|
27
|
+
%w(About Contact).each do |title|
|
28
|
+
page = Page.create(:title => title, :path => title.downcase)
|
29
|
+
page.contents.first.update_attributes(:body => Faker::Lorem.paragraphs().join("\n\n"))
|
30
|
+
end
|
31
|
+
|
32
|
+
puts "done."
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,39 @@
|
|
1
|
+
/* ==========================================
|
2
|
+
Main Menu
|
3
|
+
*/
|
4
|
+
|
5
|
+
ul#main-menu {
|
6
|
+
list-style: none;
|
7
|
+
margin: 0;
|
8
|
+
padding: 0;
|
9
|
+
}
|
10
|
+
ul#main-menu li {
|
11
|
+
list-style: none;
|
12
|
+
display: block;
|
13
|
+
float: left;
|
14
|
+
margin-right: 10px;
|
15
|
+
font-size: 14px;
|
16
|
+
}
|
17
|
+
ul#main-menu li.active a {
|
18
|
+
color: #fff;
|
19
|
+
}
|
20
|
+
|
21
|
+
|
22
|
+
/* ==========================================
|
23
|
+
Slideshow
|
24
|
+
*/
|
25
|
+
|
26
|
+
body.one-col #content {
|
27
|
+
position: relative;
|
28
|
+
}
|
29
|
+
|
30
|
+
.slideshow img {
|
31
|
+
position: absolute;
|
32
|
+
left: 0;
|
33
|
+
top: 0;
|
34
|
+
}
|
35
|
+
|
36
|
+
.slideshow.slide {
|
37
|
+
width: 950px;
|
38
|
+
height: 250px;
|
39
|
+
}
|
metadata
CHANGED
@@ -1,173 +1,137 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_essential_cms
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.2
|
4
5
|
prerelease:
|
5
|
-
version: 0.1.0
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Spencer Steffen
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
dependencies:
|
16
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-01-06 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
17
15
|
name: spree_essentials
|
18
|
-
requirement: &
|
16
|
+
requirement: &70280302826960 !ruby/object:Gem::Requirement
|
19
17
|
none: false
|
20
|
-
requirements:
|
21
|
-
- -
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 0.
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.2.3
|
24
22
|
type: :runtime
|
25
23
|
prerelease: false
|
26
|
-
version_requirements: *
|
27
|
-
- !ruby/object:Gem::Dependency
|
24
|
+
version_requirements: *70280302826960
|
25
|
+
- !ruby/object:Gem::Dependency
|
28
26
|
name: spree_sample
|
29
|
-
requirement: &
|
27
|
+
requirement: &70280302826460 !ruby/object:Gem::Requirement
|
30
28
|
none: false
|
31
|
-
requirements:
|
32
|
-
- -
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: 0.
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.60.0
|
35
33
|
type: :development
|
36
34
|
prerelease: false
|
37
|
-
version_requirements: *
|
38
|
-
- !ruby/object:Gem::Dependency
|
35
|
+
version_requirements: *70280302826460
|
36
|
+
- !ruby/object:Gem::Dependency
|
39
37
|
name: dummier
|
40
|
-
requirement: &
|
38
|
+
requirement: &70280302825700 !ruby/object:Gem::Requirement
|
41
39
|
none: false
|
42
|
-
requirements:
|
43
|
-
- -
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: 0.
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 0.2.4
|
46
44
|
type: :development
|
47
45
|
prerelease: false
|
48
|
-
version_requirements: *
|
49
|
-
- !ruby/object:Gem::Dependency
|
46
|
+
version_requirements: *70280302825700
|
47
|
+
- !ruby/object:Gem::Dependency
|
50
48
|
name: shoulda
|
51
|
-
requirement: &
|
49
|
+
requirement: &70280302825240 !ruby/object:Gem::Requirement
|
52
50
|
none: false
|
53
|
-
requirements:
|
54
|
-
- -
|
55
|
-
- !ruby/object:Gem::Version
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
56
54
|
version: 2.11.3
|
57
55
|
type: :development
|
58
56
|
prerelease: false
|
59
|
-
version_requirements: *
|
60
|
-
- !ruby/object:Gem::Dependency
|
57
|
+
version_requirements: *70280302825240
|
58
|
+
- !ruby/object:Gem::Dependency
|
61
59
|
name: factory_girl
|
62
|
-
requirement: &
|
60
|
+
requirement: &70280302824780 !ruby/object:Gem::Requirement
|
63
61
|
none: false
|
64
|
-
requirements:
|
65
|
-
- -
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
version: 2.0.0.
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 2.0.0.beta4
|
68
66
|
type: :development
|
69
67
|
prerelease: false
|
70
|
-
version_requirements: *
|
71
|
-
- !ruby/object:Gem::Dependency
|
72
|
-
name: cucumber
|
73
|
-
requirement: &id006 !ruby/object:Gem::Requirement
|
74
|
-
none: false
|
75
|
-
requirements:
|
76
|
-
- - ">="
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
version: 0.10.2
|
79
|
-
type: :development
|
80
|
-
prerelease: false
|
81
|
-
version_requirements: *id006
|
82
|
-
- !ruby/object:Gem::Dependency
|
68
|
+
version_requirements: *70280302824780
|
69
|
+
- !ruby/object:Gem::Dependency
|
83
70
|
name: capybara
|
84
|
-
requirement: &
|
71
|
+
requirement: &70280302824320 !ruby/object:Gem::Requirement
|
85
72
|
none: false
|
86
|
-
requirements:
|
87
|
-
- -
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 0.
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 1.0.0
|
90
77
|
type: :development
|
91
78
|
prerelease: false
|
92
|
-
version_requirements: *
|
93
|
-
- !ruby/object:Gem::Dependency
|
94
|
-
name: selenium-webdriver
|
95
|
-
requirement: &id008 !ruby/object:Gem::Requirement
|
96
|
-
none: false
|
97
|
-
requirements:
|
98
|
-
- - ">="
|
99
|
-
- !ruby/object:Gem::Version
|
100
|
-
version: 0.1.3
|
101
|
-
type: :development
|
102
|
-
prerelease: false
|
103
|
-
version_requirements: *id008
|
104
|
-
- !ruby/object:Gem::Dependency
|
79
|
+
version_requirements: *70280302824320
|
80
|
+
- !ruby/object:Gem::Dependency
|
105
81
|
name: sqlite3
|
106
|
-
requirement: &
|
82
|
+
requirement: &70280302823860 !ruby/object:Gem::Requirement
|
107
83
|
none: false
|
108
|
-
requirements:
|
109
|
-
- -
|
110
|
-
- !ruby/object:Gem::Version
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
111
87
|
version: 1.3.3
|
112
88
|
type: :development
|
113
89
|
prerelease: false
|
114
|
-
version_requirements: *
|
115
|
-
- !ruby/object:Gem::Dependency
|
116
|
-
name: faker
|
117
|
-
requirement: &id010 !ruby/object:Gem::Requirement
|
118
|
-
none: false
|
119
|
-
requirements:
|
120
|
-
- - ">="
|
121
|
-
- !ruby/object:Gem::Version
|
122
|
-
version: 0.9.5
|
123
|
-
type: :development
|
124
|
-
prerelease: false
|
125
|
-
version_requirements: *id010
|
126
|
-
- !ruby/object:Gem::Dependency
|
90
|
+
version_requirements: *70280302823860
|
91
|
+
- !ruby/object:Gem::Dependency
|
127
92
|
name: spork
|
128
|
-
requirement: &
|
93
|
+
requirement: &70280302823400 !ruby/object:Gem::Requirement
|
129
94
|
none: false
|
130
|
-
requirements:
|
131
|
-
- -
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
version: 0.9.0.
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: 0.9.0.rc9
|
134
99
|
type: :development
|
135
100
|
prerelease: false
|
136
|
-
version_requirements: *
|
137
|
-
- !ruby/object:Gem::Dependency
|
101
|
+
version_requirements: *70280302823400
|
102
|
+
- !ruby/object:Gem::Dependency
|
138
103
|
name: spork-testunit
|
139
|
-
requirement: &
|
104
|
+
requirement: &70280302822940 !ruby/object:Gem::Requirement
|
140
105
|
none: false
|
141
|
-
requirements:
|
142
|
-
- -
|
143
|
-
- !ruby/object:Gem::Version
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
144
109
|
version: 0.0.5
|
145
110
|
type: :development
|
146
111
|
prerelease: false
|
147
|
-
version_requirements: *
|
148
|
-
description: SpreeEssentialCms is a full featured content management system for Spree
|
149
|
-
|
112
|
+
version_requirements: *70280302822940
|
113
|
+
description: SpreeEssentialCms is a full featured content management system for Spree
|
114
|
+
Commerce. It's designed to be used with the spree_essentials base.
|
115
|
+
email:
|
150
116
|
- spencer@citrusme.com
|
151
117
|
executables: []
|
152
|
-
|
153
118
|
extensions: []
|
154
|
-
|
155
119
|
extra_rdoc_files: []
|
156
|
-
|
157
|
-
files:
|
120
|
+
files:
|
158
121
|
- README.md
|
159
122
|
- LICENSE
|
160
123
|
- config/locales/en.yml
|
161
124
|
- config/routes.rb
|
162
|
-
- lib/dummy_hooks/after_migrate.rb
|
163
|
-
- lib/dummy_hooks/after_migrate.rb.sample
|
164
|
-
- lib/dummy_hooks/before_migrate.rb
|
165
125
|
- lib/generators/essentials_base.rb
|
166
126
|
- lib/generators/spree_essentials/cms_generator.rb
|
167
127
|
- lib/generators/templates/db/migrate/create_contents.rb
|
168
128
|
- lib/generators/templates/db/migrate/create_pages.rb
|
169
129
|
- lib/spree_essential_cms/version.rb
|
170
130
|
- lib/spree_essential_cms.rb
|
131
|
+
- lib/tasks/sample/sailing.jpg
|
132
|
+
- lib/tasks/sample/sailing2.jpg
|
133
|
+
- lib/tasks/sample/sailing3.jpg
|
134
|
+
- lib/tasks/sample.rake
|
171
135
|
- app/controllers/admin/contents_controller.rb
|
172
136
|
- app/controllers/admin/page_images_controller.rb
|
173
137
|
- app/controllers/admin/pages_controller.rb
|
@@ -197,40 +161,37 @@ files:
|
|
197
161
|
- app/views/shared/_content.html.erb
|
198
162
|
- app/views/shared/_main_menu.html.erb
|
199
163
|
- app/views/shared/_slideshow.html.erb
|
164
|
+
- public/stylesheets/essentials/cms.css
|
200
165
|
- Rakefile
|
201
|
-
has_rdoc: true
|
202
166
|
homepage: http://github.com/citrus/spree_essential_cms
|
203
167
|
licenses: []
|
204
|
-
|
205
168
|
post_install_message:
|
206
169
|
rdoc_options: []
|
207
|
-
|
208
|
-
require_paths:
|
170
|
+
require_paths:
|
209
171
|
- lib
|
210
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
172
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
211
173
|
none: false
|
212
|
-
requirements:
|
213
|
-
- -
|
214
|
-
- !ruby/object:Gem::Version
|
215
|
-
|
216
|
-
segments:
|
174
|
+
requirements:
|
175
|
+
- - ! '>='
|
176
|
+
- !ruby/object:Gem::Version
|
177
|
+
version: '0'
|
178
|
+
segments:
|
217
179
|
- 0
|
218
|
-
|
219
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
180
|
+
hash: 239260853434187353
|
181
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
220
182
|
none: false
|
221
|
-
requirements:
|
222
|
-
- -
|
223
|
-
- !ruby/object:Gem::Version
|
224
|
-
|
225
|
-
segments:
|
183
|
+
requirements:
|
184
|
+
- - ! '>='
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
version: '0'
|
187
|
+
segments:
|
226
188
|
- 0
|
227
|
-
|
189
|
+
hash: 239260853434187353
|
228
190
|
requirements: []
|
229
|
-
|
230
191
|
rubyforge_project:
|
231
|
-
rubygems_version: 1.
|
192
|
+
rubygems_version: 1.8.10
|
232
193
|
signing_key:
|
233
194
|
specification_version: 3
|
234
|
-
summary: SpreeEssentialCms is a full featured content management system for Spree
|
195
|
+
summary: SpreeEssentialCms is a full featured content management system for Spree
|
196
|
+
Commerce.
|
235
197
|
test_files: []
|
236
|
-
|
@@ -1 +0,0 @@
|
|
1
|
-
rake "db:migrate db:seed db:admin:create", :env => "development"
|
@@ -1 +0,0 @@
|
|
1
|
-
rake "db:migrate db:seed db:admin:create", :env => "development"
|