1
0
mirror of https://github.com/fspc/BikeShed-1.git synced 2025-03-12 05:53:22 -04:00

Finish time entry delete JS/html

This commit is contained in:
Jason Denney 2014-05-03 22:08:23 -04:00
parent d94c436ba5
commit 5e0d678ea1
3 changed files with 10 additions and 8 deletions

View File

@ -59,21 +59,18 @@ $(document).ready(function(){
});
$("#confirmation_delete").click(function(){
console.log($(this).data("entry_id"));
/**
entry_id = $(this).data("entry_id");
url = $("#confirmation_delete").data("url") + entry_id;
$.ajax({
url: $("#confirmation_delete").data("url"),
url: url,
type: "delete",
data: JSON.stringify(json_data),
contentType: 'application/json',
dataType: "json",
success: function(data, status, xhr){
window.location = forward;
location.reload();
},
error: function(data, status ){
displayFormErrors(data.responseJSON);
}
});
*/
});
});

View File

@ -20,4 +20,8 @@ class TimeEntry < ActsAsLoggable::Log
def duration_in_hours
(duration / 1.hour).round(2)
end
def type
log_action.action
end
end

View File

@ -18,6 +18,7 @@
"data-start_date" => entry.start_date.to_date.to_formatted_s(:rfc822)}
%td #{entry.start_date.to_date.to_formatted_s(:rfc822)}
%td #{entry.duration_in_hours}
%td #{entry.type}
%td #{truncate(entry.description)}
%td
%button{ class: "btn icon-remove btn-danger work_entry-delete-btn", role: "button", "data-toggle" => "modal", "data-target" => "#confirmation" }
@ -37,7 +38,7 @@
Description
.modal-footer
%button{ class: "btn", "data-dismiss" => "modal", "aria-hidden" => "true"} Close
%button{ id: "confirmation_delete", class: "btn btn-primary" } Delete
%button{ id: "confirmation_delete", class: "btn btn-primary", "data-url" => "api/v1/time_entries/" } Delete