Class: Marty::ScriptGrid

Inherits:
Grid
  • Object
show all
Defined in:
app/components/marty/script_grid.rb

Constant Summary

Constants included from Permissions

Permissions::NETZKE_ENDPOINTS

Instance Method Summary collapse

Methods inherited from Grid

#child_components, #class_can?, #configure_form_window, #get_json_sorter, #has_search_action?, #initialize, #linked_components

Methods included from Permissions

#can_call_endpoint?, #can_perform_action?, #can_perform_actions, #current_user_roles, extended, #has_any_perm?, #has_marty_permissions, #has_perm?

Constructor Details

This class inherits a constructor from Marty::Grid

Instance Method Details

#configure(c) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'app/components/marty/script_grid.rb', line 8

def configure(c)
  super

  c.model                  = 'Marty::Script'
  c.multi_select           = false
  c.attributes ||= [:name, :created_dt, :tag]
  c.title ||= I18n.t('scripts', default: 'Scripts')
  c.store_config.merge!(sorters: [{ property: :name, direction: 'ASC' }])
end

#default_bbarObject



84
85
86
# File 'app/components/marty/script_grid.rb', line 84

def default_bbar
  [:add_in_form, :delete]
end

#default_context_menuObject



88
89
90
# File 'app/components/marty/script_grid.rb', line 88

def default_context_menu
  []
end

#default_form_itemsObject



92
93
94
# File 'app/components/marty/script_grid.rb', line 92

def default_form_items
  [:name]
end

#get_records(params) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/components/marty/script_grid.rb', line 18

def get_records(params)
  begin
    ts = Marty::Tag.map_to_tag(root_sess[:selected_tag_id]).created_dt
    ts = Mcfly.normalize_infinity(ts)
  rescue StandardError
    # if there are no non-DEV tags we get an exception above
    ts = 'infinity'
  end

  tb = model.table_name
  model.where("#{tb}.obsoleted_dt >= ? AND #{tb}.created_dt < ?",
              ts, ts).scoping do
    super
  end
end