spree_image_multi_upload 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +15 -0
  3. data/.rspec +1 -0
  4. data/Gemfile +3 -0
  5. data/LICENSE +26 -0
  6. data/README.md +29 -0
  7. data/Rakefile +15 -0
  8. data/Versionfile +1 -0
  9. data/app/assets/javascripts/admin/jquery-fileupload/basic.js +4 -0
  10. data/app/assets/javascripts/admin/jquery-fileupload/cors/jquery.postmessage-transport.js +117 -0
  11. data/app/assets/javascripts/admin/jquery-fileupload/cors/jquery.xdr-transport.js +87 -0
  12. data/app/assets/javascripts/admin/jquery-fileupload/index.js +9 -0
  13. data/app/assets/javascripts/admin/jquery-fileupload/jquery.fileupload-fp.js +223 -0
  14. data/app/assets/javascripts/admin/jquery-fileupload/jquery.fileupload-ui.js +799 -0
  15. data/app/assets/javascripts/admin/jquery-fileupload/jquery.fileupload.js +1164 -0
  16. data/app/assets/javascripts/admin/jquery-fileupload/jquery.iframe-transport.js +185 -0
  17. data/app/assets/javascripts/admin/jquery-fileupload/locale.js.erb +30 -0
  18. data/app/assets/javascripts/admin/jquery-fileupload/vendor/canvas-to-blob.js +91 -0
  19. data/app/assets/javascripts/admin/jquery-fileupload/vendor/jquery.ui.widget.js +530 -0
  20. data/app/assets/javascripts/admin/jquery-fileupload/vendor/load-image.js +121 -0
  21. data/app/assets/javascripts/admin/jquery-fileupload/vendor/tmpl.js +86 -0
  22. data/app/assets/javascripts/admin/spree_image_multi_upload.js +3 -0
  23. data/app/assets/stylesheets/admin/jquery.fileupload-ui.scss +84 -0
  24. data/app/assets/stylesheets/admin/spree_image_multi_upload.css +4 -0
  25. data/app/controllers/spree/admin/images_controller_decorator.rb +39 -0
  26. data/app/models/image_decorator.rb +17 -0
  27. data/app/overrides/admin_decorator.rb +6 -0
  28. data/app/views/spree/admin/images/_template_download.html.erb +33 -0
  29. data/app/views/spree/admin/images/_template_upload.html.erb +36 -0
  30. data/app/views/spree/admin/images/multi_upload.html.erb +48 -0
  31. data/app/views/spree/admin/images/multi_upload.js.erb +4 -0
  32. data/config/locales/en.yml +15 -0
  33. data/config/locales/ru.yml +15 -0
  34. data/config/routes.rb +11 -0
  35. data/lib/generators/spree_image_multi_upload/install/install_generator.rb +16 -0
  36. data/lib/spree_image_multi_upload.rb +2 -0
  37. data/lib/spree_image_multi_upload/engine.rb +22 -0
  38. data/script/rails +7 -0
  39. data/spec/spec_helper.rb +46 -0
  40. data/spree_image_multi_upload.gemspec +25 -0
  41. metadata +154 -0
