Files
danbooru/app/controllers/artist_commentaries_controller.rb
Toks 2a0910ca11 Use ajax form for artist commentary
This prevents the parameters (eg. ?tags=whatever) from being eaten on
submit.
2013-11-21 21:07:45 -05:00

24 lines
724 B
Ruby

class ArtistCommentariesController < ApplicationController
respond_to :html, :xml, :json, :js
before_filter :member_only
def create_or_update
@artist_commentary = ArtistCommentary.find_by_post_id(params[:artist_commentary][:post_id])
if @artist_commentary
@artist_commentary.update_attributes(params[:artist_commentary])
else
@artist_commentary = ArtistCommentary.create(params[:artist_commentary])
end
respond_with(@artist_commentary)
end
def revert
@artist_commentary = ArtistCommentary.find_by_post_id(params[:id])
@version = ArtistCommentaryVersion.find(params[:version_id])
@artist_commentary.revert_to!(@version)
respond_with(@artist_commentary)
end
end