spree_taxonomy_style 1.1.3
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/LICENSE +26 -0
- data/README.md +21 -0
- data/Rakefile +29 -0
- data/Versionfile +11 -0
- data/app/assets/javascripts/admin/spree_taxonomy_style.js +1 -0
- data/app/assets/javascripts/store/spree_taxonomy_style.js +1 -0
- data/app/assets/stylesheets/admin/spree_taxonomy_style.css +3 -0
- data/app/assets/stylesheets/store/spree_taxonomy_style.css +3 -0
- data/app/models/taxon_decorator.rb +23 -0
- data/app/models/taxonomy_decorator.rb +17 -0
- data/app/overrides/admin/add_style_form_fields.rb +11 -0
- data/app/views/spree/admin/taxonomies/_style_selector.erb +5 -0
- data/app/views/spree/admin/taxons/_style_selector.erb +5 -0
- data/config/locales/en.yml +5 -0
- data/config/routes.rb +3 -0
- data/db/migrate/20120815094330_add_taxon_and_taxonomy_style.rb +6 -0
- data/lib/generators/spree_taxonomy_style/install/install_generator.rb +29 -0
- data/lib/spree_taxonomy_style/engine.rb +22 -0
- data/lib/spree_taxonomy_style.rb +2 -0
- data/script/rails +7 -0
- data/spec/spec_helper.rb +44 -0
- data/spree_taxonomy_style.gemspec +26 -0
- metadata +136 -0
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
data/Gemfile
ADDED
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,21 @@
|
|
1
|
+
SpreeTaxonomyStyle
|
2
|
+
==================
|
3
|
+
|
4
|
+
Introduction goes here.
|
5
|
+
|
6
|
+
|
7
|
+
Example
|
8
|
+
=======
|
9
|
+
|
10
|
+
Example goes here.
|
11
|
+
|
12
|
+
Testing
|
13
|
+
-------
|
14
|
+
|
15
|
+
Be sure to bundle your dependencies and then create a dummy test app for the specs to run against.
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
$ bundle exec rake test_app
|
19
|
+
$ bundle exec rspec spec
|
20
|
+
|
21
|
+
Copyright (c) 2012 [name of extension creator], released under the New BSD License
|
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_taxonomy_style.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_taxonomy_style'
|
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' => { :branch => '1-1-stable' }
|
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
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require admin/spree_core
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require store/spree_core
|
@@ -0,0 +1,23 @@
|
|
1
|
+
Spree::Taxon.class_eval do
|
2
|
+
attr_accessible(:style)
|
3
|
+
|
4
|
+
def display_style
|
5
|
+
return style unless style.blank?
|
6
|
+
return parent.display_style if parent && parent.display_style
|
7
|
+
return ""
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
Spree::Taxon.instance_eval do
|
12
|
+
def styles
|
13
|
+
@styles ||= []
|
14
|
+
end
|
15
|
+
|
16
|
+
def styles=(styles)
|
17
|
+
@styles = styles
|
18
|
+
end
|
19
|
+
|
20
|
+
def styles_dropdown
|
21
|
+
styles.map {|s| [s.humanize, s]}
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
Spree::Taxonomy.class_eval do
|
2
|
+
attr_accessible(:style)
|
3
|
+
end
|
4
|
+
|
5
|
+
Spree::Taxonomy.instance_eval do
|
6
|
+
def styles
|
7
|
+
@styles ||= []
|
8
|
+
end
|
9
|
+
|
10
|
+
def styles=(styles)
|
11
|
+
@styles = styles
|
12
|
+
end
|
13
|
+
|
14
|
+
def styles_dropdown
|
15
|
+
styles.map {|s| [s.humanize, s]}
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Deface::Override.new(
|
2
|
+
virtual_path: "spree/admin/taxonomies/_form",
|
3
|
+
partial: 'spree/admin/taxonomies/style_selector',
|
4
|
+
insert_bottom: "[data-hook='admin_taxonomy_form_fields']",
|
5
|
+
name: 'add_taxonomy_style_selector')
|
6
|
+
|
7
|
+
Deface::Override.new(
|
8
|
+
virtual_path: "spree/admin/taxons/_form",
|
9
|
+
partial: 'spree/admin/taxons/style_selector',
|
10
|
+
insert_bottom: "[data-hook='admin_taxon_form_fields']",
|
11
|
+
name: 'add_taxon_style_selector')
|
data/config/routes.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
module SpreeTaxonomyStyle
|
2
|
+
module Generators
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
4
|
+
|
5
|
+
def add_javascripts
|
6
|
+
append_file 'app/assets/javascripts/store/all.js', "//= require store/spree_taxonomy_style\n"
|
7
|
+
append_file 'app/assets/javascripts/admin/all.js', "//= require admin/spree_taxonomy_style\n"
|
8
|
+
end
|
9
|
+
|
10
|
+
def add_stylesheets
|
11
|
+
inject_into_file 'app/assets/stylesheets/store/all.css', " *= require store/spree_taxonomy_style\n", :before => /\*\//, :verbose => true
|
12
|
+
inject_into_file 'app/assets/stylesheets/admin/all.css', " *= require admin/spree_taxonomy_style\n", :before => /\*\//, :verbose => true
|
13
|
+
end
|
14
|
+
|
15
|
+
def add_migrations
|
16
|
+
run 'bundle exec rake railties:install:migrations FROM=spree_taxonomy_style'
|
17
|
+
end
|
18
|
+
|
19
|
+
def run_migrations
|
20
|
+
res = ask 'Would you like to run the migrations now? [Y/n]'
|
21
|
+
if res == '' || res.downcase == 'y'
|
22
|
+
run 'bundle exec rake db:migrate'
|
23
|
+
else
|
24
|
+
puts 'Skipping rake db:migrate, don\'t forget to run it!'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module SpreeTaxonomyStyle
|
2
|
+
class Engine < Rails::Engine
|
3
|
+
require 'spree/core'
|
4
|
+
isolate_namespace Spree
|
5
|
+
engine_name 'spree_taxonomy_style'
|
6
|
+
|
7
|
+
config.autoload_paths += %W(#{config.root}/lib)
|
8
|
+
|
9
|
+
# use rspec for tests
|
10
|
+
config.generators do |g|
|
11
|
+
g.test_framework :rspec
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.activate
|
15
|
+
Dir.glob(File.join(File.dirname(__FILE__), '../../app/**/*_decorator*.rb')) do |c|
|
16
|
+
Rails.configuration.cache_classes ? require(c) : load(c)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
config.to_prepare &method(:activate).to_proc
|
21
|
+
end
|
22
|
+
end
|
data/script/rails
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
2
|
+
|
3
|
+
ENGINE_ROOT = File.expand_path('../..', __FILE__)
|
4
|
+
ENGINE_PATH = File.expand_path('../../lib/spree_taxonomy_style/engine', __FILE__)
|
5
|
+
|
6
|
+
require 'rails/all'
|
7
|
+
require 'rails/engine/commands'
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# Configure Rails Environment
|
2
|
+
ENV['RAILS_ENV'] = 'test'
|
3
|
+
|
4
|
+
require File.expand_path('../dummy/config/environment.rb', __FILE__)
|
5
|
+
|
6
|
+
require 'rspec/rails'
|
7
|
+
require 'ffaker'
|
8
|
+
|
9
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
10
|
+
# in spec/support/ and its subdirectories.
|
11
|
+
Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |f| require f }
|
12
|
+
|
13
|
+
# Requires factories defined in spree_core
|
14
|
+
require 'spree/core/testing_support/factories'
|
15
|
+
require 'spree/core/url_helpers'
|
16
|
+
|
17
|
+
RSpec.configure do |config|
|
18
|
+
config.include FactoryGirl::Syntax::Methods
|
19
|
+
|
20
|
+
# == URL Helpers
|
21
|
+
#
|
22
|
+
# Allows access to Spree's routes in specs:
|
23
|
+
#
|
24
|
+
# visit spree.admin_path
|
25
|
+
# current_path.should eql(spree.products_path)
|
26
|
+
config.include Spree::Core::UrlHelpers
|
27
|
+
|
28
|
+
# == Mock Framework
|
29
|
+
#
|
30
|
+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
31
|
+
#
|
32
|
+
# config.mock_with :mocha
|
33
|
+
# config.mock_with :flexmock
|
34
|
+
# config.mock_with :rr
|
35
|
+
config.mock_with :rspec
|
36
|
+
|
37
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
38
|
+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
39
|
+
|
40
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
41
|
+
# examples within a transaction, remove the following line or assign false
|
42
|
+
# instead of true.
|
43
|
+
config.use_transactional_fixtures = true
|
44
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
Gem::Specification.new do |s|
|
3
|
+
s.platform = Gem::Platform::RUBY
|
4
|
+
s.name = 'spree_taxonomy_style'
|
5
|
+
s.version = '1.1.3'
|
6
|
+
s.summary = 'Adds stlye field to taxonomies'
|
7
|
+
s.description = 'Adds stlye field to taxonomies'
|
8
|
+
s.required_ruby_version = '>= 1.9.2'
|
9
|
+
|
10
|
+
s.author = 'Robert Oles'
|
11
|
+
s.email = 'robertoles@me.com'
|
12
|
+
s.homepage = 'http://www.lockside.co.uk'
|
13
|
+
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
|
19
|
+
s.add_dependency 'spree_core', '~> 1.1.3'
|
20
|
+
|
21
|
+
s.add_development_dependency 'capybara', '1.0.1'
|
22
|
+
s.add_development_dependency 'factory_girl', '~> 2.6.4'
|
23
|
+
s.add_development_dependency 'ffaker'
|
24
|
+
s.add_development_dependency 'rspec-rails', '~> 2.9'
|
25
|
+
s.add_development_dependency 'sqlite3'
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,136 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: spree_taxonomy_style
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.3
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Robert Oles
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-09-04 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: spree_core
|
16
|
+
requirement: &70159194697560 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.1.3
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70159194697560
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: capybara
|
27
|
+
requirement: &70159194696860 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - =
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.0.1
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70159194696860
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: factory_girl
|
38
|
+
requirement: &70159194696360 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 2.6.4
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70159194696360
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: ffaker
|
49
|
+
requirement: &70159194695800 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70159194695800
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: rspec-rails
|
60
|
+
requirement: &70159194694720 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ~>
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '2.9'
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *70159194694720
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: sqlite3
|
71
|
+
requirement: &70159194693760 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *70159194693760
|
80
|
+
description: Adds stlye field to taxonomies
|
81
|
+
email: robertoles@me.com
|
82
|
+
executables: []
|
83
|
+
extensions: []
|
84
|
+
extra_rdoc_files: []
|
85
|
+
files:
|
86
|
+
- .gitignore
|
87
|
+
- .rspec
|
88
|
+
- Gemfile
|
89
|
+
- LICENSE
|
90
|
+
- README.md
|
91
|
+
- Rakefile
|
92
|
+
- Versionfile
|
93
|
+
- app/assets/javascripts/admin/spree_taxonomy_style.js
|
94
|
+
- app/assets/javascripts/store/spree_taxonomy_style.js
|
95
|
+
- app/assets/stylesheets/admin/spree_taxonomy_style.css
|
96
|
+
- app/assets/stylesheets/store/spree_taxonomy_style.css
|
97
|
+
- app/models/taxon_decorator.rb
|
98
|
+
- app/models/taxonomy_decorator.rb
|
99
|
+
- app/overrides/admin/add_style_form_fields.rb
|
100
|
+
- app/views/spree/admin/taxonomies/_style_selector.erb
|
101
|
+
- app/views/spree/admin/taxons/_style_selector.erb
|
102
|
+
- config/locales/en.yml
|
103
|
+
- config/routes.rb
|
104
|
+
- db/migrate/20120815094330_add_taxon_and_taxonomy_style.rb
|
105
|
+
- lib/generators/spree_taxonomy_style/install/install_generator.rb
|
106
|
+
- lib/spree_taxonomy_style.rb
|
107
|
+
- lib/spree_taxonomy_style/engine.rb
|
108
|
+
- script/rails
|
109
|
+
- spec/spec_helper.rb
|
110
|
+
- spree_taxonomy_style.gemspec
|
111
|
+
homepage: http://www.lockside.co.uk
|
112
|
+
licenses: []
|
113
|
+
post_install_message:
|
114
|
+
rdoc_options: []
|
115
|
+
require_paths:
|
116
|
+
- lib
|
117
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
118
|
+
none: false
|
119
|
+
requirements:
|
120
|
+
- - ! '>='
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: 1.9.2
|
123
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
|
+
none: false
|
125
|
+
requirements:
|
126
|
+
- - ! '>='
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0'
|
129
|
+
requirements: []
|
130
|
+
rubyforge_project:
|
131
|
+
rubygems_version: 1.8.11
|
132
|
+
signing_key:
|
133
|
+
specification_version: 3
|
134
|
+
summary: Adds stlye field to taxonomies
|
135
|
+
test_files:
|
136
|
+
- spec/spec_helper.rb
|