news feed: confirm before removal of event

This commit is contained in:
Kyle Drake 2024-04-29 17:28:09 -05:00
parent 5adef9adb9
commit b5ca5f0bc9
2 changed files with 25 additions and 1 deletions

View file

@ -107,4 +107,12 @@ class Event < Sequel::Model
true
end
end
def name
return 'follow' if follow_id
return 'tip' if tip_id
return 'tag' if tag_id
return 'site change' if site_change_id
return 'comment' if profile_comment_id
end
end

View file

@ -15,7 +15,23 @@
<a id="editLink" href="#" onclick="ProfileComment.displayEditor('<%= event.id %>'); return false">Edit</a>
<% end %>
<% if event.created_by?(current_site) || event.site_id == current_site.id %>
<a href="#" onclick="Event.delete(<%= event.id %>, '<%= csrf_token %>'); return false">Delete</a>
<a href="#deleteEvent<%= event.id %>" data-toggle="modal">Delete</a>
<% end %>
<% end %>
</div>
<div class="modal hide fade" id="deleteEvent<%= event.id %>" tabindex="-1" role="dialog" aria-labelledby="deleteEventLabel<%= event.id %>" aria-hidden="true">
<div class="modal-header">
<button class="close" type="button" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i></button>
<h3 id="addTagLabel">Delete</h3>
</div>
<div class="modal-body">
<p>
Are you sure you want to remove this <%= event.name %> from the news feed?
</p>
</div>
<div class="modal-footer">
<button class="btn cancel" data-dismiss="modal" aria-hidden="true">Cancel</button>
<button type="submit" class="btn-Action" onclick="Event.delete(<%= event.id %>, '<%= csrf_token %>'); return false">Delete</button>
</div>
</div>