2 class OriginalPicturesController < ApplicationController
3 before_filter :authenticate_reader, :only => [:show, :history, :count]
4 before_filter :authenticate_user, :only => [:index, :new, :edit, :create, :update, :destroy]
5 before_filter :authenticate_artist, :only => [:index, :new, :edit, :create, :update, :destroy]
15 def show_html_format format
17 #ライセンス付与のために原画ライセンスグループ作成準備
18 @original_picture_license_group = OriginalPictureLicenseGroup.new :original_picture_id => @item.id
25 respond_to do |format|
26 opt = {:type => @item.mime_type, :disposition=>"inline"}
27 format.png { send_data(@item.restore(params[:subdir]), opt ) }
28 format.gif { send_data(@item.restore(params[:subdir]), opt ) }
29 format.jpeg { send_data(@item.restore(params[:subdir]), opt ) }
30 show_html_format format
31 show_prof_format format
32 show_json_format format
38 @history = @item.history
40 respond_to do |format|
42 format.json { render json: @history.to_json }
52 respond_to do |format|
54 format.json { render json: @item.to_json }
60 respond_to do |format|
62 format.json { render json: @item.to_json }
68 @imager = if params[:original_picture]
69 PettanImager.load set_image params[:original_picture][:file]
73 @item = OriginalPicture.new
75 @item.overwrite @operators
77 respond_to do |format|
78 if @item.store(@imager)
79 created_html_format format
80 created_json_format format
82 not_created_html_format format
83 not_created_json_format format
90 @imager = if params[:original_picture]
91 PettanImager.load set_image params[:original_picture][:file]
95 @item = OriginalPicture.edit(params[:id], @operators)
96 @item.overwrite @operators
98 respond_to do |format|
99 if @item.store(@imager)
100 updated_html_format format
101 updated_json_format format
103 not_updated_html_format format
104 not_updated_json_format format
110 @item = OriginalPicture.edit(params[:id], @operators)
112 respond_to do |format|
113 if @item.destroy_with_resource_picture
114 format.html { redirect_to original_pictures_url }
115 format.json { head :ok }
117 format.html { redirect_to original_picture_path(@item) }
118 format.json { render json: @item.errors, status: :unprocessable_entity }