discourse/app/controllers/draft_controller.rb

22 lines
638 B
Ruby
Raw Normal View History

2013-02-05 14:16:51 -05:00
class DraftController < ApplicationController
before_filter :ensure_logged_in
# TODO really do we need to skip this?
skip_before_filter :check_xhr, :preload_json
2013-02-05 14:16:51 -05:00
def show
seq = params[:sequence] || DraftSequence.current(current_user, params[:draft_key])
2017-07-27 21:20:09 -04:00
render json: { draft: Draft.get(current_user, params[:draft_key], seq), draft_sequence: seq }
2013-02-05 14:16:51 -05:00
end
def update
2013-02-07 10:45:24 -05:00
Draft.set(current_user, params[:draft_key], params[:sequence].to_i, params[:data])
render json: success_json
2013-02-05 14:16:51 -05:00
end
def destroy
Draft.clear(current_user, params[:draft_key], params[:sequence].to_i)
render json: success_json
2013-02-05 14:16:51 -05:00
end
end