Class: MegaBar::FieldsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- MegaBar::FieldsController
- Includes:
- AuthorizationConcern, MegaBarConcern
- Defined in:
- app/controllers/mega_bar/fields_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, #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
#get_options ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/mega_bar/fields_controller.rb', line 12 def blocks = [] # bad news, if the block doesn't have model_displays it doesnt show up in this menu ModelDisplay.select(:block_id).distinct.pluck("block_id, model_id").each do |md| blocks << ['id: ' + md[0].to_s + ', model: ' + Model.find(md[1]).name + ' (' + md[1].to_s + '), ' + Block.find(md[0]).name, md[0]] end # md_ids = {model_display_ids: ModelDisplay.by_model(env[:mega_env][:nested_ids][0]["model_id"])} unless env[:mega_env][:nested_ids].blank @options[:mega_bar_fields] = { model_id: Model.all.pluck("name, id"), tablename: Model.all.pluck("tablename, tablename"), block_id: blocks } unless env[:mega_env][:nested_ids].blank? md_opts = [] ModelDisplay.by_model(env[:mega_env][:nested_ids][0]["model_id"]).each do | m| md_opts << [m[:id].to_s + ": " + m[:header], m[:id]] end @options[:mega_bar_fields][:model_display_ids] = md_opts end end |
#new ⇒ Object
6 7 8 9 10 |
# File 'app/controllers/mega_bar/fields_controller.rb', line 6 def new @default_options[:model_id] = @nested_instance_variables[0]&.id @default_options[:tablename] = @nested_instance_variables[0]&.tablename super end |