Skip to content

Commit

Permalink
Merge pull request #2152 from antgonza/fix-delete-sample_V2
Browse files Browse the repository at this point in the history
delete sample v2
  • Loading branch information
wasade committed Jun 22, 2017
2 parents 02bff6c + 9e5cbe1 commit 464f70b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions qiita_pet/templates/study_ajax/sample_prep_summary.html
Expand Up @@ -18,7 +18,7 @@
// adding new column to cols, we need to add a Formatter
function linkFormatter(row, cell, value, columnDef, dataContext) {
return "<a class=\"btn btn-danger\" onclick=\"delete_sample('" + value +
"');\"><span class=\"glyphicon glyphicon-trash\"></span></a>";
"', " + row + ");\"><span class=\"glyphicon glyphicon-trash\"></span></a>";
}
cols.unshift({ name: "", field: "slick-grid-sample-delete", width: 60, formatter: linkFormatter })
var grid = new Slick.Grid("#samples-div", table, cols, options);
Expand Down Expand Up @@ -60,12 +60,12 @@
* current sample template
*
*/
function delete_sample(sample_name) {
function delete_sample(sample_name, row_id) {
if(confirm("Are you sure you want to delete '" + sample_name + "'?")) {
$.ajax({
url: '{% raw qiita_config.portal_dir %}/study/description/sample_template/',
type: 'PATCH',
data: {'op': 'remove', 'path': '/{{study_id}}/' + row_id + '/samples/' + column_name},
data: {'op': 'remove', 'path': '/{{study_id}}/' + row_id + '/samples/' + sample_name},
success: function(data) {
if(data.status == 'error') {
bootstrapAlert(data.message, "danger");
Expand All @@ -79,8 +79,9 @@
}

$(document).ready(function() {

{% if alert_type != 'success' and alert_message != '' %}
bootstrapAlert('{% raw alert_message %}', "{{alert_type}}");
bootstrapAlert("{% raw alert_message %}", "{{alert_type}}");
{% else %}
$('#alert-message').alert('close');
{% end %}
Expand Down

0 comments on commit 464f70b

Please sign in to comment.