Class: Engine2::InfraAction

Inherits:
Action show all
Includes:
ActionAPISupport, ActionMenuSupport, ActionPanelSupport
Defined in:
lib/engine2/action/infra.rb

Overview

def invoke handler

    file = handler.params[:file]
    temp = file[:tempfile]
    temp.close
    rackname = File.basename(temp.path)
    File.rename(temp.path, "#{UPLOAD_DIR}/#{rackname}")
    {rackname: rackname}
end

end

Instance Attribute Summary

Attributes inherited from Action

#assets, #invokable, #meta, #node, #static

Instance Method Summary collapse

Methods included from ActionPanelSupport

#modal_action, #panel, #panel_class, #panel_footer, #panel_header, #panel_panel_template, #panel_template, #panel_title, #post_run

Methods included from ActionMenuSupport

#menu, #menu?, #post_process

Methods included from ActionAPISupport

#config, #decorate, #field_filter, #fields, #fields!, #hide_fields, #loc!, #render, #show_fields

Methods inherited from Action

action_type, #action_type, #arguments, #check_anonymous_action_class, #check_static_action, #define_invoke, #define_method, #dynamic?, #execute, #freeze_action, #http_method, http_method, inherit, inherited, #initialize, #invoke!, #join_keys, #lookup, #merge, #node_defined, #post_process, #post_run, #repeat, #request, #request_action_proc_params, #split_keys

Constructor Details

This class inherits a constructor from Engine2::Action

Instance Method Details

#invoke(handler) ⇒ Object



232
233
234
235
# File 'lib/engine2/action/infra.rb', line 232

def invoke handler
    user = handler.user
    {user: user ? user.to_hash : nil}
end

#login_meta(menu_properties = {show: 'false'}, &blk) ⇒ Object



237
238
239
240
241
# File 'lib/engine2/action/infra.rb', line 237

def  menu_properties = {show: 'false'}, &blk
    node..* &blk
    menu(:menu).modify_option :login_form, menu_properties
    node.parent..* &blk
end

#pre_runObject



221
222
223
224
225
226
227
228
229
230
# File 'lib/engine2/action/infra.rb', line 221

def pre_run
    super
    panel_panel_template false
    panel_template 'infra/index'
    loc! logged_on: LOCS[:logged_on]
    menu :menu do
        properties group_class: "btn-group-sm"
        option :inspect_modal, icon: :wrench, button_loc: false # , show: "action.logged_on"
    end
end