Add artist commentary, fixes #2024
This commit is contained in:
23
app/controllers/artist_commentaries_controller.rb
Normal file
23
app/controllers/artist_commentaries_controller.rb
Normal file
@@ -0,0 +1,23 @@
|
||||
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.post)
|
||||
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
|
||||
12
app/controllers/artist_commentary_versions_controller.rb
Normal file
12
app/controllers/artist_commentary_versions_controller.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
class ArtistCommentaryVersionsController < ApplicationController
|
||||
respond_to :html, :xml, :json
|
||||
|
||||
def index
|
||||
@commentary_versions = ArtistCommentaryVersion.search(params[:search]).order("artist_commentary_versions.id desc").paginate(params[:page], :limit => params[:limit])
|
||||
respond_with(@commentary_versions) do |format|
|
||||
format.xml do
|
||||
render :xml => @commentary_versions.to_xml(:root => "artist-commentary-versions")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user