spree_featured 0.1.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/LICENSE.txt +20 -0
- data/README.mkd +25 -0
- data/Rakefile +45 -0
- data/VERSION +1 -0
- data/app/views/admin/products/_spree_featured_admin_product_fields.html.erb +4 -0
- data/app/views/admin/products/_spree_featured_admin_product_headers.html.erb +1 -0
- data/app/views/admin/products/_spree_featured_admin_product_listing.html.erb +1 -0
- data/app/views/shared/_featured.html.erb +16 -0
- data/config/locales/en.yml +5 -0
- data/db/migrate/20101221123800_add_product_featured_field.rb +9 -0
- data/lib/spree_featured.rb +22 -0
- data/lib/spree_featured_hooks.rb +5 -0
- data/lib/tasks/install.rake +26 -0
- data/lib/tasks/spree_featured.rake +1 -0
- data/spree_featured.gemspec +51 -0
- metadata +71 -0
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 felix
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.mkd
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
SpreeFeatured
|
2
|
+
=============
|
3
|
+
|
4
|
+
Adds the basic ability to 'feature' products'.
|
5
|
+
|
6
|
+
Includes basic administration additions to enable and disable featured products
|
7
|
+
and show featured products in the product list view.
|
8
|
+
|
9
|
+
Example
|
10
|
+
=======
|
11
|
+
|
12
|
+
In your site extension's hooks file, insert the following:
|
13
|
+
|
14
|
+
insert_before :homepage_products, 'shared/featured'
|
15
|
+
|
16
|
+
To have the provided featured partial displayed on the front page. Override the
|
17
|
+
partial as you see fit obviously.
|
18
|
+
|
19
|
+
TODO
|
20
|
+
====
|
21
|
+
|
22
|
+
* Some sort of date range restrictions on featured products
|
23
|
+
* Automatically create a product group for featured products
|
24
|
+
|
25
|
+
Copyright (c) 2011 Felix Hanley, released under the New BSD License
|
data/Rakefile
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
require 'jeweler'
|
5
|
+
Jeweler::Tasks.new do |gem|
|
6
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
7
|
+
gem.name = "spree_featured"
|
8
|
+
gem.homepage = "http://github.com/felix/spree-featured"
|
9
|
+
gem.license = "MIT"
|
10
|
+
gem.summary = 'Featured products in Spree'
|
11
|
+
gem.description = "Adds the basic ability to 'feature' products. Includes basic administration additions to enable and disable featured products and show featured products in the product list view."
|
12
|
+
gem.email = "felix@seconddrawer.com.au"
|
13
|
+
gem.authors = ['Felix Hanley']
|
14
|
+
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
15
|
+
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
16
|
+
# gem.add_runtime_dependency 'jabber4r', '> 0.1'
|
17
|
+
# gem.add_development_dependency 'rspec', '> 1.2.3'
|
18
|
+
end
|
19
|
+
Jeweler::RubygemsDotOrgTasks.new
|
20
|
+
|
21
|
+
require 'rake/testtask'
|
22
|
+
Rake::TestTask.new(:test) do |test|
|
23
|
+
test.libs << 'lib' << 'test'
|
24
|
+
test.pattern = 'test/**/test_*.rb'
|
25
|
+
test.verbose = true
|
26
|
+
end
|
27
|
+
|
28
|
+
require 'rcov/rcovtask'
|
29
|
+
Rcov::RcovTask.new do |test|
|
30
|
+
test.libs << 'test'
|
31
|
+
test.pattern = 'test/**/test_*.rb'
|
32
|
+
test.verbose = true
|
33
|
+
end
|
34
|
+
|
35
|
+
task :default => :test
|
36
|
+
|
37
|
+
require 'rake/rdoctask'
|
38
|
+
Rake::RDocTask.new do |rdoc|
|
39
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
40
|
+
|
41
|
+
rdoc.rdoc_dir = 'rdoc'
|
42
|
+
rdoc.title = "spree_featured #{version}"
|
43
|
+
rdoc.rdoc_files.include('README*')
|
44
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
45
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
@@ -0,0 +1 @@
|
|
1
|
+
<th><%= sort_link @search,:featured, t("featured?") %></th>
|
@@ -0,0 +1 @@
|
|
1
|
+
<td><%= product.featured? ? image_tag('admin/icons/tick.png') : '' %></td>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<% if !Product.featured.empty? %>
|
2
|
+
<h3><%= t(:featured) %></h3>
|
3
|
+
|
4
|
+
<ul class="featured-listing product-listing">
|
5
|
+
<% Product.featured.each do |product| %>
|
6
|
+
<% if Spree::Config[:show_zero_stock_product] || product.has_stock? %>
|
7
|
+
<li id="product_<%= product.id %>">
|
8
|
+
<%= link_to small_image(product), product %>
|
9
|
+
<%= link_to raw(product.name + " <span class='price selling'>#{product_price(product)}</span>"), product, :class => 'info' %>
|
10
|
+
</li>
|
11
|
+
<% end %>
|
12
|
+
<% end %>
|
13
|
+
</ul>
|
14
|
+
|
15
|
+
<hr class="space" />
|
16
|
+
<% end %>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spree_core'
|
2
|
+
require 'spree_featured_hooks'
|
3
|
+
|
4
|
+
module SpreeFeatured
|
5
|
+
class Engine < Rails::Engine
|
6
|
+
|
7
|
+
config.autoload_paths += %W(#{config.root}/lib)
|
8
|
+
|
9
|
+
def self.activate
|
10
|
+
Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
|
11
|
+
Rails.env.production? ? require(c) : load(c)
|
12
|
+
end
|
13
|
+
|
14
|
+
Product.class_eval do
|
15
|
+
scope :featured,:conditions => ['deleted_at is null and featured = ?', true]
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
config.to_prepare &method(:activate).to_proc
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,5 @@
|
|
1
|
+
class SpreeFeaturedHooks < Spree::ThemeSupport::HookListener
|
2
|
+
insert_after :admin_product_form_right, 'admin/products/spree_featured_admin_product_fields.html'
|
3
|
+
insert_after :admin_products_index_rows, 'admin/products/spree_featured_admin_product_listing.html'
|
4
|
+
insert_after :admin_products_index_headers, 'admin/products/spree_featured_admin_product_headers.html'
|
5
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
namespace :spree_featured do
|
2
|
+
desc "Copies all migrations and assets (NOTE: This will be obsolete with Rails 3.1)"
|
3
|
+
task :install do
|
4
|
+
Rake::Task['spree_featured:install:migrations'].invoke
|
5
|
+
Rake::Task['spree_featured:install:assets'].invoke
|
6
|
+
end
|
7
|
+
|
8
|
+
namespace :install do
|
9
|
+
desc "Copies all migrations (NOTE: This will be obsolete with Rails 3.1)"
|
10
|
+
task :migrations do
|
11
|
+
source = File.join(File.dirname(__FILE__), '..', '..', 'db')
|
12
|
+
destination = File.join(Rails.root, 'db')
|
13
|
+
puts "INFO: Mirroring assets from #{source} to #{destination}"
|
14
|
+
Spree::FileUtilz.mirror_files(source, destination)
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "Copies all assets (NOTE: This will be obsolete with Rails 3.1)"
|
18
|
+
task :assets do
|
19
|
+
source = File.join(File.dirname(__FILE__), '..', '..', 'public')
|
20
|
+
destination = File.join(Rails.root, 'public')
|
21
|
+
puts "INFO: Mirroring assets from #{source} to #{destination}"
|
22
|
+
Spree::FileUtilz.mirror_files(source, destination)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
# add custom rake tasks here
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{spree_featured}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Felix Hanley"]
|
12
|
+
s.date = %q{2011-05-18}
|
13
|
+
s.description = %q{Adds the basic ability to 'feature' products. Includes basic administration additions to enable and disable featured products and show featured products in the product list view.}
|
14
|
+
s.email = %q{felix@seconddrawer.com.au}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.mkd"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
"LICENSE.txt",
|
21
|
+
"README.mkd",
|
22
|
+
"Rakefile",
|
23
|
+
"VERSION",
|
24
|
+
"app/views/admin/products/_spree_featured_admin_product_fields.html.erb",
|
25
|
+
"app/views/admin/products/_spree_featured_admin_product_headers.html.erb",
|
26
|
+
"app/views/admin/products/_spree_featured_admin_product_listing.html.erb",
|
27
|
+
"app/views/shared/_featured.html.erb",
|
28
|
+
"config/locales/en.yml",
|
29
|
+
"db/migrate/20101221123800_add_product_featured_field.rb",
|
30
|
+
"lib/spree_featured.rb",
|
31
|
+
"lib/spree_featured_hooks.rb",
|
32
|
+
"lib/tasks/install.rake",
|
33
|
+
"lib/tasks/spree_featured.rake",
|
34
|
+
"spree_featured.gemspec"
|
35
|
+
]
|
36
|
+
s.homepage = %q{http://github.com/felix/spree-featured}
|
37
|
+
s.licenses = ["MIT"]
|
38
|
+
s.require_paths = ["lib"]
|
39
|
+
s.rubygems_version = %q{1.6.2}
|
40
|
+
s.summary = %q{Featured products in Spree}
|
41
|
+
|
42
|
+
if s.respond_to? :specification_version then
|
43
|
+
s.specification_version = 3
|
44
|
+
|
45
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
46
|
+
else
|
47
|
+
end
|
48
|
+
else
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
metadata
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: spree_featured
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.1.0
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Felix Hanley
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-05-18 00:00:00 +07:00
|
14
|
+
default_executable:
|
15
|
+
dependencies: []
|
16
|
+
|
17
|
+
description: Adds the basic ability to 'feature' products. Includes basic administration additions to enable and disable featured products and show featured products in the product list view.
|
18
|
+
email: felix@seconddrawer.com.au
|
19
|
+
executables: []
|
20
|
+
|
21
|
+
extensions: []
|
22
|
+
|
23
|
+
extra_rdoc_files:
|
24
|
+
- LICENSE.txt
|
25
|
+
- README.mkd
|
26
|
+
files:
|
27
|
+
- LICENSE.txt
|
28
|
+
- README.mkd
|
29
|
+
- Rakefile
|
30
|
+
- VERSION
|
31
|
+
- app/views/admin/products/_spree_featured_admin_product_fields.html.erb
|
32
|
+
- app/views/admin/products/_spree_featured_admin_product_headers.html.erb
|
33
|
+
- app/views/admin/products/_spree_featured_admin_product_listing.html.erb
|
34
|
+
- app/views/shared/_featured.html.erb
|
35
|
+
- config/locales/en.yml
|
36
|
+
- db/migrate/20101221123800_add_product_featured_field.rb
|
37
|
+
- lib/spree_featured.rb
|
38
|
+
- lib/spree_featured_hooks.rb
|
39
|
+
- lib/tasks/install.rake
|
40
|
+
- lib/tasks/spree_featured.rake
|
41
|
+
- spree_featured.gemspec
|
42
|
+
has_rdoc: true
|
43
|
+
homepage: http://github.com/felix/spree-featured
|
44
|
+
licenses:
|
45
|
+
- MIT
|
46
|
+
post_install_message:
|
47
|
+
rdoc_options: []
|
48
|
+
|
49
|
+
require_paths:
|
50
|
+
- lib
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: "0"
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: "0"
|
63
|
+
requirements: []
|
64
|
+
|
65
|
+
rubyforge_project:
|
66
|
+
rubygems_version: 1.6.2
|
67
|
+
signing_key:
|
68
|
+
specification_version: 3
|
69
|
+
summary: Featured products in Spree
|
70
|
+
test_files: []
|
71
|
+
|