Skip to content

Instantly share code, notes, and snippets.

@tarto-dev
Created March 10, 2015 16:44
Show Gist options
  • Select an option

  • Save tarto-dev/e5534f3f7f59f49990bd to your computer and use it in GitHub Desktop.

Select an option

Save tarto-dev/e5534f3f7f59f49990bd to your computer and use it in GitHub Desktop.
(function ($) {
"use strict";
Drupal.behaviors.origin3_user = {
attach: function (context, settings) {
var user_id = settings.origin3_user_user_proof.userId;
var deleteBaseUrl = settings.origin3_user_user_proof.deleteUrl;
$('#origin3-user-user-document-form input[type="file"]').each(function () {
$(this).css('opacity', 0);
});
$("a.add_file").on("click", function () {
var field_ref = $(this).data('ref');
$("#" + field_ref).trigger("click");
});
var url = window.location.protocol + "//" + window.location.host;
$('a.delete-link', context).once('div:not([class])', function () {
var document_key = $(this).data('document-key');
$(this).click(function(e) {
e.preventDefault();
var postAjax = $.post( url + '/user/investor/document/' + user_id + '/' + document_key + '/delete', {});
postAjax.done(function(data){
$('#origin3-user-user-document-form').empty().html(data);
});
});
});
}
};
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment