spree_sort_payment_methods 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 35023d296b3c391a36075768c99c23d6872e090e
4
+ data.tar.gz: 05e8334d01e28759ab27f3cddf144f2c479cecf6
5
+ SHA512:
6
+ metadata.gz: 3f325992ca61f21204485b8b501747723dfe8a0a63ef1b5c4c7f9e28a1db95348076e1e8055d9ca5bcf180999ca45bed9237bab3bdee46ac2d0ad78f23809809
7
+ data.tar.gz: 7125c74e5805326d58164c5d13ea48cb1922fe70af4d7c605dee33235aada63df01f031937ca5aff9e543af78485aa2a053bf585a9350669e51c8087ec7708c2
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ \#*
2
+ *~
3
+ .#*
4
+ .DS_Store
5
+ .idea
6
+ .project
7
+ .sass-cache
8
+ coverage
9
+ Gemfile.lock
10
+ tmp
11
+ nbproject
12
+ pkg
13
+ *.swp
14
+ spec/dummy
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Provides basic authentication functionality for testing parts of your engine
4
+ gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: '2-0-stable'
5
+ gem 'spree', '2.0'
6
+
7
+ gemspec
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.md ADDED
@@ -0,0 +1,40 @@
1
+ SpreeSortPaymentMethods
2
+ =======================
3
+
4
+ This gem allows you to sort your payments methods to show them in the way you really want
5
+
6
+ Installation
7
+ ------------
8
+
9
+ Add spree_sort_payment_methods to your Gemfile:
10
+
11
+ ```ruby
12
+ gem 'spree_sort_payment_methods'
13
+ ```
14
+
15
+ Bundle your dependencies and run the installation generator:
16
+
17
+ ```shell
18
+ bundle
19
+ bundle exec rails g spree_sort_payment_methods:install
20
+ ```
21
+
22
+ Testing
23
+ -------
24
+
25
+ Be sure to bundle your dependencies and then create a dummy test app for the specs to run against.
26
+
27
+ ```shell
28
+ bundle
29
+ bundle exec rake test_app
30
+ bundle exec rspec spec
31
+ ```
32
+
33
+ When testing your applications integration with this extension you may use it's factories.
34
+ Simply add this require statement to your spec_helper:
35
+
36
+ ```ruby
37
+ require 'spree_sort_payment_methods/factories'
38
+ ```
39
+
40
+ Copyright (c) 2014 [name of extension creator], 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_sort_payment_methods'
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,3 @@
1
+ /*
2
+ *= require admin/spree_backend
3
+ */
@@ -0,0 +1,3 @@
1
+ /*
2
+ *= require store/spree_frontend
3
+ */
@@ -0,0 +1,3 @@
1
+ Spree::PaymentMethod.class_eval do
2
+ default_scope -> { order("#{self.table_name}.position") }
3
+ end
@@ -0,0 +1,5 @@
1
+ Deface::Override.new(virtual_path: 'spree/admin/payment_methods/index',
2
+ name: 'Add sorting to payment methods',
3
+ set_attributes: '#listing_payment_methods',
4
+ attributes: {class: 'index sortable', 'data-sortable-link' => '/admin/payment_methods/update_positions' }
5
+ )
@@ -0,0 +1,2 @@
1
+ <!-- insert_top '#listing_payment_methods tbody tr' -->
2
+ <td><span class="handle"></span></td>
@@ -0,0 +1,2 @@
1
+ <!-- insert_top '#listing_payment_methods thead tr' -->
2
+ <th></th>
@@ -0,0 +1,8 @@
1
+ <!-- replace_contents '#listing_payment_methods colgroup' -->
2
+ <col style="width: 10%">
3
+ <col style="width: 15%">
4
+ <col style="width: 30%">
5
+ <col style="width: 15%">
6
+ <col style="width: 10%">
7
+ <col style="width: 5%">
8
+ <col style="width: 15%">
@@ -0,0 +1,5 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ hello: "Hello world"
data/config/routes.rb ADDED
@@ -0,0 +1,9 @@
1
+ Spree::Core::Engine.routes.draw do
2
+ namespace :admin do
3
+ resources :payment_methods do
4
+ collection do
5
+ post :update_positions
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ class AddPositionToPaymentMethod < ActiveRecord::Migration
2
+ def change
3
+ add_column :spree_payment_methods, :position, :integer
4
+ end
5
+ end
@@ -0,0 +1,31 @@
1
+ module SpreeSortPaymentMethods
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_sort_payment_methods\n"
9
+ append_file 'app/assets/javascripts/admin/all.js', "//= require admin/spree_sort_payment_methods\n"
10
+ end
11
+
12
+ def add_stylesheets
13
+ inject_into_file 'app/assets/stylesheets/store/all.css', " *= require store/spree_sort_payment_methods\n", :before => /\*\//, :verbose => true
14
+ inject_into_file 'app/assets/stylesheets/admin/all.css', " *= require admin/spree_sort_payment_methods\n", :before => /\*\//, :verbose => true
15
+ end
16
+
17
+ def add_migrations
18
+ run 'bundle exec rake railties:install:migrations FROM=spree_sort_payment_methods'
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,2 @@
1
+ require 'spree_core'
2
+ require 'spree_sort_payment_methods/engine'
@@ -0,0 +1,22 @@
1
+ module SpreeSortPaymentMethods
2
+ class Engine < Rails::Engine
3
+ require 'spree/core'
4
+ isolate_namespace Spree
5
+ engine_name 'spree_sort_payment_methods'
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_sort_payment_methods/factories'
6
+ 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_sort_payment_methods/engine', __FILE__)
5
+
6
+ require 'rails/all'
7
+ require 'rails/engine/commands'
@@ -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_sort_payment_methods/factories.rb
33
+ require 'spree_sort_payment_methods/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,30 @@
1
+ # encoding: UTF-8
2
+ Gem::Specification.new do |s|
3
+ s.platform = Gem::Platform::RUBY
4
+ s.name = 'spree_sort_payment_methods'
5
+ s.version = '2.0.1'
6
+ s.summary = 'Allow to sort payments methods from backend'
7
+ s.description = 'Allow to sort payments method from backend'
8
+ s.required_ruby_version = '>= 1.9.3'
9
+
10
+ s.author = 'Steven Barragan'
11
+ s.email = 'me@steven.mx'
12
+ s.homepage = 'https://github.com/stevenbarragan/spree_sort_payment_methods'
13
+
14
+ s.files = `git ls-files`.split("\n")
15
+ s.require_path = 'lib'
16
+ s.requirements << 'none'
17
+
18
+ s.add_dependency 'spree_core', '~> 2.0'
19
+
20
+ s.add_development_dependency 'capybara', '~> 2.1'
21
+ s.add_development_dependency 'coffee-rails'
22
+ s.add_development_dependency 'database_cleaner'
23
+ s.add_development_dependency 'factory_girl', '~> 4.2'
24
+ s.add_development_dependency 'ffaker'
25
+ s.add_development_dependency 'rspec-rails', '~> 2.13'
26
+ s.add_development_dependency 'sass-rails'
27
+ s.add_development_dependency 'selenium-webdriver'
28
+ s.add_development_dependency 'simplecov'
29
+ s.add_development_dependency 'sqlite3'
30
+ end
metadata ADDED
@@ -0,0 +1,222 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: spree_sort_payment_methods
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Steven Barragan
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-01-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: spree_core
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: capybara
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.1'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: coffee-rails
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: database_cleaner
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: factory_girl
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '4.2'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '4.2'
83
+ - !ruby/object:Gem::Dependency
84
+ name: ffaker
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec-rails
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '2.13'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '2.13'
111
+ - !ruby/object:Gem::Dependency
112
+ name: sass-rails
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: selenium-webdriver
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: simplecov
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: sqlite3
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ description: Allow to sort payments method from backend
168
+ email: me@steven.mx
169
+ executables: []
170
+ extensions: []
171
+ extra_rdoc_files: []
172
+ files:
173
+ - ".gitignore"
174
+ - ".rspec"
175
+ - Gemfile
176
+ - LICENSE
177
+ - README.md
178
+ - Rakefile
179
+ - app/assets/javascripts/admin/spree_sort_payment_methods.js
180
+ - app/assets/javascripts/store/spree_sort_payment_methods.js
181
+ - app/assets/stylesheets/admin/spree_sort_payment_methods.css
182
+ - app/assets/stylesheets/store/spree_sort_payment_methods.css
183
+ - app/models/payment_method_decorator.rb
184
+ - app/overrides/add_sorting.rb
185
+ - app/overrides/spree/admin/payment_methods/index/add_handle_to_move_table_rows.html.erb.deface
186
+ - app/overrides/spree/admin/payment_methods/index/add_th_to_handle_column.html.erb.deface
187
+ - app/overrides/spree/admin/payment_methods/index/resize_table_columns.html.erb.deface
188
+ - config/locales/en.yml
189
+ - config/routes.rb
190
+ - db/migrate/20140117184359_add_position_to_payment_method.rb
191
+ - lib/generators/spree_sort_payment_methods/install/install_generator.rb
192
+ - lib/spree_sort_payment_methods.rb
193
+ - lib/spree_sort_payment_methods/engine.rb
194
+ - lib/spree_sort_payment_methods/factories.rb
195
+ - script/rails
196
+ - spec/spec_helper.rb
197
+ - spree_sort_payment_methods.gemspec
198
+ homepage: https://github.com/stevenbarragan/spree_sort_payment_methods
199
+ licenses: []
200
+ metadata: {}
201
+ post_install_message:
202
+ rdoc_options: []
203
+ require_paths:
204
+ - lib
205
+ required_ruby_version: !ruby/object:Gem::Requirement
206
+ requirements:
207
+ - - ">="
208
+ - !ruby/object:Gem::Version
209
+ version: 1.9.3
210
+ required_rubygems_version: !ruby/object:Gem::Requirement
211
+ requirements:
212
+ - - ">="
213
+ - !ruby/object:Gem::Version
214
+ version: '0'
215
+ requirements:
216
+ - none
217
+ rubyforge_project:
218
+ rubygems_version: 2.2.1
219
+ signing_key:
220
+ specification_version: 4
221
+ summary: Allow to sort payments methods from backend
222
+ test_files: []