2 class OriginalPicturesController < ApplicationController
3 before_action :authenticate_reader, :only => [:show, :history]
4 before_action :authenticate_user, :only => [:index, :new, :edit, :create, :update, :destroy]
5 before_action :authenticate_artist, :only => [:index, :new, :edit, :create, :update, :destroy]
8 filer_list param: @operators
11 def show_html_format format
13 #ライセンス付与のために原画ライセンスグループ作成準備
14 @original_picture_license_group = OriginalPictureLicenseGroup.new :original_picture_id => @item.id
19 def show_json_format format
20 format.json { render json: @item.to_json(
21 {:include => {:resource_picture => {}} }
27 respond_to do |format|
28 opt = {:type => @item.mime_type, :disposition=>"inline"}
29 format.png { send_data(@item.restore(params[:subdir]), opt ) }
30 format.gif { send_data(@item.restore(params[:subdir]), opt ) }
31 format.jpeg { send_data(@item.restore(params[:subdir]), opt ) }
32 show_html_format format
33 show_prof_format format
34 show_json_format format
40 @history = @item.history
42 respond_to do |format|
44 format.json { render json: @history.to_json }
50 respond_to do |format|
52 format.json { render json: @item.to_json }
58 respond_to do |format|
60 format.json { render json: @item.to_json }
66 @imager = if params[:original_picture]
67 PettanImager.load set_image params[:original_picture][:file]
71 @item = OriginalPicture.new
73 @item.overwrite @operators
75 respond_to do |format|
76 if @item.store(@imager)
77 created_html_format format
78 created_json_format format
80 not_created_html_format format
81 not_created_json_format format
88 @imager = if params[:original_picture]
89 PettanImager.load set_image params[:original_picture][:file]
93 @item = OriginalPicture.edit(params[:id], @operators)
94 @item.overwrite @operators
96 respond_to do |format|
97 if @item.store(@imager)
98 updated_html_format format
99 updated_json_format format
101 not_updated_html_format format
102 not_updated_json_format format
109 @item = @my_model_class.edit(params[:id], @operators)
110 render_destroy_by 'destroy_with_resource_picture', original_pictures_url