activeadmin-dropzone 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.DS_Store +0 -0
- data/README.rdoc +19 -0
- data/Rakefile +3 -3
- data/VERSION +1 -1
- data/activeadmin-dropzone.gemspec +11 -12
- data/app/assets/.DS_Store +0 -0
- data/app/assets/images/hamburger-retina.gif +0 -0
- data/app/assets/images/hamburger.gif +0 -0
- data/app/assets/images/spritemap.png +0 -0
- data/app/assets/images/spritemap@2x.png +0 -0
- data/app/assets/stylesheets/activeadmin-dropzone.css.scss +0 -10
- data/app/controllers/dropzone_controller.rb +1 -2
- data/app/helpers/active_admin/views_helper.rb +5 -12
- data/app/views/application/_dropzone.html.erb +16 -18
- data/config/routes.rb +3 -6
- data/lib/activeadmin-dropzone/active_record/dropzone.rb +18 -54
- metadata +11 -12
- data/README.md +0 -56
- data/app/.DS_Store +0 -0
- data/app/assets/images/.DS_Store +0 -0
- data/config/locales/en.yml +0 -7
- data/config/locales/ru.yml +0 -7
- data/lib/.DS_Store +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 515d53c280b8e2ae88248fea2765d1e47792d37b
|
4
|
+
data.tar.gz: 2aa5965e7c0231db4cf195104b68af9bda933091
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51104d1b49343e3b84767a81fcc5ee1f2118015f1cb892d87afe77a1555092c6964027814bc358e37bdf9392de0f10e868cae1e99d6752af44a000f2e270e995
|
7
|
+
data.tar.gz: 518fc7c8c483bef2716185ced2552ccbde461d1662477eb6e53f83f5f4786adbd1e97426420d5035fe717a20b525ef9b2e5f17993bd7c65322be62e6d5ce6a65
|
data/.DS_Store
CHANGED
Binary file
|
data/README.rdoc
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
= activeadmin-dropzone
|
2
|
+
|
3
|
+
Description goes here.
|
4
|
+
|
5
|
+
== Contributing to activeadmin-dropzone
|
6
|
+
|
7
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
8
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
9
|
+
* Fork the project.
|
10
|
+
* Start a feature/bugfix branch.
|
11
|
+
* Commit and push until you are happy with your contribution.
|
12
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
14
|
+
|
15
|
+
== Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2013 Maxim Gladkov. See LICENSE.txt for
|
18
|
+
further details.
|
19
|
+
|
data/Rakefile
CHANGED
@@ -15,10 +15,10 @@ require 'jeweler'
|
|
15
15
|
Jeweler::Tasks.new do |gem|
|
16
16
|
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
17
|
gem.name = "activeadmin-dropzone"
|
18
|
-
gem.homepage = "http://
|
18
|
+
gem.homepage = "http://github.com/maximgladkov/activeadmin-dropzone"
|
19
19
|
gem.license = "MIT"
|
20
|
-
gem.summary = %Q{
|
21
|
-
gem.email = "
|
20
|
+
gem.summary = %Q{Gem adds support of dropzone.js for ActiveAdmin}
|
21
|
+
gem.email = "maksim.gladkov@gmail.com"
|
22
22
|
gem.authors = ["Maxim Gladkov"]
|
23
23
|
# dependencies defined in Gemfile
|
24
24
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
@@ -5,15 +5,15 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "activeadmin-dropzone"
|
8
|
-
s.version = "0.0
|
8
|
+
s.version = "0.1.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Maxim Gladkov"]
|
12
|
-
s.date = "
|
13
|
-
s.email = "
|
12
|
+
s.date = "2013-12-23"
|
13
|
+
s.email = "maksim.gladkov@gmail.com"
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE.txt",
|
16
|
-
"README.
|
16
|
+
"README.rdoc"
|
17
17
|
]
|
18
18
|
s.files = [
|
19
19
|
".DS_Store",
|
@@ -21,13 +21,15 @@ Gem::Specification.new do |s|
|
|
21
21
|
"Gemfile",
|
22
22
|
"Gemfile.lock",
|
23
23
|
"LICENSE.txt",
|
24
|
-
"README.
|
24
|
+
"README.rdoc",
|
25
25
|
"Rakefile",
|
26
26
|
"VERSION",
|
27
27
|
"activeadmin-dropzone.gemspec",
|
28
|
-
"app/.DS_Store",
|
29
28
|
"app/assets/.DS_Store",
|
30
|
-
"app/assets/images
|
29
|
+
"app/assets/images/hamburger-retina.gif",
|
30
|
+
"app/assets/images/hamburger.gif",
|
31
|
+
"app/assets/images/spritemap.png",
|
32
|
+
"app/assets/images/spritemap@2x.png",
|
31
33
|
"app/assets/javascripts/activeadmin-dropzone.js",
|
32
34
|
"app/assets/javascripts/dropzone.js",
|
33
35
|
"app/assets/stylesheets/activeadmin-dropzone.css.scss",
|
@@ -36,21 +38,18 @@ Gem::Specification.new do |s|
|
|
36
38
|
"app/helpers/active_admin/views_helper.rb",
|
37
39
|
"app/inputs/dropzone_input.rb",
|
38
40
|
"app/views/application/_dropzone.html.erb",
|
39
|
-
"config/locales/en.yml",
|
40
|
-
"config/locales/ru.yml",
|
41
41
|
"config/routes.rb",
|
42
|
-
"lib/.DS_Store",
|
43
42
|
"lib/activeadmin-dropzone.rb",
|
44
43
|
"lib/activeadmin-dropzone/active_record/dropzone.rb",
|
45
44
|
"lib/activeadmin-dropzone/engine.rb",
|
46
45
|
"test/helper.rb",
|
47
46
|
"test/test_activeadmin-dropzone.rb"
|
48
47
|
]
|
49
|
-
s.homepage = "http://
|
48
|
+
s.homepage = "http://github.com/maximgladkov/activeadmin-dropzone"
|
50
49
|
s.licenses = ["MIT"]
|
51
50
|
s.require_paths = ["lib"]
|
52
51
|
s.rubygems_version = "2.0.3"
|
53
|
-
s.summary = "
|
52
|
+
s.summary = "Gem adds support of dropzone.js for ActiveAdmin"
|
54
53
|
|
55
54
|
if s.respond_to? :specification_version then
|
56
55
|
s.specification_version = 4
|
data/app/assets/.DS_Store
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,9 +1,6 @@
|
|
1
1
|
//= require dropzone
|
2
2
|
|
3
3
|
.dropzone {
|
4
|
-
margin: 10px 20px;
|
5
|
-
border: 1px solid #ccc;
|
6
|
-
|
7
4
|
a {
|
8
5
|
text-decoration: none;
|
9
6
|
font-size: 13px;
|
@@ -29,13 +26,6 @@
|
|
29
26
|
}
|
30
27
|
}
|
31
28
|
|
32
|
-
.dropzone-hint {
|
33
|
-
margin: 0 0 0 20px;
|
34
|
-
font-size: 0.95em;
|
35
|
-
font-style: italic;
|
36
|
-
color: #666;
|
37
|
-
}
|
38
|
-
|
39
29
|
.sortable-placeholder {
|
40
30
|
position: relative;
|
41
31
|
display: inline-block;
|
@@ -3,8 +3,7 @@ class DropzoneController < ApplicationController
|
|
3
3
|
def upload
|
4
4
|
dropzone_class = params[:dropzone_class].constantize
|
5
5
|
dropzone_object = dropzone_class.new
|
6
|
-
dropzone_object.send "#{ dropzone_class.dropzone_field
|
7
|
-
dropzone_object.send "#{ dropzone_class.dropzone_field(:data) }=", params[:file]
|
6
|
+
dropzone_object.send "#{ dropzone_class.dropzone_field }=", params[:file]
|
8
7
|
|
9
8
|
if dropzone_object.save
|
10
9
|
render json: dropzone_object.to_json
|
@@ -1,18 +1,11 @@
|
|
1
1
|
module ActiveAdmin::ViewsHelper
|
2
2
|
|
3
3
|
def render_mock_dropzone_files(dropzone_objects)
|
4
|
-
dropzone_objects.
|
5
|
-
|
6
|
-
id: dropzone_object.id,
|
7
|
-
|
8
|
-
|
9
|
-
url: dropzone_object.send(dropzone_object.class.dropzone_field(:url))
|
10
|
-
}
|
11
|
-
end.map do |hash|
|
12
|
-
hash.map{ |(k, v)| "#{ k }: '#{ v }'" }.join(',')
|
13
|
-
end.map do |string|
|
14
|
-
"{#{ string }}"
|
15
|
-
end.join(', ').html_safe
|
4
|
+
unless dropzone_objects.empty?
|
5
|
+
dropzone_objects.map do |dropzone_object|
|
6
|
+
"{ id: #{ dropzone_object.id }, name: '#{ dropzone_object.send dropzone_object.class.dropzone_title_field }', size: #{ dropzone_object.send dropzone_object.class.dropzone_file_size_field }, url: '#{ dropzone_object.send dropzone_object.class.dropzone_url_field }' }"
|
7
|
+
end.join(', ').html_safe
|
8
|
+
end
|
16
9
|
end
|
17
10
|
|
18
11
|
end
|
@@ -1,39 +1,38 @@
|
|
1
|
-
<div id="dropzone_<%= method %>_<%= cycle(*(1..999).to_a, name: method) %>" class="dropzone">
|
2
|
-
<span class="notice"
|
3
|
-
|
1
|
+
<div id="dropzone_<%= method %>_<%= cycle(*(1..999).to_a, name: method) %>" class="dropzone" style="margin: 10px 20px; border: 1px solid #ccc">
|
2
|
+
<span class="notice">Перетащите сюда файлы или нажмите для загрузки</span>
|
3
|
+
<input type="hidden" name="<%= object.class.to_s.downcase %>[<%= method %>_attributes][-1]" value="" />
|
4
4
|
<% object.send(method).each_with_index do |dropzone_object, index| %>
|
5
|
-
|
5
|
+
<input type="hidden" name="<%= object.class.to_s.downcase %>[<%= method %>_attributes][<%= dropzone_object.id %>][<%= object.class.dropzone_title_field %>]" value="<%= dropzone_object.send(object.class.dropzone_title_field) %>" />
|
6
6
|
<% end %>
|
7
7
|
</div>
|
8
8
|
|
9
9
|
<% unless options[:hint].blank? %>
|
10
|
-
<p class="inline-hints
|
10
|
+
<p class="inline-hints" style="margin: 0 0 0 20px; font-size: 0.95em; font-style: italic; color: #666;"><%= options[:hint] %></p>
|
11
11
|
<% end %>
|
12
12
|
|
13
13
|
<script>
|
14
14
|
(function() {
|
15
|
-
Dropzone.autoDiscover = false;
|
16
|
-
|
17
15
|
var mockFiles = [<%= render_mock_dropzone_files(object.send(method)) %>];
|
16
|
+
Dropzone.autoDiscover = false;
|
18
17
|
var dropzone_id = "#dropzone_<%= method %>_<%= current_cycle(method) %>";
|
19
18
|
var dropzone = new Dropzone(dropzone_id, {
|
20
|
-
url: '<%= upload_dropzone_path(
|
19
|
+
url: '<%= upload_dropzone_path(dropzone_class: method.to_s.classify) %>',
|
21
20
|
addRemoveLinks: true,
|
22
|
-
dictCancelUpload: '
|
23
|
-
dictRemoveFile: '
|
21
|
+
dictCancelUpload: 'Отменить',
|
22
|
+
dictRemoveFile: 'Удалить',
|
24
23
|
maxFiles: <%= defined?(max_files) ? '1' : 'null' %>,
|
25
24
|
sending: function(file, xhr, formData) {
|
26
25
|
xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').prop('content'));
|
27
26
|
},
|
28
27
|
success: function(file, data) {
|
29
|
-
$(dropzone_id).append('<input type="hidden" name="<%= object.class.
|
28
|
+
$(dropzone_id).append('<input type="hidden" name="<%= object.class.to_s.downcase %>[<%= method %>_attributes][' + data.id + '][<%= object.class.dropzone_title_field %>]" value="" />');
|
30
29
|
$(file.previewElement).attr('data-id', data.id);
|
31
30
|
$(file.previewElement).attr('data-url', data.url);
|
32
31
|
return file.previewElement.classList.add("dz-success");
|
33
32
|
},
|
34
33
|
removedfile: function(file) {
|
35
|
-
$(dropzone_id + ' input[name="<%= object.class.
|
36
|
-
$(dropzone_id + ' input[name="<%= object.class.
|
34
|
+
$(dropzone_id + ' input[name="<%= object.class.to_s.downcase %>[images_attributes][' + file.id + '][<%= object.class.dropzone_title_field %>]"]').remove();
|
35
|
+
$(dropzone_id + ' input[name="<%= object.class.to_s.downcase %>[images_attributes][' + file.id + '][<%= object.class.dropzone_position_field %>]"]').remove();
|
37
36
|
$(file.previewElement).remove();
|
38
37
|
$(dropzone_id).sortable('refresh');
|
39
38
|
}
|
@@ -49,9 +48,8 @@
|
|
49
48
|
$(file.previewElement).attr('data-id', file.id);
|
50
49
|
|
51
50
|
$(file.previewElement).find('.dz-filename, img').on('click', function() {
|
52
|
-
var
|
53
|
-
var
|
54
|
-
var title = prompt("<%=t 'dropzone.title' %>: ", $(file.previewElement).find('.dz-filename span').text());
|
51
|
+
var input = $(dropzone_id + ' input[name="<%= object.class.to_s.downcase %>[<%= method %>_attributes][' + file.id + '][<%= object.class.dropzone_title_field %>]"]');
|
52
|
+
var title = prompt("Название изображения: ", $(file.previewElement).find('.dz-filename span').text());
|
55
53
|
$(file.previewElement).find('.dz-filename span').text(title);
|
56
54
|
input.val(title);
|
57
55
|
});
|
@@ -61,7 +59,7 @@
|
|
61
59
|
var position = 0;
|
62
60
|
$(dropzone_id + ' .dz-preview').each(function() {
|
63
61
|
var id = $(this).attr('data-id');
|
64
|
-
$(dropzone_id).append('<input type="hidden" name="<%= object.class.
|
62
|
+
$(dropzone_id).append('<input type="hidden" name="<%= object.class.to_s.downcase %>[<%= method %>_attributes][' + id + '][<%= object.class.dropzone_position_field %>]" value="' + (position++) + '" />');
|
65
63
|
});
|
66
64
|
};
|
67
65
|
|
@@ -78,7 +76,7 @@
|
|
78
76
|
|
79
77
|
$('form').submit(function(e) {
|
80
78
|
if (dropzone.getQueuedFiles().length > 0 || dropzone.getUploadingFiles().length > 0) {
|
81
|
-
if (confirm("
|
79
|
+
if (confirm("Некоторые файлы еще не загрузились на сервер. Вы действительно хотите сохранить без них?") == true) {
|
82
80
|
generate_dropzone_position_elements();
|
83
81
|
} else {
|
84
82
|
e.preventDefault();
|
data/config/routes.rb
CHANGED
@@ -1,8 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
post '/dropzone/upload' => 'dropzone#upload', as: :upload_dropzone
|
1
|
+
Rails.application.routes.draw do
|
2
|
+
|
3
|
+
post '/dropzone/upload' => 'dropzone#upload', as: :upload_dropzone
|
6
4
|
|
7
|
-
end
|
8
5
|
end
|
@@ -2,78 +2,42 @@ module Activeadmin
|
|
2
2
|
module Dropzone
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
|
+
included do
|
6
|
+
end
|
7
|
+
|
5
8
|
module ClassMethods
|
6
9
|
def dropzone(association_name)
|
7
10
|
class_eval %Q(
|
8
|
-
def self.dropzone_#{ association_name }_class
|
9
|
-
self.reflect_on_association(:#{ association_name }).class_name.constantize
|
10
|
-
end
|
11
|
-
|
12
11
|
def #{ association_name }_attributes=(attributes)
|
13
|
-
|
14
|
-
|
15
|
-
ActiveRecord::Base.transaction do
|
16
|
-
self.#{ association_name } = self.class.dropzone_#{ association_name }_class.find(attributes.select{ |id, hash| !id.blank? and id != '-1' }.map{ |id, hash| id.to_i })
|
17
|
-
|
18
|
-
self.#{ association_name }.each do |dropzone_object|
|
19
|
-
attribute = attributes[dropzone_object.id.to_s]
|
20
|
-
changes = {}
|
21
|
-
|
22
|
-
title_field = self.class.dropzone_#{ association_name }_class.dropzone_field(:title)
|
23
|
-
if dropzone_object.respond_to?(title_field) and dropzone_object.send(title_field) != attribute['title']
|
24
|
-
changes[title_field] = attribute['title']
|
25
|
-
end
|
26
|
-
|
27
|
-
position_field = self.class.dropzone_#{ association_name }_class.dropzone_field(:position)
|
28
|
-
if dropzone_object.respond_to?(position_field) and dropzone_object.send(position_field) != attribute['position'].to_i
|
29
|
-
changes[position_field] = attribute['position']
|
30
|
-
end
|
12
|
+
reflection = self.class.reflect_on_association(:#{ association_name })
|
31
13
|
|
32
|
-
|
33
|
-
dropzone_object.update_attributes changes
|
34
|
-
end
|
35
|
-
end
|
14
|
+
p "self.class.reflect_on_association(:#{ association_name })"
|
36
15
|
|
37
|
-
|
16
|
+
self.#{ association_name } = reflection.class_name.constantize.find(attributes.select{ |id, hash| !id.blank? and id != '-1' }.map{ |id, hash| id.to_i })
|
38
17
|
|
39
|
-
|
40
|
-
|
18
|
+
self.#{ association_name }.each do |dropzone_object|
|
19
|
+
if dropzone_object.title != attributes[dropzone_object.id.to_s]['title'] or dropzone_object.position != attributes[dropzone_object.id.to_s]['position'].to_i
|
20
|
+
dropzone_object.update_attributes title: attributes[dropzone_object.id.to_s]['title'], position: attributes[dropzone_object.id.to_s]['position']
|
41
21
|
end
|
42
22
|
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def self.dropzone_#{ association_name }_field(key)
|
46
|
-
dropzone_#{ association_name }_class.dropzone_field(key)
|
47
|
-
end
|
48
23
|
|
49
|
-
|
50
|
-
dropzone_#{ association_name }_class.dropzone_field?(key)
|
24
|
+
self.update_attribute :#{ association_name }_count, self.#{ association_name }.size
|
51
25
|
end
|
52
26
|
)
|
53
|
-
end
|
54
|
-
|
55
|
-
def dropzone_item(options = {})
|
56
|
-
options = {
|
57
|
-
title: :title,
|
58
|
-
position: :position,
|
59
|
-
data: :data,
|
60
|
-
file_size: :data_file_size,
|
61
|
-
url: :data_url
|
62
|
-
}.deep_merge(options)
|
63
27
|
|
64
|
-
class_eval
|
65
|
-
def self.
|
66
|
-
|
28
|
+
class_eval do
|
29
|
+
def self.dropzone_title_field
|
30
|
+
:title
|
67
31
|
end
|
68
32
|
|
69
|
-
def self.
|
70
|
-
|
33
|
+
def self.dropzone_position_field
|
34
|
+
:position
|
71
35
|
end
|
72
36
|
|
73
|
-
def
|
74
|
-
|
37
|
+
def self.dropzone_field
|
38
|
+
:image
|
75
39
|
end
|
76
|
-
|
40
|
+
end
|
77
41
|
end
|
78
42
|
end
|
79
43
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activeadmin-dropzone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maxim Gladkov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2013-12-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jeweler
|
@@ -39,25 +39,27 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
description:
|
42
|
-
email:
|
42
|
+
email: maksim.gladkov@gmail.com
|
43
43
|
executables: []
|
44
44
|
extensions: []
|
45
45
|
extra_rdoc_files:
|
46
46
|
- LICENSE.txt
|
47
|
-
- README.
|
47
|
+
- README.rdoc
|
48
48
|
files:
|
49
49
|
- .DS_Store
|
50
50
|
- .document
|
51
51
|
- Gemfile
|
52
52
|
- Gemfile.lock
|
53
53
|
- LICENSE.txt
|
54
|
-
- README.
|
54
|
+
- README.rdoc
|
55
55
|
- Rakefile
|
56
56
|
- VERSION
|
57
57
|
- activeadmin-dropzone.gemspec
|
58
|
-
- app/.DS_Store
|
59
58
|
- app/assets/.DS_Store
|
60
|
-
- app/assets/images
|
59
|
+
- app/assets/images/hamburger-retina.gif
|
60
|
+
- app/assets/images/hamburger.gif
|
61
|
+
- app/assets/images/spritemap.png
|
62
|
+
- app/assets/images/spritemap@2x.png
|
61
63
|
- app/assets/javascripts/activeadmin-dropzone.js
|
62
64
|
- app/assets/javascripts/dropzone.js
|
63
65
|
- app/assets/stylesheets/activeadmin-dropzone.css.scss
|
@@ -66,16 +68,13 @@ files:
|
|
66
68
|
- app/helpers/active_admin/views_helper.rb
|
67
69
|
- app/inputs/dropzone_input.rb
|
68
70
|
- app/views/application/_dropzone.html.erb
|
69
|
-
- config/locales/en.yml
|
70
|
-
- config/locales/ru.yml
|
71
71
|
- config/routes.rb
|
72
|
-
- lib/.DS_Store
|
73
72
|
- lib/activeadmin-dropzone.rb
|
74
73
|
- lib/activeadmin-dropzone/active_record/dropzone.rb
|
75
74
|
- lib/activeadmin-dropzone/engine.rb
|
76
75
|
- test/helper.rb
|
77
76
|
- test/test_activeadmin-dropzone.rb
|
78
|
-
homepage: http://
|
77
|
+
homepage: http://github.com/maximgladkov/activeadmin-dropzone
|
79
78
|
licenses:
|
80
79
|
- MIT
|
81
80
|
metadata: {}
|
@@ -98,5 +97,5 @@ rubyforge_project:
|
|
98
97
|
rubygems_version: 2.0.3
|
99
98
|
signing_key:
|
100
99
|
specification_version: 4
|
101
|
-
summary:
|
100
|
+
summary: Gem adds support of dropzone.js for ActiveAdmin
|
102
101
|
test_files: []
|
data/README.md
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
# activeadmin-dropzone
|
2
|
-
|
3
|
-
Easy to use integration of drag&drop files upload via [dropzone.js](http://www.dropzonejs.com) for [ActiveAdmin](http://www.activeadmin.info).
|
4
|
-
|
5
|
-
## Requirements
|
6
|
-
|
7
|
-
* [ActiveAdmin](http://www.activeadmin.info);
|
8
|
-
* [Paperclip](https://github.com/thoughtbot/paperclip) gem;
|
9
|
-
* ActiveRecord;
|
10
|
-
* Separate models for file's container and files.
|
11
|
-
|
12
|
-
## Install
|
13
|
-
|
14
|
-
Add line to your Gemfile:
|
15
|
-
|
16
|
-
gem 'activeadmin-dropzone', '~> 0.0.1'
|
17
|
-
|
18
|
-
Add `dropzone` to your file container's class:
|
19
|
-
|
20
|
-
class Post
|
21
|
-
dropzone :images
|
22
|
-
end
|
23
|
-
|
24
|
-
Add `dropzone_item` to your file's class:
|
25
|
-
|
26
|
-
class Image
|
27
|
-
dropzone_item
|
28
|
-
end
|
29
|
-
|
30
|
-
Add `input` to your ActiveAdmin form:
|
31
|
-
|
32
|
-
f.input :images, as: :dropzone
|
33
|
-
|
34
|
-
## Configuration
|
35
|
-
|
36
|
-
You can customize columns used for upload by passing `Hash` to the `dropzone_item` method. Here are the default values:
|
37
|
-
|
38
|
-
dropzone_item title: :title,
|
39
|
-
position: :position,
|
40
|
-
data: :data,
|
41
|
-
file_size: :file_size,
|
42
|
-
url: :url
|
43
|
-
|
44
|
-
## Contributing to activeadmin-dropzone
|
45
|
-
|
46
|
-
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
47
|
-
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
48
|
-
* Fork the project.
|
49
|
-
* Start a feature/bugfix branch.
|
50
|
-
* Commit and push until you are happy with your contribution.
|
51
|
-
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
52
|
-
|
53
|
-
## Copyright
|
54
|
-
|
55
|
-
Copyright (c) 2014 Maxim Gladkov. See LICENSE.txt for
|
56
|
-
further details.
|
data/app/.DS_Store
DELETED
Binary file
|
data/app/assets/images/.DS_Store
DELETED
Binary file
|
data/config/locales/en.yml
DELETED
data/config/locales/ru.yml
DELETED
data/lib/.DS_Store
DELETED
Binary file
|