Class | OutputController
In: | app/controllers/output_controller.rb
Parent: | ApplicationController

ファイル出力を制御する。

### Methods

clear download edit index save sort test

### Public Instance methods

clear()

出力の設定を初期化する。

[Source]

        # File app/controllers/output_controller.rb, line 57
    57:   def clear
    58:     prepare do
    59:       @config_output.clear
    60:       @config_output.config_output_items.each_with_index {|config_output_item, i| config_output_item.clear(i+1)}
    61:     end
    62:     @current_view = "view_detail"
    63:     render :action => "edit"
    64:   end

download()

出力しダウンロードする。

[Source]

        # File app/controllers/output_controller.rb, line 50
    50:   def download
    51:     prepare
    52:     options = @display_to_list.query_options
    53:     send_data @config_output.generate(options), :type => @config_output.mime_type, :filename => @config_output.file_name(request.user_agent)
    54:   end

edit()

出力の設定を編集する。

[Source]

        # File app/controllers/output_controller.rb, line 9
     9:   def edit
    10:     prepare
    11:     @current_view = "view_detail"
    12:   end

index()

`edit` へリダイレクトする。

[Source]

       # File app/controllers/output_controller.rb, line 4
    4:   def index
    5:     redirect_to :action => "edit"
    6:   end

save()

出力の設定を保存する。

[Source]

        # File app/controllers/output_controller.rb, line 30
    30:   def save
    31:     prepare do
    32:       if params[:config_output].is_a?(Hash)
    33:         @config_output.attributes = params[:config_output]
    34:         @config_output.save
    35:       end
    36:       if params[:config_output_item].is_a?(Hash)
    37:         params[:config_output_item].each_pair do |config_output_item_id, attributes|
    38:           if config_output_item = ConfigOutputItem.find(:first, :conditions => {:id => config_output_item_id, :config_output_id => @config_output.id})
    39:             config_output_item.attributes = attributes
    40:             config_output_item.save
    41:           end
    42:         end
    43:       end
    44:     end
    45:     @current_view = "view_detail"
    46:     render :action => "edit"
    47:   end

sort()

出力する項目を並び替える。

[Source]

        # File app/controllers/output_controller.rb, line 15
    15:   def sort
    16:     prepare do
    17:       if params[:config_output_items_tbody].is_a?(Array)
    18:         params[:config_output_items_tbody].each_with_index do |config_output_item_id, i|
    19:           if item = ConfigOutputItem.find(:first, :conditions => {:id => config_output_item_id, :config_output_id => @config_output.id})
    20:             item.position = i + 1
    21:             item.save
    22:           end
    23:         end
    24:       end
    25:     end
    26:     render :text => params[:config_output_items_tbody].inspect # FIXME
    27:   end

test()

(試験用)

[Source]

        # File app/controllers/output_controller.rb, line 67
    67:   def test
    68:     @current_view = "view_m"
    69:     @sub_view = "view_detail"
    70:   end

[Validate]