+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
$(document).on('click', '.selectable', function() {
var any;
var $this = $(this);
var selection = [];
var data = [];
var $modal = $(this).closest('.modal');
+ var http_method = $(this).attr('data-method').toUpperCase();
var action_data = $(this).data('action-data');
var action_data_from_params = $(this).data('action-data-from-params');
var selection_param = action_data.selection_param;
data.push({name: key, value: value});
}
});
+ if (http_method === 'PATCH') {
+ // Some user agents do not support HTTP PATCH (notably,
+ // phantomjs silently ignores our "data" and sends an empty
+ // request body) so we use POST instead, and supply a
+ // _method=PATCH param to tell Rails what we really want.
+ data.push({name: '_method', value: http_method});
+ http_method = 'POST';
+ }
$.ajax($(this).attr('data-action-href'),
{dataType: 'json',
- type: $(this).attr('data-method'),
+ type: http_method,
data: data,
traditional: false,
context: {modal: $modal, action_data: action_data}}).
message = "Request failed.";
}
this.modal.find('.modal-error').
- html('<div class="alert alert-danger">' + message + '</div>').
- show();
+ html('<div class="alert alert-danger"></div>').
+ show().
+ children().text(message);
}).
done(function(data, status, jqxhr) {
var event_name = this.action_data.success;
'project_uuid': project_uuid
};
}
+ $(".modal-dialog-preview-pane").html("");
// Use current selection as dropdown button label
$(this).
closest('.dropdown-menu').
return false;
}
$('<a />').
- attr('href', $form.attr('data-search-modal')).
+ attr('data-remote-href', $form.attr('data-search-modal')).
attr('data-remote', 'true').
attr('data-method', 'GET').
hide().