2013-02-06 03:16:51 +08:00
|
|
|
class DraftController < ApplicationController
|
|
|
|
before_filter :ensure_logged_in
|
|
|
|
skip_before_filter :check_xhr
|
|
|
|
|
|
|
|
def show
|
|
|
|
seq = params[:sequence] || DraftSequence.current(current_user, params[:draft_key])
|
2013-03-23 02:08:11 +08:00
|
|
|
render json: {draft: Draft.get(current_user, params[:draft_key], seq), draft_sequence: seq}
|
2013-02-06 03:16:51 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
def update
|
2013-02-07 23:45:24 +08:00
|
|
|
Draft.set(current_user, params[:draft_key], params[:sequence].to_i, params[:data])
|
2013-03-23 02:08:11 +08:00
|
|
|
render text: 'ok'
|
2013-02-06 03:16:51 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
Draft.clear(current_user, params[:draft_key], params[:sequence].to_i)
|
2013-03-23 02:08:11 +08:00
|
|
|
render text: 'ok'
|
2013-02-06 03:16:51 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|