Class: MegaBar::ModelsController

Inherits:
ApplicationController show all
Includes:
MegaBarConcern
Defined in:
app/controllers/mega_bar/models_controller.rb

Instance Method Summary collapse

Methods included from MegaBarConcern

#add_form_path_to_mega_displays, #collect_filters, #column_sorting, #conditions, #constant_from_controller, #create, #destroy, #edit, #form_path, #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

#_params

Instance Method Details

#allObject



9
10
11
12
# File 'app/controllers/mega_bar/models_controller.rb', line 9

def all
  @mega_instance = Model.all.order(column_sorting) # .page(@page_number).per(5)
  index
end

#get_optionsObject



15
16
17
18
19
20
21
22
# File 'app/controllers/mega_bar/models_controller.rb', line 15

def get_options

  @options[:mega_bar_models] =  {
    position_parent: MegaBar::Model.all.pluck(:name, :modyule, :classname).map{|a|  [a[1] + ' - ' + a[0], a[1] +'::' +  a[2]] }.unshift(['Position with No Parent', 'pnp']),
    default_sort_field: Field.by_model(params[:id]).pluck("field, field"),      
    make_page: Template.all.pluck("name, id"),  
  }
end

#indexObject



5
6
7
8
# File 'app/controllers/mega_bar/models_controller.rb', line 5

def index
  @mega_instance ||= Model.where.not(modyule: 'MegaBar').order(column_sorting)
  super.index
end