discrete_upload_to 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 84710387005f891dff8c8b5a996ca9aaa63ca80b
4
- data.tar.gz: 1a54f73c1bf7f57fdde5acae5e0e526ff6e5cb67
3
+ metadata.gz: 26a43694c458e538b104fc99613c5f6cb6f2ebb5
4
+ data.tar.gz: db6b479af543c64f1a65e3f7d379df5c25a5f1ae
5
5
  SHA512:
6
- metadata.gz: cb97db8522bdbd98aaa01aa5b9f285dead38f29c0258e6a10039e8a0c065eac32b7faa7239db62801438efa04280945bf57a354781ae0a28b13f1073fec07d05
7
- data.tar.gz: 2cb62246fb4b9416b5edf2e3fc6653e191664d358e7faf8023e18b0e5f151cdb12eaaf59e9918153a6cda3f27e560fcea853ad0830965672866f64bba65f746e
6
+ metadata.gz: 2fb2f9563ffa1c034776b865c7866be9efd012316c5c92f37e5f35caaba9f57c7540947311f17e7ca388accb637047815800169601acd83f91c848c1377c54f5
7
+ data.tar.gz: 45373f0f1dbda50f98bdd3d7865deebd5ece50d495b1b606c73fc812013271248b230743d128c2008986083a9d789db70d5d5a8eb4319efa2eee891d7a92c609
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in discrete_upload_to.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 TODO: Write your name
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.
@@ -0,0 +1,38 @@
1
+ # DiscreteUploadTo
2
+
3
+ Use any where and upload file with ajax. No need of any form.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'discrete_upload_to'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install discrete_upload_to
20
+
21
+ ## Usage
22
+ 1. function discrete_upload_success(url){
23
+
24
+ }
25
+
26
+ function discrete_upload_failure(){
27
+
28
+ }
29
+
30
+ 2. <%= discrete_upload_tag :file, url, class%>
31
+
32
+ ## Contributing
33
+
34
+ 1. Fork it ( https://github.com/[my-github-username]/discrete_upload_to/fork )
35
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
36
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
37
+ 4. Push to the branch (`git push origin my-new-feature`)
38
+ 5. Create a new Pull Request
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'discrete_upload_to/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "discrete_upload_to"
8
+ spec.version = DiscreteUploadTo::VERSION
9
+ spec.authors = ["Anuj Dhanju"]
10
+ spec.email = ["anujdhanju@gmail.com"]
11
+ spec.summary = %q{Discrete file upload with ajax}
12
+ spec.description = %q{Use any where and upload file with ajex. No need of any form.}
13
+ spec.homepage = "https://github.com/anuj-dhanju/discrete_upload_to"
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
+
22
+ spec.add_development_dependency "bundler", "~> 1.7"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ end
@@ -0,0 +1,11 @@
1
+ require "discrete_upload_to/version"
2
+
3
+ module DiscreteUploadTo
4
+ ActiveSupport.on_load(:action_view) do
5
+ class ActionView::Base
6
+ def discrete_upload_tag name, url, klas=''
7
+ "#{file_field_tag :name, class: klas + 'discrete_upload'}<script>$(document).on('change', '.discrete_upload', function(e){uploadFile($(this)[0].files[0]);});function uploadFile(image){data = new FormData();data.append('#{name}', image);$.ajax({data: data,type: 'post',url: '#{url}',cache: false,contentType: false,processData: false,success: function(data){discrete_upload_success(data['url'])},error: function(){discrete_upload_failure()}});}</script>".html_safe
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ module DiscreteUploadTo
2
+ VERSION = "0.1.3"
3
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: discrete_upload_to
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anuj Dhanju
@@ -44,8 +44,17 @@ email:
44
44
  executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
- files: []
48
- homepage: ''
47
+ files:
48
+ - ".gitignore"
49
+ - Gemfile
50
+ - LICENSE.txt
51
+ - README.md
52
+ - Rakefile
53
+ - discrete_upload_to-0.1.1.gem
54
+ - discrete_upload_to.gemspec
55
+ - lib/discrete_upload_to.rb
56
+ - lib/discrete_upload_to/version.rb
57
+ homepage: https://github.com/anuj-dhanju/discrete_upload_to
49
58
  licenses:
50
59
  - MIT
51
60
  metadata: {}