spree-homepager 0.40.3

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ Redistribution and use in source and binary forms, with or without modification,
2
+ are permitted provided that the following conditions are met:
3
+
4
+ * Redistributions of source code must retain the above copyright notice,
5
+ this list of conditions and the following disclaimer.
6
+ * Redistributions in binary form must reproduce the above copyright notice,
7
+ this list of conditions and the following disclaimer in the documentation
8
+ and/or other materials provided with the distribution.
9
+ * Neither the name of the Rails Dog LLC nor the names of its
10
+ contributors may be used to endorse or promote products derived from this
11
+ software without specific prior written permission.
12
+
13
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
14
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
15
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
16
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
17
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,21 @@
1
+ Homepager
2
+ =========
3
+
4
+ Spree extension that creates a homepage and enables a shop owner to place products on that homepage.
5
+
6
+ Installation
7
+ ============
8
+
9
+ Add this to your Gemfile:
10
+
11
+ gem "spree-homepager", :git => "git://github.com/pero-ict/spree-homepager.git", :require => "homepager"
12
+
13
+ Next run:
14
+
15
+ bundle install
16
+ rake homepager:install
17
+ rake db:migrate
18
+
19
+ This will add a checkbox on the product edit page that you can check on to make the product appear on the homepage
20
+
21
+ Copyright (c) 2011 PeRo ICT Solutions, released under the New BSD License
@@ -0,0 +1,7 @@
1
+ class HomeController < Spree::BaseController
2
+ helper :products
3
+
4
+ def index
5
+ @products = Product.on_homepage.active
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ Product.class_eval do
2
+ scope :on_homepage, :conditions => ["show_on_homepage = ?", true]
3
+ end
@@ -0,0 +1 @@
1
+ <%= render "shared/products", :products => @products, :taxon => @taxon %>
@@ -0,0 +1,4 @@
1
+ <p>
2
+ <%= f.label :show_on_homepage, t("ext_homepager.show_on_homepage") %><br />
3
+ <%= f.check_box :show_on_homepage %>
4
+ </p>
@@ -0,0 +1,17 @@
1
+ require 'spree_core'
2
+ require 'homepager_hooks'
3
+
4
+ module Homepager
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
+ end
14
+
15
+ config.to_prepare &method(:activate).to_proc
16
+ end
17
+ end
@@ -0,0 +1,3 @@
1
+ class HomepagerHooks < Spree::ThemeSupport::HookListener
2
+ insert_after :admin_product_form_right, "shared/ext_homepager_admin_product_fields.html"
3
+ end
@@ -0,0 +1 @@
1
+ # add custom rake tasks here
@@ -0,0 +1,25 @@
1
+ namespace :homepager do
2
+ desc "Copies all migrations and assets (NOTE: This will be obsolete with Rails 3.1)"
3
+ task :install do
4
+ Rake::Task['homepager:install:migrations'].invoke
5
+ Rake::Task['homepager: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
+ Spree::FileUtilz.mirror_files(source, destination)
14
+ end
15
+
16
+ desc "Copies all assets (NOTE: This will be obsolete with Rails 3.1)"
17
+ task :assets do
18
+ source = File.join(File.dirname(__FILE__), '..', '..', 'public')
19
+ destination = File.join(Rails.root, 'public')
20
+ puts "INFO: Mirroring assets from #{source} to #{destination}"
21
+ Spree::FileUtilz.mirror_files(source, destination)
22
+ end
23
+ end
24
+
25
+ end
metadata ADDED
@@ -0,0 +1,93 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: spree-homepager
3
+ version: !ruby/object:Gem::Version
4
+ hash: 185
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 40
9
+ - 3
10
+ version: 0.40.3
11
+ platform: ruby
12
+ authors:
13
+ - Peter Berkenbosch
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-02-19 00:00:00 +01:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: spree_core
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 185
30
+ segments:
31
+ - 0
32
+ - 40
33
+ - 3
34
+ version: 0.40.3
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ description:
38
+ email: peter@pero-ict.nl
39
+ executables: []
40
+
41
+ extensions: []
42
+
43
+ extra_rdoc_files: []
44
+
45
+ files:
46
+ - README.md
47
+ - LICENSE
48
+ - lib/homepager.rb
49
+ - lib/homepager_hooks.rb
50
+ - lib/tasks/homepager.rake
51
+ - lib/tasks/install.rake
52
+ - app/controllers/home_controller.rb
53
+ - app/models/product_decorator.rb
54
+ - app/views/home/index.html.erb
55
+ - app/views/shared/_ext_homepager_admin_product_fields.html.erb
56
+ has_rdoc: true
57
+ homepage: http://www.pero-ict.nl
58
+ licenses: []
59
+
60
+ post_install_message:
61
+ rdoc_options: []
62
+
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ hash: 57
71
+ segments:
72
+ - 1
73
+ - 8
74
+ - 7
75
+ version: 1.8.7
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ none: false
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ hash: 3
82
+ segments:
83
+ - 0
84
+ version: "0"
85
+ requirements:
86
+ - none
87
+ rubyforge_project: spree-homepager
88
+ rubygems_version: 1.3.7
89
+ signing_key:
90
+ specification_version: 3
91
+ summary: Spree extension that creates a homepage and enables a shop owner to place products on that homepage.
92
+ test_files: []
93
+