spree_add_on_menu 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +14 -0
- data/.rspec +1 -0
- data/Gemfile +6 -0
- data/LICENSE +26 -0
- data/README.ja.md +63 -0
- data/README.md +63 -0
- data/Rakefile +15 -0
- data/app/assets/javascripts/admin/spree_add_on_menu.js +1 -0
- data/app/assets/javascripts/store/spree_add_on_menu.js +1 -0
- data/app/assets/stylesheets/admin/spree_add_on_menu.css +3 -0
- data/app/assets/stylesheets/store/spree_add_on_menu.css +3 -0
- data/app/controllers/spree/admin/add_on_menu_controller.rb +10 -0
- data/app/overrides/add_on_menu_to_admin_menu.rb +6 -0
- data/app/views/spree/admin/add_on_menu/index.html.erb +9 -0
- data/bin/rails +7 -0
- data/config/locales/en.yml +6 -0
- data/config/locales/ja.yml +3 -0
- data/config/routes.rb +6 -0
- data/lib/generators/spree_add_on_menu/install/install_generator.rb +31 -0
- data/lib/spree_add_on_menu/engine.rb +22 -0
- data/lib/spree_add_on_menu/factories.rb +6 -0
- data/lib/spree_add_on_menu.rb +2 -0
- data/spec/spec_helper.rb +82 -0
- data/spree_add_on_menu.gemspec +31 -0
- metadata +29 -4
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
Copyright (c) 2014 [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.ja.md
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
SpreeAddOnMenu
|
2
|
+
==============
|
3
|
+
|
4
|
+
目的
|
5
|
+
-------
|
6
|
+
* admin_tabsに「マスタ管理」が追加されます。
|
7
|
+
* 「マスタ管理」は単なるインデックスページを表示します。
|
8
|
+
* インデックスページに追加データに関するリンクを貼るなど、他のエクステンションに使用されることを期待しています。
|
9
|
+
|
10
|
+
![ADD ON MENU index](https://raw.githubusercontent.com/wiki/digitalm/spree_add_on_menu/images/menu1.jpg)
|
11
|
+
|
12
|
+
設置方法
|
13
|
+
------------
|
14
|
+
|
15
|
+
Gemfileに追加します:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
gem 'spree_add_on_menu'
|
19
|
+
```
|
20
|
+
|
21
|
+
Bundleしてインストールします:
|
22
|
+
|
23
|
+
```shell
|
24
|
+
bundle
|
25
|
+
bundle exec rails g spree_add_on_menu:install
|
26
|
+
```
|
27
|
+
|
28
|
+
リンクを加える方法:
|
29
|
+
-------
|
30
|
+
例えばoverridesフォルダにDefaceします
|
31
|
+
|
32
|
+
app/overrides/add_add_on_supplier_configration_menu_to_add_on_menu.rb
|
33
|
+
|
34
|
+
Deface::Override.new(:virtual_path => 'spree/admin/add_on_menu/index',
|
35
|
+
:name => 'add_add_on_supplier_configration_menu_to_add_on_menu',
|
36
|
+
:insert_bottom => "[data-hook='admin_add_on_menu_sidebar_menu']",
|
37
|
+
:text => "
|
38
|
+
<%= configurations_sidebar_menu_item t('add_on.add_on_supplier'), admin_add_on_suppliers_path %>
|
39
|
+
")
|
40
|
+
|
41
|
+
詳しくは他のエクステンションを参照してください
|
42
|
+
[spree_add_on_maker](https://github.com/digitalm/spree_add_on_maker)
|
43
|
+
[spree_add_on_supplier](https://github.com/digitalm/spree_add_on_supplier)
|
44
|
+
|
45
|
+
Testing
|
46
|
+
-------
|
47
|
+
|
48
|
+
Be sure to bundle your dependencies and then create a dummy test app for the specs to run against.
|
49
|
+
|
50
|
+
```shell
|
51
|
+
bundle
|
52
|
+
bundle exec rake test_app
|
53
|
+
bundle exec rspec spec
|
54
|
+
```
|
55
|
+
|
56
|
+
When testing your applications integration with this extension you may use it's factories.
|
57
|
+
Simply add this require statement to your spec_helper:
|
58
|
+
|
59
|
+
```ruby
|
60
|
+
require 'spree_add_on_menu/factories'
|
61
|
+
```
|
62
|
+
|
63
|
+
Copyright (c) 2014 [Exsight.inc](http://www.exsight.co.jp/) , released under the New BSD License
|
data/README.md
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
SpreeAddOnMenu
|
2
|
+
==============
|
3
|
+
|
4
|
+
Purpose
|
5
|
+
-------
|
6
|
+
* Just Adds "ADD ON MENUS" to admin_tabs.
|
7
|
+
* "ADD ON MENUS" simply shows an blank Index page titled "MASTER CONTROLS".
|
8
|
+
* Expected to be used for other extensions, things like putting a link on the additional data to this index page.
|
9
|
+
|
10
|
+
![ADD ON MENU index](https://raw.githubusercontent.com/wiki/digitalm/spree_add_on_menu/images/menu1.jpg)
|
11
|
+
|
12
|
+
Installation
|
13
|
+
------------
|
14
|
+
|
15
|
+
Add spree_add_on_menu to your Gemfile:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
gem 'spree_add_on_menu'
|
19
|
+
```
|
20
|
+
|
21
|
+
Bundle your dependencies and run the installation generator:
|
22
|
+
|
23
|
+
```shell
|
24
|
+
bundle
|
25
|
+
bundle exec rails g spree_add_on_menu:install
|
26
|
+
```
|
27
|
+
|
28
|
+
To Add Links to MASTER CONTROLS:
|
29
|
+
-------
|
30
|
+
for example
|
31
|
+
|
32
|
+
app/overrides/add_add_on_supplier_configration_menu_to_add_on_menu.rb
|
33
|
+
|
34
|
+
Deface::Override.new(:virtual_path => 'spree/admin/add_on_menu/index',
|
35
|
+
:name => 'add_add_on_supplier_configration_menu_to_add_on_menu',
|
36
|
+
:insert_bottom => "[data-hook='admin_add_on_menu_sidebar_menu']",
|
37
|
+
:text => "
|
38
|
+
<%= configurations_sidebar_menu_item t('add_on.add_on_supplier'), admin_add_on_suppliers_path %>
|
39
|
+
")
|
40
|
+
|
41
|
+
Please check out the details here
|
42
|
+
[spree_add_on_maker](https://github.com/digitalm/spree_add_on_maker)
|
43
|
+
[spree_add_on_supplier](https://github.com/digitalm/spree_add_on_supplier)
|
44
|
+
|
45
|
+
Testing
|
46
|
+
-------
|
47
|
+
|
48
|
+
Be sure to bundle your dependencies and then create a dummy test app for the specs to run against.
|
49
|
+
|
50
|
+
```shell
|
51
|
+
bundle
|
52
|
+
bundle exec rake test_app
|
53
|
+
bundle exec rspec spec
|
54
|
+
```
|
55
|
+
|
56
|
+
When testing your applications integration with this extension you may use it's factories.
|
57
|
+
Simply add this require statement to your spec_helper:
|
58
|
+
|
59
|
+
```ruby
|
60
|
+
require 'spree_add_on_menu/factories'
|
61
|
+
```
|
62
|
+
|
63
|
+
Copyright (c) 2014 [Exsight.inc](http://www.exsight.co.jp/) , released under the New BSD License
|
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
Bundler::GemHelper.install_tasks
|
3
|
+
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
require 'spree/testing_support/extension_rake'
|
6
|
+
|
7
|
+
RSpec::Core::RakeTask.new
|
8
|
+
|
9
|
+
task :default => [:spec]
|
10
|
+
|
11
|
+
desc 'Generates a dummy app for testing'
|
12
|
+
task :test_app do
|
13
|
+
ENV['LIB_NAME'] = 'spree_add_on_menu'
|
14
|
+
Rake::Task['extension:test_app'].invoke
|
15
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require admin/spree_backend
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require store/spree_frontend
|
@@ -0,0 +1,6 @@
|
|
1
|
+
Deface::Override.new(:virtual_path => 'spree/admin/shared/_menu',
|
2
|
+
:name => 'add_on_menu_to_admin_menu',
|
3
|
+
:insert_bottom => "[data-hook='admin_tabs']",
|
4
|
+
:text => "
|
5
|
+
<%= tab(:add_on_menu, :label => 'add_on_menu', :url => spree.admin_add_on_menu_path, :icon => 'icon-th-large') %>
|
6
|
+
")
|
data/bin/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_add_on_menu/engine', __FILE__)
|
5
|
+
|
6
|
+
require 'rails/all'
|
7
|
+
require 'rails/engine/commands'
|
data/config/routes.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
module SpreeAddOnMenu
|
2
|
+
module Generators
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
4
|
+
|
5
|
+
class_option :auto_run_migrations, :type => :boolean, :default => false
|
6
|
+
|
7
|
+
def add_javascripts
|
8
|
+
append_file 'app/assets/javascripts/store/all.js', "//= require store/spree_add_on_menu\n"
|
9
|
+
append_file 'app/assets/javascripts/admin/all.js', "//= require admin/spree_add_on_menu\n"
|
10
|
+
end
|
11
|
+
|
12
|
+
def add_stylesheets
|
13
|
+
inject_into_file 'app/assets/stylesheets/store/all.css', " *= require store/spree_add_on_menu\n", :before => /\*\//, :verbose => true
|
14
|
+
inject_into_file 'app/assets/stylesheets/admin/all.css', " *= require admin/spree_add_on_menu\n", :before => /\*\//, :verbose => true
|
15
|
+
end
|
16
|
+
|
17
|
+
def add_migrations
|
18
|
+
run 'bundle exec rake railties:install:migrations FROM=spree_add_on_menu'
|
19
|
+
end
|
20
|
+
|
21
|
+
def run_migrations
|
22
|
+
run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask 'Would you like to run the migrations now? [Y/n]')
|
23
|
+
if run_migrations
|
24
|
+
run 'bundle exec rake db:migrate'
|
25
|
+
else
|
26
|
+
puts 'Skipping rake db:migrate, don\'t forget to run it!'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module SpreeAddOnMenu
|
2
|
+
class Engine < Rails::Engine
|
3
|
+
require 'spree/core'
|
4
|
+
isolate_namespace Spree
|
5
|
+
engine_name 'spree_add_on_menu'
|
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
|
@@ -0,0 +1,6 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
# Define your Spree extensions Factories within this file to enable applications, and other extensions to use and override them.
|
3
|
+
#
|
4
|
+
# Example adding this to your spec_helper will load these Factories for use:
|
5
|
+
# require 'spree_add_on_menu/factories'
|
6
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
# Run Coverage report
|
2
|
+
require 'simplecov'
|
3
|
+
SimpleCov.start do
|
4
|
+
add_filter 'spec/dummy'
|
5
|
+
add_group 'Controllers', 'app/controllers'
|
6
|
+
add_group 'Helpers', 'app/helpers'
|
7
|
+
add_group 'Mailers', 'app/mailers'
|
8
|
+
add_group 'Models', 'app/models'
|
9
|
+
add_group 'Views', 'app/views'
|
10
|
+
add_group 'Libraries', 'lib'
|
11
|
+
end
|
12
|
+
|
13
|
+
# Configure Rails Environment
|
14
|
+
ENV['RAILS_ENV'] = 'test'
|
15
|
+
|
16
|
+
require File.expand_path('../dummy/config/environment.rb', __FILE__)
|
17
|
+
|
18
|
+
require 'rspec/rails'
|
19
|
+
require 'database_cleaner'
|
20
|
+
require 'ffaker'
|
21
|
+
|
22
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
23
|
+
# in spec/support/ and its subdirectories.
|
24
|
+
Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |f| require f }
|
25
|
+
|
26
|
+
# Requires factories defined in spree_core
|
27
|
+
require 'spree/testing_support/factories'
|
28
|
+
require 'spree/testing_support/controller_requests'
|
29
|
+
require 'spree/testing_support/authorization_helpers'
|
30
|
+
require 'spree/testing_support/url_helpers'
|
31
|
+
|
32
|
+
# Requires factories defined in lib/spree_add_on_menu/factories.rb
|
33
|
+
require 'spree_add_on_menu/factories'
|
34
|
+
|
35
|
+
RSpec.configure do |config|
|
36
|
+
config.include FactoryGirl::Syntax::Methods
|
37
|
+
|
38
|
+
# == URL Helpers
|
39
|
+
#
|
40
|
+
# Allows access to Spree's routes in specs:
|
41
|
+
#
|
42
|
+
# visit spree.admin_path
|
43
|
+
# current_path.should eql(spree.products_path)
|
44
|
+
config.include Spree::TestingSupport::UrlHelpers
|
45
|
+
|
46
|
+
# == Mock Framework
|
47
|
+
#
|
48
|
+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
49
|
+
#
|
50
|
+
# config.mock_with :mocha
|
51
|
+
# config.mock_with :flexmock
|
52
|
+
# config.mock_with :rr
|
53
|
+
config.mock_with :rspec
|
54
|
+
config.color = true
|
55
|
+
|
56
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
57
|
+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
58
|
+
|
59
|
+
# Capybara javascript drivers require transactional fixtures set to false, and we use DatabaseCleaner
|
60
|
+
# to cleanup after each test instead. Without transactional fixtures set to false the records created
|
61
|
+
# to setup a test will be unavailable to the browser, which runs under a seperate server instance.
|
62
|
+
config.use_transactional_fixtures = false
|
63
|
+
|
64
|
+
# Ensure Suite is set to use transactions for speed.
|
65
|
+
config.before :suite do
|
66
|
+
DatabaseCleaner.strategy = :transaction
|
67
|
+
DatabaseCleaner.clean_with :truncation
|
68
|
+
end
|
69
|
+
|
70
|
+
# Before each spec check if it is a Javascript test and switch between using database transactions or not where necessary.
|
71
|
+
config.before :each do
|
72
|
+
DatabaseCleaner.strategy = example.metadata[:js] ? :truncation : :transaction
|
73
|
+
DatabaseCleaner.start
|
74
|
+
end
|
75
|
+
|
76
|
+
# After each spec clean the database.
|
77
|
+
config.after :each do
|
78
|
+
DatabaseCleaner.clean
|
79
|
+
end
|
80
|
+
|
81
|
+
config.fail_fast = ENV['FAIL_FAST'] || false
|
82
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
Gem::Specification.new do |s|
|
3
|
+
s.platform = Gem::Platform::RUBY
|
4
|
+
s.name = 'spree_add_on_menu'
|
5
|
+
s.version = '0.1.1'
|
6
|
+
s.summary = 'Spree Extension : Show add_on_menu on admin_tabs and blank index page'
|
7
|
+
s.description = 'Just Adds "ADD ON MENUS" to admin_tabs."ADD ON MENUS" simply shows a blank Index page titled "MASTER CONTROLS".Expected to be used for other extensions, things like putting a link on the additional data to this index page.'
|
8
|
+
s.required_ruby_version = '>= 1.9.3'
|
9
|
+
|
10
|
+
s.author = 'Mika Mizuno'
|
11
|
+
s.email = 'mika.mizuno@exsight.co.jp'
|
12
|
+
s.homepage = 'http://www.exsight.co.jp'
|
13
|
+
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
+
s.require_path = 'lib'
|
17
|
+
s.requirements << 'none'
|
18
|
+
|
19
|
+
s.add_dependency 'spree_core', '~> 2.1.4'
|
20
|
+
|
21
|
+
s.add_development_dependency 'capybara', '~> 2.1'
|
22
|
+
s.add_development_dependency 'coffee-rails'
|
23
|
+
s.add_development_dependency 'database_cleaner'
|
24
|
+
s.add_development_dependency 'factory_girl', '~> 4.2'
|
25
|
+
s.add_development_dependency 'ffaker'
|
26
|
+
s.add_development_dependency 'rspec-rails', '~> 2.13'
|
27
|
+
s.add_development_dependency 'sass-rails'
|
28
|
+
s.add_development_dependency 'selenium-webdriver'
|
29
|
+
s.add_development_dependency 'simplecov'
|
30
|
+
s.add_development_dependency 'sqlite3'
|
31
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_add_on_menu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-05-
|
12
|
+
date: 2014-05-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: spree_core
|
@@ -194,7 +194,31 @@ email: mika.mizuno@exsight.co.jp
|
|
194
194
|
executables: []
|
195
195
|
extensions: []
|
196
196
|
extra_rdoc_files: []
|
197
|
-
files:
|
197
|
+
files:
|
198
|
+
- .gitignore
|
199
|
+
- .rspec
|
200
|
+
- Gemfile
|
201
|
+
- LICENSE
|
202
|
+
- README.ja.md
|
203
|
+
- README.md
|
204
|
+
- Rakefile
|
205
|
+
- app/assets/javascripts/admin/spree_add_on_menu.js
|
206
|
+
- app/assets/javascripts/store/spree_add_on_menu.js
|
207
|
+
- app/assets/stylesheets/admin/spree_add_on_menu.css
|
208
|
+
- app/assets/stylesheets/store/spree_add_on_menu.css
|
209
|
+
- app/controllers/spree/admin/add_on_menu_controller.rb
|
210
|
+
- app/overrides/add_on_menu_to_admin_menu.rb
|
211
|
+
- app/views/spree/admin/add_on_menu/index.html.erb
|
212
|
+
- bin/rails
|
213
|
+
- config/locales/en.yml
|
214
|
+
- config/locales/ja.yml
|
215
|
+
- config/routes.rb
|
216
|
+
- lib/generators/spree_add_on_menu/install/install_generator.rb
|
217
|
+
- lib/spree_add_on_menu.rb
|
218
|
+
- lib/spree_add_on_menu/engine.rb
|
219
|
+
- lib/spree_add_on_menu/factories.rb
|
220
|
+
- spec/spec_helper.rb
|
221
|
+
- spree_add_on_menu.gemspec
|
198
222
|
homepage: http://www.exsight.co.jp
|
199
223
|
licenses: []
|
200
224
|
post_install_message:
|
@@ -220,4 +244,5 @@ rubygems_version: 1.8.23
|
|
220
244
|
signing_key:
|
221
245
|
specification_version: 3
|
222
246
|
summary: ! 'Spree Extension : Show add_on_menu on admin_tabs and blank index page'
|
223
|
-
test_files:
|
247
|
+
test_files:
|
248
|
+
- spec/spec_helper.rb
|