@@ -0,0 +1,4 @@
1
+ $("#images").html('<%= escape_javascript(render :template => "spree/admin/images/multi_upload", :formats => [:html], :handlers => [:erb]) %>');
2
+
3
+ // TODO: configure plugin: e. g. set appropriate preview sizes
4
+ $('#multi_upload').fileupload();
@@ -0,0 +1,15 @@
1
+ en:
2
+ multi_upload:
3
+ title: 'Advanced Images Upload'
4
+ add_files: 'Add files...'
5
+ start: 'Start upload'
6
+ cancel: 'Cancel upload'
7
+ destroy: 'Delete'
8
+ errors:
9
+ max_file_size: 'File is too big'
10
+ min_file_size: 'File is too small'
11
+ accept_file_types: 'Filetype not allowed'
12
+ max_number_of_files: 'Max number of files exceeded'
13
+ uploaded_bytes: 'Uploaded bytes exceed file size'
14
+ empty_result: 'Empty file upload result'
15
+
@@ -0,0 +1,15 @@
1
+ ru:
2
+ multi_upload:
3
+ title: 'Расширенная загрузка файлов'
4
+ add_files: 'Добавить файлы...'
5
+ start: 'Начать загрузку'
6
+ cancel: 'Отменить загрузку'
7
+ destroy: 'Удалить'
8
+ errors:
9
+ max_file_size: 'Файл слишком большой'
10
+ min_file_size: 'Файл слишком маленький'
11
+ accept_file_types: 'Запрещенный тип файла'
12
+ max_number_of_files: 'Превышено количество файлов'
13
+ uploaded_bytes: 'Загруженные данные больше размера файла'
14
+ empty_result: 'Пустой результат загрузки файлов'
15
+
data/config/routes.rb ADDED
@@ -0,0 +1,11 @@
1
+ Spree::Core::Engine.routes.draw do
2
+ namespace :admin do
3
+ resources :products do
4
+ resources :images do
5
+ collection do
6
+ get 'multi_upload'
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,16 @@
1
+ module SpreeImageMultiUpload
2
+ module Generators
3
+ class InstallGenerator < Rails::Generators::Base
4
+
5
+ def add_javascripts
6
+ append_file 'app/assets/javascripts/admin/all.js', "//= require admin/spree_image_multi_upload\n"
7
+ end
8
+
9
+ def add_stylesheets
10
+ inject_into_file 'app/assets/stylesheets/admin/all.css', " *= require admin/spree_image_multi_upload\n", :before => /\*\//, :verbose => true
11
+ #inject_into_file 'app/assets/stylesheets/application.css', " *= require admin/spree_image_multi_upload\n", :before => /\*\//, :verbose => true
12
+ end
13
+
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,2 @@
1
+ require 'spree_core'
2
+ require 'spree_image_multi_upload/engine'
@@ -0,0 +1,22 @@
1
+ module SpreeImageMultiUpload
2
+ class Engine < Rails::Engine
3
+ require 'spree/core'
4
+ isolate_namespace Spree
5
+ engine_name 'spree_image_multi_upload'
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_image_multi_upload/engine', __FILE__)
5
+
6
+ require 'rails/all'
7
+ require 'rails/engine/commands'
@@ -0,0 +1,46 @@
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/testing_support/controller_requests'
16
+ require 'spree/core/testing_support/authorization_helpers'
17
+ require 'spree/core/url_helpers'
18
+
19
+ RSpec.configure do |config|
20
+ config.include FactoryGirl::Syntax::Methods
21
+
22
+ # == URL Helpers
23
+ #
24
+ # Allows access to Spree's routes in specs:
25
+ #
26
+ # visit spree.admin_path
27
+ # current_path.should eql(spree.products_path)
28
+ config.include Spree::Core::UrlHelpers
29
+
30
+ # == Mock Framework
31
+ #
32
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
33
+ #
34
+ # config.mock_with :mocha
35
+ # config.mock_with :flexmock
36
+ # config.mock_with :rr
37
+ config.mock_with :rspec
38
+
39
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
40
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
41
+
42
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
43
+ # examples within a transaction, remove the following line or assign false
44
+ # instead of true.
45
+ config.use_transactional_fixtures = true
46
+ end
@@ -0,0 +1,25 @@
1
+ # encoding: UTF-8
2
+ Gem::Specification.new do |s|
3
+ s.platform = Gem::Platform::RUBY
4
+ s.name = 'spree_image_multi_upload'
5
+ s.version = '1.0.0'
6
+ s.summary = %q{Advanced product images uploader}
7
+ s.description = %q{Allow Spree to upload multi product images at the same time}
8
+ s.required_ruby_version = '>= 2.0.0'
9
+
10
+ s.author = 'Huy Nguyen'
11
+ s.email = 'huyngvu@gmail.com'
12
+ s.homepage = 'https://github.com/huyngvu/spree_image_multi_upload'
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.3'
20
+
21
+ s.add_development_dependency 'capybara'#, '~> 1.1.2'
22
+ s.add_development_dependency 'factory_girl'#, '~> 2.6.4'
23
+ s.add_development_dependency 'rspec-rails'#, '~> 2.9'
24
+ s.add_development_dependency 'sqlite3'
25
+ end
metadata ADDED
@@ -0,0 +1,154 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: spree_image_multi_upload
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Huy Nguyen
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-07-17 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.3'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '2.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: capybara
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: factory_girl
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: rspec-rails
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: sqlite3
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: Allow Spree to upload multi product images at the same time
84
+ email: huyngvu@gmail.com
85
+ executables: []
86
+ extensions: []
87
+ extra_rdoc_files: []
88
+ files:
89
+ - .gitignore
90
+ - .rspec
91
+ - Gemfile
92
+ - LICENSE
93
+ - README.md
94
+ - Rakefile
95
+ - Versionfile
96
+ - app/assets/javascripts/admin/jquery-fileupload/basic.js
97
+ - app/assets/javascripts/admin/jquery-fileupload/cors/jquery.postmessage-transport.js
98
+ - app/assets/javascripts/admin/jquery-fileupload/cors/jquery.xdr-transport.js
99
+ - app/assets/javascripts/admin/jquery-fileupload/index.js
100
+ - app/assets/javascripts/admin/jquery-fileupload/jquery.fileupload-fp.js
101
+ - app/assets/javascripts/admin/jquery-fileupload/jquery.fileupload-ui.js
102
+ - app/assets/javascripts/admin/jquery-fileupload/jquery.fileupload.js
103
+ - app/assets/javascripts/admin/jquery-fileupload/jquery.iframe-transport.js
104
+ - app/assets/javascripts/admin/jquery-fileupload/locale.js.erb
105
+ - app/assets/javascripts/admin/jquery-fileupload/vendor/canvas-to-blob.js
106
+ - app/assets/javascripts/admin/jquery-fileupload/vendor/jquery.ui.widget.js
107
+ - app/assets/javascripts/admin/jquery-fileupload/vendor/load-image.js
108
+ - app/assets/javascripts/admin/jquery-fileupload/vendor/tmpl.js
109
+ - app/assets/javascripts/admin/spree_image_multi_upload.js
110
+ - app/assets/stylesheets/admin/jquery.fileupload-ui.scss
111
+ - app/assets/stylesheets/admin/spree_image_multi_upload.css
112
+ - app/controllers/spree/admin/images_controller_decorator.rb
113
+ - app/models/image_decorator.rb
114
+ - app/overrides/admin_decorator.rb
115
+ - app/views/spree/admin/images/_template_download.html.erb
116
+ - app/views/spree/admin/images/_template_upload.html.erb
117
+ - app/views/spree/admin/images/multi_upload.html.erb
118
+ - app/views/spree/admin/images/multi_upload.js.erb
119
+ - config/locales/en.yml
120
+ - config/locales/ru.yml
121
+ - config/routes.rb
122
+ - lib/generators/spree_image_multi_upload/install/install_generator.rb
123
+ - lib/spree_image_multi_upload.rb
124
+ - lib/spree_image_multi_upload/engine.rb
125
+ - script/rails
126
+ - spec/spec_helper.rb
127
+ - spree_image_multi_upload.gemspec
128
+ homepage: https://github.com/huyngvu/spree_image_multi_upload
129
+ licenses: []
130
+ metadata: {}
131
+ post_install_message:
132
+ rdoc_options: []
133
+ require_paths:
134
+ - lib
135
+ required_ruby_version: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - '>='
138
+ - !ruby/object:Gem::Version
139
+ version: 2.0.0
140
+ required_rubygems_version: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - '>='
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
145
+ requirements:
146
+ - none
147
+ rubyforge_project:
148
+ rubygems_version: 2.4.8
149
+ signing_key:
150
+ specification_version: 4
151
+ summary: Advanced product images uploader
152
+ test_files:
153
+ - spec/spec_helper.rb
154
+ has_rdoc: