lol_multiple_uploads 1.2.0 → 1.2.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16bd3b2e7b22ff853049e73e92789e0dc12c95c6
|
4
|
+
data.tar.gz: 630591e00c7e84f43b6eda40406c05335caf0cb2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36521194c095667f84452b2b236025375990bc588451feed38074dada79bb23b18ce7c903ee695c1e696eaf0e18694b3fd60de3af1a50848ace9b808d13738c9
|
7
|
+
data.tar.gz: e130fab2f91b33a5b31c40eec144e0e0081171e912c6296be57cd5a0d9f6f8b78783cc79650d9ad5586bf0e02602f1d0ea13423d787afc4e52d4a93c84dd4498
|
@@ -10,9 +10,9 @@ $(document).ready(function() {
|
|
10
10
|
});
|
11
11
|
|
12
12
|
var imageContainerManager = function(){
|
13
|
-
var _this
|
14
|
-
this.$container
|
15
|
-
this.hasCaption
|
13
|
+
var _this = this;
|
14
|
+
this.$container = $('.lol-multiple-uploads.images-container');
|
15
|
+
this.hasCaption = Boolean(this.$container.data('has-caption'));
|
16
16
|
|
17
17
|
this.startup = function(){
|
18
18
|
this.$container.on('click', 'figure a', function(event) {
|
@@ -91,7 +91,8 @@ var MultipleUpload = function(link){
|
|
91
91
|
this.model_id = this.link.data('model-id');
|
92
92
|
this.storeImagePath = this.link.data('store-path');
|
93
93
|
this.filePickerKey = this.link.data('file-picker-key');
|
94
|
-
|
94
|
+
this.imageContainer = this.link.data('image-container');
|
95
|
+
this.photoVersion = this.link.data('photo-version');
|
95
96
|
|
96
97
|
this.startup = function(){
|
97
98
|
this.link.on('click', function(event) {
|
@@ -115,7 +116,11 @@ var MultipleUpload = function(link){
|
|
115
116
|
url: that.storeImagePath,
|
116
117
|
type: 'POST',
|
117
118
|
dataType: 'html',
|
118
|
-
data: {model: that.model,
|
119
|
+
data: {model: that.model,
|
120
|
+
model_id: that.model_id,
|
121
|
+
photo: val.url,
|
122
|
+
photo_version: that.photoVersion
|
123
|
+
},
|
119
124
|
beforeSend: function(xhr){
|
120
125
|
that.showLoading();
|
121
126
|
},
|
@@ -4,11 +4,11 @@ class PhotosController < ActionController::Base
|
|
4
4
|
def create
|
5
5
|
@resource = params[:model].classify.constantize.find params[:model_id]
|
6
6
|
@photo = @resource.photos.build(remote_image_url: params[:photo])
|
7
|
-
|
7
|
+
|
8
8
|
respond_with(@photo) do |format|
|
9
9
|
if @photo.save
|
10
10
|
format.json{ render json: @photo }
|
11
|
-
format.js { render partial: '/layouts/lol_multiple_uploads/photo', locals: { photo: @photo } }
|
11
|
+
format.js { render partial: '/layouts/lol_multiple_uploads/photo', locals: { photo: @photo, photo_version: params[:photo_version] } }
|
12
12
|
else
|
13
13
|
format.json{ render nothing: true, status: :error }
|
14
14
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module UploadHelper
|
2
|
-
def upload_link(name='Upload File', object=nil, image_container='.images-container')
|
3
|
-
link_to(name, 'javascript://', class: 'multiple_upload', 'data-model' => object.class, 'data-model-id' => object.id, 'data-store-path' => upload_image_path(format: 'js'), 'data-file-picker-key' => "#{PICKER_KEY}", 'data-image-container' => image_container) unless object.nil? || object.new_record?
|
2
|
+
def upload_link(name='Upload File', object=nil, image_container='.images-container', photo_version=:gallery_thumb)
|
3
|
+
link_to(name, 'javascript://', class: 'multiple_upload', 'data-model' => object.class, 'data-model-id' => object.id, 'data-store-path' => upload_image_path(format: 'js'), 'data-file-picker-key' => "#{PICKER_KEY}", 'data-image-container' => image_container, 'data-photo-version' => photo_version) unless object.nil? || object.new_record?
|
4
4
|
end
|
5
5
|
end
|