Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a JS hack to allow usage of the Uploadifyer in the dmGallery form
- Loading branch information
Showing
5 changed files
with
61 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Update the add button of the gallery widget to allow multiple upload | ||
(function($) { | ||
|
||
var $gallery = $("div.dm_gallery_big"); | ||
var $metadata = $gallery.metadata(); | ||
|
||
// Replace the current click handler by a new one | ||
$gallery.find('a.open_form').unbind('click') | ||
.click(function(){ | ||
|
||
// Construct the url based on the standard form url, but changing the module/action | ||
var url = $gallery.find('form.dm_add_media').attr('action').match(/(.*)\+\/dmMedia.*/); | ||
url = url[1]+'+/dmMediaUploadifyerAdmin/newMultipleFile?model='+$metadata.model+'&pk='+$metadata.pk; | ||
|
||
// Open the dialog | ||
var $dialog = $.dm.ctrl.ajaxDialog({ | ||
modal: true, | ||
title: $(this).html(), | ||
url: url, | ||
width: 500 | ||
}).bind('dmAjaxResponse', function(){ | ||
$dialog.prepare(); | ||
}); | ||
|
||
}); | ||
|
||
})(jQuery); |