Class: MegaBar::MegaDashesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- MegaBar::MegaDashesController
- Includes:
- AuthorizationConcern, MegaBarConcern
- Defined in:
- app/controllers/mega_bar/mega_dashes_controller.rb
Instance Method Summary collapse
Methods included from MegaBarConcern
#add_form_path_to_mega_displays, #administer_block, #administer_page, #collect_filters, #column_sorting, #conditions, #constant_from_controller, #create, #destroy, #edit, #form_path, #index, #is_displayable?, #might_filter?, #might_paginate?, #move, #new, #num_per_page, #process_filters, #redo_setup, #set_vars_for_all, #set_vars_for_displays, #show, #sort_column, #sort_direction, #test_create, #unpack_nested_classes, #update
Methods inherited from ApplicationController
Methods included from AuthorizationHelper
#can_create?, #can_destroy?, #can_edit?, #can_index?, #can_perform_action?, #can_show?, #can_update?, #has_mega_role?, #link_if_can, #link_if_can_create, #link_if_can_destroy, #link_if_can_edit, #link_if_can_index, #link_if_can_show, #link_if_can_update, #link_if_can_with_wrapper
Instance Method Details
#dashboards_init ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/mega_bar/mega_dashes_controller.rb', line 7 def dashboards_init initial_path_segments = RouteRecognizer.new.initial_path_segments class_segment = segment_for_class(@mega_params["path"], initial_path_segments) action = action_from_path(@mega_params["path"], initial_path_segments ) mod = get_module(env['REQUEST_PATH']) id = @mega_params["path"][/(\d+)(?!.*\d)/] model_id = Model.by_modyule(mod).by_classname(class_segment.classify).pluck(:id).last #no dupes controller = controller_for_params(mod, class_segment) params = {controller: controller, action: action, model_id: model_id, id: id} # {"model_id"=>2, "action"=>"edit", "controller"=>"mega_bar/fields", "id"=>"1"} # controller_class = controller.constantize require 'Rack' params.each_with_index do |v, k | Rack::Request.update_param(k, v) end @dogs = FieldsController.action("index").call(env) render inline: @dogs[2].instance_variable_get("@body").instance_variable_get("@stream").instance_variable_get("@buf")[0] end |
#other_init ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'app/controllers/mega_bar/mega_dashes_controller.rb', line 32 def other_init initial_path_segments = RouteRecognizer.new.initial_path_segments class_segment = segment_for_class(@mega_params["path"], initial_path_segments) action = action_from_path(@mega_params["path"], initial_path_segments ) mod = get_module(env['REQUEST_PATH']) id = @mega_params["path"][/(\d+)(?!.*\d)/] model_id = Model.by_modyule(mod).by_classname(class_segment.classify).pluck(:id).last #no dupes controller = controller_for_params(mod, class_segment) params = {controller: controller, action: action, model_id: model_id, id: id} # {"model_id"=>2, "action"=>"edit", "controller"=>"mega_bar/fields", "id"=>"1"} # controller_class = controller.constantize controller_class = controller_class(mod, class_segment).constantize cc = controller_class.new cc.instance_variable_set("@params", params) cc.instance_variable_set("@mega_class", mega_class(mod, class_segment)) cc.instance_variable_set("@mega_controller", controller.split('/').last) if ["index", "show", "edit", "new"].include?params[:action] cc.instance_variable_set("@options", {}) cc.try(:get_options) cc.instance_variable_set("@mega_model_properties", mega_model_properties(params)) if ["index", "show", "edit", "new"].include?params[:action] cc.instance_variable_set("@mega_displays", mega_displays(params)) if ["index", "show", "edit", "new"].include?params[:action] cc.try(:mega_template) cc.try(:index) end |