Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wth - (SPARCFulfillment) Users should be Able to Delete Individual Fu… #265

Merged
merged 1 commit into from
Feb 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,4 @@
//= require faye
//= require visit_group_form
//= require imports
//= require fulfillments
6 changes: 6 additions & 0 deletions app/assets/javascripts/fulfillments.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
$ ->
$(document).on 'click', '.otf_fulfillment_delete', ->
$.ajax
type: 'delete'
url: "/fulfillments/#{$(this).data('id')}.js"

8 changes: 8 additions & 0 deletions app/controllers/fulfillments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ def update
end
end

def destroy
@fulfillment = Fulfillment.find(params[:id])
@fulfillment.destroy
respond_to do |format|
format.js
end
end

private

def persist_original_attributes_to_track_changes
Expand Down
3 changes: 3 additions & 0 deletions app/helpers/study_level_activities_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ def fulfillment_options_buttons fulfillment
)+
content_tag(:li, raw(
content_tag(:button, raw(content_tag(:span, '', class: "glyphicon glyphicon-edit", aria: {hidden: "true"}))+' Edit Fulfillment', type: 'button', class: 'btn btn-default form-control actions-button otf_fulfillment_edit'))
)+
content_tag(:li, raw(
content_tag(:button, raw(content_tag(:span, '', class: "glyphicon glyphicon-remove", aria: {hidden: "true"}))+' Delete Fulfillment', type: 'button', class: 'btn btn-default form-control actions-button otf_fulfillment_delete', data: { id: fulfillment.id }))
)
)

Expand Down
1 change: 1 addition & 0 deletions app/views/fulfillments/destroy.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$('#fulfillments-table').bootstrapTable('refresh')