spree_showcase 0.5.0 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +11 -0
- data/.rspec +1 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +179 -0
- data/LICENSE +26 -0
- data/README.md +33 -0
- data/Rakefile +29 -0
- data/Versionfile +11 -0
- data/app/assets/images/store/bg_control_nav.png +0 -0
- data/app/assets/images/store/bg_direction_nav.png +0 -0
- data/app/assets/javascripts/admin/spree_showcase.js +1 -0
- data/app/assets/javascripts/store/spree_showcase.js +3 -0
- data/app/assets/stylesheets/admin/spree_showcase.css +3 -0
- data/app/assets/stylesheets/store/spree_showcase.css +4 -0
- data/app/controllers/spree/admin/showcase_settings_controller.rb +22 -0
- data/app/controllers/spree/admin/slides_controller.rb +25 -0
- data/app/models/spree/slide.rb +10 -0
- data/app/overrides/add_showcase_to_admin_configuration_menu.rb +9 -0
- data/app/overrides/add_showcase_to_admin_configurations_side_menu.rb +7 -0
- data/app/overrides/add_showcase_to_home_layout.rb +8 -0
- data/app/overrides/insert_slider_into_spree_application.rb +10 -0
- data/app/views/spree/admin/shared/_showcase_settings.html.erb +4 -0
- data/app/views/spree/admin/shared/_showcase_submenu.html.erb +6 -0
- data/app/views/spree/admin/showcase_settings/edit.html.erb +19 -0
- data/app/views/spree/admin/showcase_settings/show.html.erb +16 -0
- data/app/views/spree/admin/slides/_form.html.erb +28 -0
- data/app/views/spree/admin/slides/edit.html.erb +10 -0
- data/app/views/spree/admin/slides/index.html.erb +34 -0
- data/app/views/spree/admin/slides/new.html.erb +9 -0
- data/app/views/spree/admin/slides/show.html.erb +41 -0
- data/app/views/spree/slides/_content_insert.html.erb +5 -0
- data/app/views/spree/slides/_showcase.html.erb +28 -0
- data/config/locales/en.yml +5 -0
- data/config/routes.rb +14 -0
- data/db/migrate/20120506161852_create_slides.rb +17 -0
- data/db/migrate/20120507074922_add_position_to_slide.rb +9 -0
- data/lib/generators/spree_showcase/install/assets/javascripts/store/jquery.flexslider.js +563 -0
- data/lib/generators/spree_showcase/install/assets/javascripts/store/showcase.js +32 -0
- data/lib/generators/spree_showcase/install/assets/partials/_showcase.html.erb +28 -0
- data/lib/generators/spree_showcase/install/assets/stylesheets/store/flexslider.css +64 -0
- data/lib/generators/spree_showcase/install/assets/stylesheets/store/showcase.css.scss +26 -0
- data/lib/generators/spree_showcase/install/install_generator.rb +65 -0
- data/lib/spree/showcase_configuration.rb +8 -0
- data/lib/spree_showcase.rb +3 -0
- data/lib/spree_showcase/engine.rb +30 -0
- data/script/rails +7 -0
- data/spec/spec_helper.rb +43 -0
- data/spree_showcase-0.5.0.gem +0 -0
- data/spree_showcase-0.5.1.gem +0 -0
- data/spree_showcase.gemspec +26 -0
- metadata +118 -4
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,179 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
spree_showcase (1.0.0)
|
5
|
+
spree_core (~> 1.1.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
actionmailer (3.2.3)
|
11
|
+
actionpack (= 3.2.3)
|
12
|
+
mail (~> 2.4.4)
|
13
|
+
actionpack (3.2.3)
|
14
|
+
activemodel (= 3.2.3)
|
15
|
+
activesupport (= 3.2.3)
|
16
|
+
builder (~> 3.0.0)
|
17
|
+
erubis (~> 2.7.0)
|
18
|
+
journey (~> 1.0.1)
|
19
|
+
rack (~> 1.4.0)
|
20
|
+
rack-cache (~> 1.2)
|
21
|
+
rack-test (~> 0.6.1)
|
22
|
+
sprockets (~> 2.1.2)
|
23
|
+
active_utils (1.0.3)
|
24
|
+
activesupport (>= 2.3.11)
|
25
|
+
i18n
|
26
|
+
activemerchant (1.20.4)
|
27
|
+
active_utils (>= 1.0.2)
|
28
|
+
activesupport (>= 2.3.11)
|
29
|
+
braintree (>= 2.0.0)
|
30
|
+
builder (>= 2.0.0)
|
31
|
+
i18n
|
32
|
+
json (>= 1.5.1)
|
33
|
+
money (<= 3.7.1)
|
34
|
+
activemodel (3.2.3)
|
35
|
+
activesupport (= 3.2.3)
|
36
|
+
builder (~> 3.0.0)
|
37
|
+
activerecord (3.2.3)
|
38
|
+
activemodel (= 3.2.3)
|
39
|
+
activesupport (= 3.2.3)
|
40
|
+
arel (~> 3.0.2)
|
41
|
+
tzinfo (~> 0.3.29)
|
42
|
+
activeresource (3.2.3)
|
43
|
+
activemodel (= 3.2.3)
|
44
|
+
activesupport (= 3.2.3)
|
45
|
+
activesupport (3.2.3)
|
46
|
+
i18n (~> 0.6)
|
47
|
+
multi_json (~> 1.0)
|
48
|
+
acts_as_list (0.1.4)
|
49
|
+
archive-tar-minitar (0.5.2)
|
50
|
+
arel (3.0.2)
|
51
|
+
aws-sdk (1.3.9)
|
52
|
+
httparty (~> 0.7)
|
53
|
+
json (~> 1.4)
|
54
|
+
nokogiri (>= 1.4.4)
|
55
|
+
uuidtools (~> 2.1)
|
56
|
+
braintree (2.16.0)
|
57
|
+
builder (>= 2.0.0)
|
58
|
+
builder (3.0.0)
|
59
|
+
cocaine (0.2.1)
|
60
|
+
columnize (0.3.6)
|
61
|
+
deface (0.8.0)
|
62
|
+
nokogiri (~> 1.5.0)
|
63
|
+
rails (>= 3.0.9)
|
64
|
+
erubis (2.7.0)
|
65
|
+
ffaker (1.12.1)
|
66
|
+
highline (1.6.11)
|
67
|
+
hike (1.2.1)
|
68
|
+
httparty (0.8.3)
|
69
|
+
multi_json (~> 1.0)
|
70
|
+
multi_xml
|
71
|
+
i18n (0.6.0)
|
72
|
+
journey (1.0.3)
|
73
|
+
jquery-rails (2.0.2)
|
74
|
+
railties (>= 3.2.0, < 5.0)
|
75
|
+
thor (~> 0.14)
|
76
|
+
json (1.7.0)
|
77
|
+
kaminari (0.13.0)
|
78
|
+
actionpack (>= 3.0.0)
|
79
|
+
activesupport (>= 3.0.0)
|
80
|
+
railties (>= 3.0.0)
|
81
|
+
linecache19 (0.5.12)
|
82
|
+
ruby_core_source (>= 0.1.4)
|
83
|
+
mail (2.4.4)
|
84
|
+
i18n (>= 0.4.0)
|
85
|
+
mime-types (~> 1.16)
|
86
|
+
treetop (~> 1.4.8)
|
87
|
+
mime-types (1.18)
|
88
|
+
money (3.7.1)
|
89
|
+
i18n (~> 0.4)
|
90
|
+
multi_json (1.3.4)
|
91
|
+
multi_xml (0.4.4)
|
92
|
+
nested_set (1.7.0)
|
93
|
+
activerecord (>= 3.0.0)
|
94
|
+
railties (>= 3.0.0)
|
95
|
+
nokogiri (1.5.2)
|
96
|
+
paperclip (2.7.0)
|
97
|
+
activerecord (>= 2.3.0)
|
98
|
+
activesupport (>= 2.3.2)
|
99
|
+
cocaine (>= 0.0.2)
|
100
|
+
mime-types
|
101
|
+
polyamorous (0.5.0)
|
102
|
+
activerecord (~> 3.0)
|
103
|
+
polyglot (0.3.3)
|
104
|
+
rack (1.4.1)
|
105
|
+
rack-cache (1.2)
|
106
|
+
rack (>= 0.4)
|
107
|
+
rack-ssl (1.3.2)
|
108
|
+
rack
|
109
|
+
rack-test (0.6.1)
|
110
|
+
rack (>= 1.0)
|
111
|
+
rails (3.2.3)
|
112
|
+
actionmailer (= 3.2.3)
|
113
|
+
actionpack (= 3.2.3)
|
114
|
+
activerecord (= 3.2.3)
|
115
|
+
activeresource (= 3.2.3)
|
116
|
+
activesupport (= 3.2.3)
|
117
|
+
bundler (~> 1.0)
|
118
|
+
railties (= 3.2.3)
|
119
|
+
railties (3.2.3)
|
120
|
+
actionpack (= 3.2.3)
|
121
|
+
activesupport (= 3.2.3)
|
122
|
+
rack-ssl (~> 1.3.2)
|
123
|
+
rake (>= 0.8.7)
|
124
|
+
rdoc (~> 3.4)
|
125
|
+
thor (~> 0.14.6)
|
126
|
+
rake (0.9.2.2)
|
127
|
+
ransack (0.6.0)
|
128
|
+
actionpack (~> 3.0)
|
129
|
+
activerecord (~> 3.0)
|
130
|
+
polyamorous (~> 0.5.0)
|
131
|
+
rdoc (3.12)
|
132
|
+
json (~> 1.4)
|
133
|
+
ruby-debug-base19 (0.11.25)
|
134
|
+
columnize (>= 0.3.1)
|
135
|
+
linecache19 (>= 0.5.11)
|
136
|
+
ruby_core_source (>= 0.1.4)
|
137
|
+
ruby-debug19 (0.11.6)
|
138
|
+
columnize (>= 0.3.1)
|
139
|
+
linecache19 (>= 0.5.11)
|
140
|
+
ruby-debug-base19 (>= 0.11.19)
|
141
|
+
ruby_core_source (0.1.5)
|
142
|
+
archive-tar-minitar (>= 0.5.2)
|
143
|
+
spree_core (1.1.0)
|
144
|
+
activemerchant (= 1.20.4)
|
145
|
+
acts_as_list (= 0.1.4)
|
146
|
+
aws-sdk (~> 1.3.4)
|
147
|
+
deface (>= 0.8.0)
|
148
|
+
ffaker (~> 1.12.0)
|
149
|
+
highline (= 1.6.11)
|
150
|
+
jquery-rails (~> 2.0.0)
|
151
|
+
kaminari (>= 0.13.0)
|
152
|
+
nested_set (= 1.7.0)
|
153
|
+
paperclip (~> 2.7)
|
154
|
+
rails (>= 3.2.2, <= 3.2.3)
|
155
|
+
ransack (~> 0.6.0)
|
156
|
+
state_machine (= 1.1.2)
|
157
|
+
stringex (~> 1.3.2)
|
158
|
+
sprockets (2.1.3)
|
159
|
+
hike (~> 1.2)
|
160
|
+
rack (~> 1.0)
|
161
|
+
tilt (~> 1.1, != 1.3.0)
|
162
|
+
sqlite3 (1.3.6)
|
163
|
+
state_machine (1.1.2)
|
164
|
+
stringex (1.3.3)
|
165
|
+
thor (0.14.6)
|
166
|
+
tilt (1.3.3)
|
167
|
+
treetop (1.4.10)
|
168
|
+
polyglot
|
169
|
+
polyglot (>= 0.3.1)
|
170
|
+
tzinfo (0.3.33)
|
171
|
+
uuidtools (2.1.2)
|
172
|
+
|
173
|
+
PLATFORMS
|
174
|
+
ruby
|
175
|
+
|
176
|
+
DEPENDENCIES
|
177
|
+
ruby-debug19
|
178
|
+
spree_showcase!
|
179
|
+
sqlite3
|
data/LICENSE
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
Copyright (c) 2012 [name of plugin creator]
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without modification,
|
5
|
+
are permitted provided that the following conditions are met:
|
6
|
+
|
7
|
+
* Redistributions of source code must retain the above copyright notice,
|
8
|
+
this list of conditions and the following disclaimer.
|
9
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
10
|
+
this list of conditions and the following disclaimer in the documentation
|
11
|
+
and/or other materials provided with the distribution.
|
12
|
+
* Neither the name Spree nor the names of its contributors may be used to
|
13
|
+
endorse or promote products derived from this software without specific
|
14
|
+
prior written permission.
|
15
|
+
|
16
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
17
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
18
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
19
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
20
|
+
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
21
|
+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
22
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
23
|
+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
24
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
25
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
26
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
Spree Showcase
|
2
|
+
===========
|
3
|
+
|
4
|
+
Spree Showcase is a simple extension that allows you to create the good ol' slideshow. The goal is to create a slideshow extension that makes things easy for the users and programmers. Minimal effort needed.
|
5
|
+
|
6
|
+
The secondary objective is to create a slideshow template that allows most types of JS slider to be implemented easily into Spree.
|
7
|
+
|
8
|
+
Currently, this is the first iteration of the slideshow extension at v0.1. Contributors are greatly welcomed =)
|
9
|
+
|
10
|
+
**Next to come:**
|
11
|
+
- Adding sliders to different layout positions
|
12
|
+
- Enabling more options to be customized in the Admin Menu
|
13
|
+
|
14
|
+
Example
|
15
|
+
=======
|
16
|
+
Get a clean Spree Installation
|
17
|
+
|
18
|
+
rails new spree_demo
|
19
|
+
cd spree_demo
|
20
|
+
spree install
|
21
|
+
|
22
|
+
gem 'spree_showcase', :git=>"git://github.com/daemonsy/spree_showcase" # Into Gemfile
|
23
|
+
|
24
|
+
bundle install
|
25
|
+
rails g spree_showcase:install
|
26
|
+
|
27
|
+
Testing
|
28
|
+
-------
|
29
|
+
No tests have been done yet. Use at your own risk!
|
30
|
+
|
31
|
+
|
32
|
+
Copyright (c) 2012 Damon Aw, released under the New BSD License.
|
33
|
+
[What is the BSD license anyway?]
|
data/Rakefile
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/testtask'
|
3
|
+
require 'rake/packagetask'
|
4
|
+
require 'rubygems/package_task'
|
5
|
+
require 'rspec/core/rake_task'
|
6
|
+
require 'spree/core/testing_support/common_rake'
|
7
|
+
|
8
|
+
RSpec::Core::RakeTask.new
|
9
|
+
|
10
|
+
task :default => [:spec]
|
11
|
+
|
12
|
+
spec = eval(File.read('spree_showcase.gemspec'))
|
13
|
+
|
14
|
+
Gem::PackageTask.new(spec) do |p|
|
15
|
+
p.gem_spec = spec
|
16
|
+
end
|
17
|
+
|
18
|
+
desc 'Release to gemcutter'
|
19
|
+
task :release => :package do
|
20
|
+
require 'rake/gemcutter'
|
21
|
+
Rake::Gemcutter::Tasks.new(spec).define
|
22
|
+
Rake::Task['gem:push'].invoke
|
23
|
+
end
|
24
|
+
|
25
|
+
desc 'Generates a dummy app for testing'
|
26
|
+
task :test_app do
|
27
|
+
ENV['LIB_NAME'] = 'spree_showcase'
|
28
|
+
Rake::Task['common:test_app'].invoke
|
29
|
+
end
|
data/Versionfile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# This file is used to designate compatibilty with different versions of Spree
|
2
|
+
# Please see http://spreecommerce.com/documentation/extensions.html#versionfile for details
|
3
|
+
|
4
|
+
# Examples
|
5
|
+
#
|
6
|
+
# '1.2.x' => { :branch => 'master' }
|
7
|
+
'1.1.x' => { :tag => 'v0.5',:version=>'0.5.1' }
|
8
|
+
# '1.0.x' => { :branch => '1-0-stable' }
|
9
|
+
# '0.70.x' => { :branch => '0-70-stable' }
|
10
|
+
# '0.40.x' => { :tag => 'v1.0.0', :version => '1.0.0' }
|
11
|
+
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require admin/spree_core
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Spree
|
2
|
+
module Admin
|
3
|
+
class ShowcaseSettingsController < BaseController
|
4
|
+
def show
|
5
|
+
@preferences = [:enabled, :thumbnail_style, :showcase_style, :number_of_slides_to_show]
|
6
|
+
end
|
7
|
+
|
8
|
+
def edit
|
9
|
+
@preferences = [:enabled, :thumbnail_style, :showcase_style, :number_of_slides_to_show]
|
10
|
+
end
|
11
|
+
|
12
|
+
def update
|
13
|
+
params.each do |name, value|
|
14
|
+
next unless SpreeShowcase::Config.has_preference? name
|
15
|
+
SpreeShowcase::Config[name] = value
|
16
|
+
end
|
17
|
+
|
18
|
+
redirect_to admin_showcase_settings_path
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Spree
|
2
|
+
module Admin
|
3
|
+
class SlidesController < ResourceController
|
4
|
+
respond_to :html
|
5
|
+
|
6
|
+
# Copied over from the Spree Core.
|
7
|
+
def update_positions
|
8
|
+
params[:positions].each do |id, index|
|
9
|
+
Slide.where(:id => id).update_all(:position => index)
|
10
|
+
end
|
11
|
+
|
12
|
+
respond_to do |format|
|
13
|
+
format.js { render :text => 'Ok' }
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def index
|
18
|
+
@slides = Slide.all # There is a default_scope order(:position) in effect.
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
class Spree::Slide < ActiveRecord::Base
|
2
|
+
|
3
|
+
|
4
|
+
has_attached_file :image, :styles=>{:thumb=> ["#{SpreeShowcase::Config.thumbnail_style}"]} # Thumbnail Style is a config setting.
|
5
|
+
|
6
|
+
default_scope order(:position) # Slides should always be ordered by position specified by user.
|
7
|
+
scope :published, where(:published=>true)
|
8
|
+
scope :no_slides, lambda {|num| limit(num)}
|
9
|
+
attr_accessible :name, :body, :target_url, :published, :image, :thumbnail_message
|
10
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
Deface::Override.new(:virtual_path => 'spree/admin/configurations/index',
|
2
|
+
:name => 'add_showcase_to_admin_configurations_menu',
|
3
|
+
:insert_bottom => "[data-hook='admin_configurations_menu']",
|
4
|
+
:text => %q{
|
5
|
+
<tr>
|
6
|
+
<td><%= link_to 'Showcase Slider', admin_slides_path %></td>
|
7
|
+
<td>Showcase Slides & Settings</td>
|
8
|
+
</tr> })
|
9
|
+
|
@@ -0,0 +1,7 @@
|
|
1
|
+
Deface::Override.new(
|
2
|
+
:virtual_path => 'spree/admin/shared/_configuration_menu',
|
3
|
+
:name => 'add_showcase_to_admin_configurations_side_menu',
|
4
|
+
:insert_bottom => "[data-hook='admin_configurations_sidebar_menu']",
|
5
|
+
:text => %q{<%= configurations_sidebar_menu_item 'Showcase Slider', admin_slides_path %>}
|
6
|
+
)
|
7
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
|
2
|
+
Deface::Override.new(
|
3
|
+
:virtual_path => "spree/layouts/spree_application",
|
4
|
+
:name => "add_showcase_yield_into_spree_layout",
|
5
|
+
:insert_after => %q{#header[data-hook]},
|
6
|
+
:text => %q{
|
7
|
+
<div id='spree-showcase' data-hook>
|
8
|
+
<%= yield :spree_showcase %>
|
9
|
+
</div>}
|
10
|
+
)
|