spree_supplier 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +5 -0
- data/LICENSE.txt +22 -0
- data/README.md +31 -0
- data/Rakefile +1 -0
- data/app/controllers/spree/admin/suppliers_controller.rb +6 -0
- data/app/models/spree/product_decorator.rb +3 -0
- data/app/models/spree/supplier.rb +10 -0
- data/app/overrides/admin_tab.rb +6 -0
- data/app/views/spree/admin/suppliers/_form.html.erb +63 -0
- data/app/views/spree/admin/suppliers/edit.html.erb +20 -0
- data/app/views/spree/admin/suppliers/index.html.erb +51 -0
- data/app/views/spree/admin/suppliers/new.html.erb +20 -0
- data/config/routes.rb +5 -0
- data/db/migrate/20131214195339_create_suppliers.rb +14 -0
- data/db/migrate/20131215160936_add_supplier_key_to_products.rb +7 -0
- data/lib/generators/spree_supplier/install/install_generator.rb +18 -0
- data/lib/spree_supplier/engine.rb +24 -0
- data/lib/spree_supplier/version.rb +3 -0
- data/lib/spree_supplier.rb +6 -0
- data/spree_supplier.gemspec +28 -0
- metadata +121 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 11ca95d40b5086c974a75b5b54d7f157b4300ba1
|
4
|
+
data.tar.gz: 374c23b2ac2a7f6e7913715297ee2e74131a5e19
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3eb86f6bee5c6e9db44f25f1e3c0ebff94d6b64f8eeb2665a1df42c3734b47737577d08a03e33265eff705b046c5addee9b3ae52703ad1e017da96a4760650a8
|
7
|
+
data.tar.gz: 8bb7315b0caa235334f7fb24c80f83206f64b9812218abf395a2e5ef9a4cf2bc231a1dbc36cf6b70270d8a7c234325ac1080e86cb34a4f1eff6aa11eca7e05cc
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Bharat
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
Don't use this gem. Currently this is in under construction.
|
2
|
+
|
3
|
+
# SpreeSupplier
|
4
|
+
|
5
|
+
TODO: Write a gem description
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
gem 'spree_supplier'
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install spree_supplier
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
TODO: Write usage instructions here
|
24
|
+
|
25
|
+
## Contributing
|
26
|
+
|
27
|
+
1. Fork it ( http://github.com/<my-github-username>/spree_supplier/fork )
|
28
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
29
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
30
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
31
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,6 @@
|
|
1
|
+
Deface::Override.new(:virtual_path => "spree/admin/shared/_menu",
|
2
|
+
:name => "suppliers_tabs",
|
3
|
+
:insert_bottom => "[data-hook='admin_tabs'], #admin_tabs[data-hook]",
|
4
|
+
:text => "<%= tab(:suppliers, :icon => 'icon-th', url: spree.admin_suppliers_path) %>",
|
5
|
+
:disabled => false,
|
6
|
+
:original => '031652cf5a054796022506622082ab6d2693699f')
|
@@ -0,0 +1,63 @@
|
|
1
|
+
<div data-hook="admin_supplier_form_fields">
|
2
|
+
<div data-hook="admin_supplier_left_right" class="left eight columns columns">
|
3
|
+
<%= f.field_container :legal_name do %>
|
4
|
+
<%= f.label :legal_name, raw(Spree.t(:legal_name) + content_tag(:span, ' *', :class => 'required')) %>
|
5
|
+
<%= f.text_field :legal_name, :class => 'fullwidth title' %>
|
6
|
+
<%= f.error_message_on :legal_name %>
|
7
|
+
<% end %>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<div class="right four columns omega" data-hook="admin_supplier_form_right">
|
11
|
+
<%= f.field_container :name do %>
|
12
|
+
<%= f.label :name, raw(Spree.t(:name) + content_tag(:span, ' *', :class => 'required')) %>
|
13
|
+
<%= f.text_field :name, :class => 'fullwidth title' %>
|
14
|
+
<%= f.error_message_on :name %>
|
15
|
+
</div>
|
16
|
+
|
17
|
+
<div class="clear"></div>
|
18
|
+
|
19
|
+
<div class="left eight columns alpha">
|
20
|
+
<%= f.field_container :description do %>
|
21
|
+
<%= f.label :description, Spree.t(:description) %>
|
22
|
+
<%= f.text_area :description, {:rows => 5, :class => 'fullwidth'} %>
|
23
|
+
<div class="hint">
|
24
|
+
<%= Spree.t(:'hints.description') %>
|
25
|
+
<span class=".text-length-counter" data-target="#spree_supplier_description" data-max-length="350"></span>
|
26
|
+
</div>
|
27
|
+
<%= f.error_message_on :description %>
|
28
|
+
<% end %>
|
29
|
+
</div>
|
30
|
+
|
31
|
+
<div class="right four columns omega">
|
32
|
+
<%= f.field_container :address do %>
|
33
|
+
<%= f.label :address, raw(Spree.t(:address) + content_tag(:span, ' *', :class => 'required')) %>
|
34
|
+
<%= f.text_area :address, {:rows => 5, :class => 'fullwidth'} %>
|
35
|
+
<div class="hint">
|
36
|
+
<%= Spree.t(:'hints.address') %>
|
37
|
+
<span class=".text-length-counter" data-target="#spree_supplier_address" data-max-length="150"></span>
|
38
|
+
</div>
|
39
|
+
<%= f.error_message_on :address %>
|
40
|
+
<% end %>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div class="clear"></div>
|
44
|
+
|
45
|
+
<div class="left six columns alpha">
|
46
|
+
<%= f.field_container :phone do %>
|
47
|
+
<%= f.label :phone, raw(Spree.t(:phone) + content_tag(:span, ' *', :class => 'required')) %>
|
48
|
+
<%= f.text_field :phone, :class => 'fullwidth title' %>
|
49
|
+
<%= f.error_message_on :phone %>
|
50
|
+
<% end %>
|
51
|
+
</div>
|
52
|
+
|
53
|
+
<div class="right six columns alpha">
|
54
|
+
<%= f.field_container :email do %>
|
55
|
+
<%= f.label :email, raw(Spree.t(:email) + content_tag(:span, ' *', :class => 'required')) %>
|
56
|
+
<%= f.text_field :email, :class => 'fullwidth title' %>
|
57
|
+
<%= f.error_message_on :email %>
|
58
|
+
<% end %>
|
59
|
+
</div>
|
60
|
+
|
61
|
+
<div class="clear"></div>
|
62
|
+
|
63
|
+
</div>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<%= render :partial => 'spree/admin/shared/configuration_menu' %>
|
2
|
+
|
3
|
+
<% content_for :page_title do %>
|
4
|
+
<%= Spree.t(:editing_supplier) %>
|
5
|
+
<% end %>
|
6
|
+
|
7
|
+
<% content_for :page_actions do %>
|
8
|
+
<li>
|
9
|
+
<%= button_link_to Spree.t(:back_to_suppliers), spree.admin_suppliers_path, :icon => 'icon-arrow-left' %>
|
10
|
+
</li>
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<%= render :partial => 'spree/shared/error_messages', :locals => { :target => @supplier } %>
|
14
|
+
|
15
|
+
<%= form_for [:admin, @supplier] do |f| %>
|
16
|
+
<fieldset class="no-border-top">
|
17
|
+
<%= render :partial => 'form', :locals => { :f => f } %>
|
18
|
+
<%= render :partial => 'spree/admin/shared/edit_resource_links' %>
|
19
|
+
</fieldset>
|
20
|
+
<% end %>
|
@@ -0,0 +1,51 @@
|
|
1
|
+
<%= render 'spree/admin/shared/configuration_menu' %>
|
2
|
+
|
3
|
+
<% content_for :page_title do %>
|
4
|
+
<%= Spree.t(:suppliers) %>
|
5
|
+
<% end %>
|
6
|
+
|
7
|
+
<% content_for :page_actions do %>
|
8
|
+
<li>
|
9
|
+
<%= button_link_to Spree.t(:new_supplier), new_object_url, :icon => 'icon-plus' %>
|
10
|
+
</li>
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<% if @suppliers.any? %>
|
14
|
+
<table class="index">
|
15
|
+
<colgroup>
|
16
|
+
<col style="width: 10%">
|
17
|
+
<col style="width: 30%">
|
18
|
+
<col style="width: 20%">
|
19
|
+
<col style="width: 25%">
|
20
|
+
<col style="width: 15%">
|
21
|
+
</colgroup>
|
22
|
+
<thead>
|
23
|
+
<tr data-hook="suppliers_header">
|
24
|
+
<th>#</th>
|
25
|
+
<th><%= Spree.t(:name) %></th>
|
26
|
+
<th><%= Spree.t(:phone) %></th>
|
27
|
+
<th><%= Spree.t(:email) %></th>
|
28
|
+
<th class="actions"></th>
|
29
|
+
</tr>
|
30
|
+
</thead>
|
31
|
+
<tbody>
|
32
|
+
<% @suppliers.each_with_index do |supplier, index|%>
|
33
|
+
<tr id="<%= spree_dom_id supplier %>" data-hook="supplier_row" class="<%= cycle('odd', 'even')%>">
|
34
|
+
<td><%= index %></td>
|
35
|
+
<td class="align-center"><%= supplier.name %></td>
|
36
|
+
<td class="align-center"><%= supplier.phone %></td>
|
37
|
+
<td class="align-center"><%= supplier.email %></td>
|
38
|
+
<td class="actions">
|
39
|
+
<%= link_to_edit supplier, :no_text => true %>
|
40
|
+
<%= link_to_delete supplier, :no_text => true %>
|
41
|
+
</td>
|
42
|
+
</tr>
|
43
|
+
<% end %>
|
44
|
+
</tbody>
|
45
|
+
</table>
|
46
|
+
<% else %>
|
47
|
+
<div class="alpha twelve columns no-objects-found">
|
48
|
+
<%= Spree.t(:no_resource_found, resource: I18n.t(:other, scope: 'activerecord.models.spree/supplier')) %>,
|
49
|
+
<%= link_to Spree.t(:add_one), spree.new_admin_supplier_path %>!
|
50
|
+
</div>
|
51
|
+
<% end %>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<%= render :partial => 'spree/admin/shared/configuration_menu' %>
|
2
|
+
|
3
|
+
<% content_for :page_title do %>
|
4
|
+
<%= Spree.t(:new_supplier) %>
|
5
|
+
<% end %>
|
6
|
+
|
7
|
+
<% content_for :page_actions do %>
|
8
|
+
<li>
|
9
|
+
<%= button_link_to Spree.t(:back_to_suppliers_list), spree.admin_suppliers_path, :icon => 'icon-arrow-left' %>
|
10
|
+
</li>
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<%= render :partial => 'spree/shared/error_messages', :locals => { :target => @supplier } %>
|
14
|
+
|
15
|
+
<%= form_for [:admin, @supplier] do |f| %>
|
16
|
+
<fieldset class="no-border-top">
|
17
|
+
<%= render :partial => 'form', :locals => { :f => f } %>
|
18
|
+
<%= render :partial => 'spree/admin/shared/new_resource_links' %>
|
19
|
+
</fieldset>
|
20
|
+
<% end %>
|
data/config/routes.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
class CreateSuppliers < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :spree_suppliers do |t|
|
4
|
+
t.string :name
|
5
|
+
t.string :legal_name
|
6
|
+
t.text :description
|
7
|
+
t.text :address
|
8
|
+
t.string :phone
|
9
|
+
t.string :email
|
10
|
+
|
11
|
+
t.timestamps
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module SpreeSupplier
|
2
|
+
module Generators
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
4
|
+
def add_migrations
|
5
|
+
run 'bundle exec rake railties:install:migrations FROM=spree_payone'
|
6
|
+
end
|
7
|
+
|
8
|
+
def run_migrations
|
9
|
+
res = ask "Would you like to run the migrations now? [Y/n]"
|
10
|
+
if res == "" || res.downcase == "y"
|
11
|
+
run 'bundle exec rake db:migrate'
|
12
|
+
else
|
13
|
+
puts "Skiping rake db:migrate, don't forget to run it!"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module SpreeSupplier
|
2
|
+
class Engine < Rails::Engine
|
3
|
+
engine_name 'spree_supplier'
|
4
|
+
|
5
|
+
config.autoload_paths += %W(#{config.root}/lib)
|
6
|
+
|
7
|
+
# use rspec for tests
|
8
|
+
config.generators do |g|
|
9
|
+
g.test_framework :rspec
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.activate
|
13
|
+
Dir.glob(File.join(File.dirname(__FILE__), "../../app/**/*_decorator*.rb")) do |c|
|
14
|
+
Rails.application.config.cache_classes ? require(c) : load(c)
|
15
|
+
end
|
16
|
+
|
17
|
+
Dir.glob(File.join(File.dirname(__FILE__), "../../app/overrides/*.rb")) do |c|
|
18
|
+
Rails.application.config.cache_classes ? require(c) : load(c)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
config.to_prepare &method(:activate).to_proc
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'spree_supplier/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "spree_supplier"
|
8
|
+
spec.version = SpreeSupplier::VERSION
|
9
|
+
spec.authors = ["Sumit"]
|
10
|
+
spec.email = ["forever.sumitsharma@gmail.com"]
|
11
|
+
spec.summary = "Spree extenstion for Supplier"
|
12
|
+
spec.description = "This gem provide ability to add suppliers and associate them to products."
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
|
24
|
+
#spec.add_dependency('ruby', '~> 2.0.0')
|
25
|
+
spec.add_dependency('rails', '~> 4.0.0')
|
26
|
+
spec.add_dependency('spree_core', '>= 2.1.3')
|
27
|
+
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: spree_supplier
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sumit
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-01-31 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.5'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rails
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 4.0.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 4.0.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: spree_core
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.1.3
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.1.3
|
69
|
+
description: This gem provide ability to add suppliers and associate them to products.
|
70
|
+
email:
|
71
|
+
- forever.sumitsharma@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- .gitignore
|
77
|
+
- Gemfile
|
78
|
+
- LICENSE.txt
|
79
|
+
- README.md
|
80
|
+
- Rakefile
|
81
|
+
- app/controllers/spree/admin/suppliers_controller.rb
|
82
|
+
- app/models/spree/product_decorator.rb
|
83
|
+
- app/models/spree/supplier.rb
|
84
|
+
- app/overrides/admin_tab.rb
|
85
|
+
- app/views/spree/admin/suppliers/_form.html.erb
|
86
|
+
- app/views/spree/admin/suppliers/edit.html.erb
|
87
|
+
- app/views/spree/admin/suppliers/index.html.erb
|
88
|
+
- app/views/spree/admin/suppliers/new.html.erb
|
89
|
+
- config/routes.rb
|
90
|
+
- db/migrate/20131214195339_create_suppliers.rb
|
91
|
+
- db/migrate/20131215160936_add_supplier_key_to_products.rb
|
92
|
+
- lib/generators/spree_supplier/install/install_generator.rb
|
93
|
+
- lib/spree_supplier.rb
|
94
|
+
- lib/spree_supplier/engine.rb
|
95
|
+
- lib/spree_supplier/version.rb
|
96
|
+
- spree_supplier.gemspec
|
97
|
+
homepage: ''
|
98
|
+
licenses:
|
99
|
+
- MIT
|
100
|
+
metadata: {}
|
101
|
+
post_install_message:
|
102
|
+
rdoc_options: []
|
103
|
+
require_paths:
|
104
|
+
- lib
|
105
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - '>='
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '0'
|
115
|
+
requirements: []
|
116
|
+
rubyforge_project:
|
117
|
+
rubygems_version: 2.0.3
|
118
|
+
signing_key:
|
119
|
+
specification_version: 4
|
120
|
+
summary: Spree extenstion for Supplier
|
121
|
+
test_files: []
|