editing for profile comments

This commit is contained in:
Kyle Drake 2014-05-02 15:08:12 -07:00
parent f681e6c704
commit 6277a94a5b
12 changed files with 80 additions and 13 deletions

12
app.rb
View file

@ -869,10 +869,20 @@ post '/event/:event_id/comment' do |event_id|
require_login
content_type :json
event = Event[id: event_id]
event.add_site_comment current_site, params[:comment]
event.add_site_comment current_site, params[:message]
{result: 'ok'}.to_json
end
post '/event/:event_id/update_profile_comment' do |event_id|
require_login
content_type :json
event = Event[id: event_id]
return {result: 'error'}.to_json unless current_site.id == event.profile_comment.actioning_site_id
event.profile_comment.update message: params[:message]
return {result: 'ok'}.to_json
end
def require_admin
redirect '/' unless signed_in? && current_site.is_admin
end