class PanelPicturesController < ApplicationController
- layout 'test' if MagicNumber['test_layout']
- if MagicNumber['run_mode'] == 0
+ if Manifest.manifest.magic_numbers['run_mode'] == 0
before_filter :authenticate_user, :only => [:new, :edit, :create, :update, :destroy]
before_filter :authenticate_author, :only => [:new, :edit, :create, :update, :destroy]
else
- before_filter :authenticate_reader, :only => [:index, :show]
+ before_filter :authenticate_reader, :only => [:index, :show, :by_panel, :by_author]
before_filter :authenticate_user, :only => [:new, :edit, :create, :update, :destroy]
before_filter :authenticate_author, :only => [:new, :edit, :create, :update, :destroy]
end
def index
public_list
end
-
+
+ def by_panel
+ filter_list
+ end
+
+ def by_author
+ filter_list
+ end
+
def show
@item = PanelPicture.show(params[:id], @operators)
raise ActiveRecord::Forbidden unless @picture.enable?
@panel = Panel.edit(@operators.author.working_panel, @operators)
- @panel_picture = PanelPicture.new :panel_id => @panel.id, :picture_id => @picture.id
- @panel_picture.supply_default
-
+ @item = PanelPicture.new :panel_id => @panel.id, :picture_id => @picture.id
+ @item.supply_default
respond_to do |format|
- format.html
+ format.html {
+ mounted = 1
+ form_manager = Pettanr::Application::manifest.form_managers[@item.form_name]
+ @form = form_manager.open @item, @operators, mounted
+ }
format.json { render :json => @panel_picture.to_json(PanelPicture.show_json_opt) }
end
end
def edit
- @panel_picture = PanelPicture.show(params[:id], @operators)
- @panel = Panel.edit(@panel_picture.panel.id, @operators)
+ @item = PanelPicture.show(params[:id], @operators)
+ @panel = Panel.edit(@item.panel.id, @operators)
respond_to do |format|
- format.html
+ format.html {
+ mounted = 1
+ form_manager = Pettanr::Application::manifest.form_managers[@item.form_name]
+ @form = form_manager.open @item, @operators, mounted
+ }
end
end
def create
- raise Pettanr::NotWork unless @author.working_panel
+ raise Pettanr::NotWork unless @operators.author.working_panel
@panel = Panel.edit(@operators.author.working_panel, @operators)
@panel_picture = PanelPicture.new