Class: Marty::McflyGridPanel
- Defined in:
- app/components/marty/mcfly_grid_panel.rb
Direct Known Subclasses
ApiAuthView, BaseRuleView, DataGridView, GridAppendOnly, LiveSearchGridPanel
Constant Summary
Constants included from Permissions
Permissions::ALL_ROLES, Permissions::REQ_ROLES
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_perform_action?, #can_perform_actions, #current_user_roles, #has_any_perm?, #has_marty_permissions
Constructor Details
This class inherits a constructor from Marty::Grid
Instance Method Details
#augment_attribute_config(c) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/components/marty/mcfly_grid_panel.rb', line 29 def augment_attribute_config(c) super # Set mcfly_scope if the attribute is a mcfly association if !c[:scope] && model_adapter.association_attr?(c) assoc_name, assoc_method = c[:name].split('__') begin aklass = model.reflect_on_association(assoc_name.to_sym).klass rescue raise "trouble finding #{assoc_name} assoc class on #{model}" end c[:scope] = Mcfly.has_mcfly?(aklass) ? self.class.mcfly_scope(assoc_method || 'id') : self.class.sorted_scope(assoc_method || 'id') end end |
#configure(c) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'app/components/marty/mcfly_grid_panel.rb', line 2 def configure(c) super warped = Marty::Util.warped? c.editing = !warped && c.editing || :none [:update, :delete, :create].each do |perm| c.[perm] = false if warped end # default sort all Mcfly grids with id c.store_config.merge!({sorters: [{property: :id, direction: 'ASC'}]}) end |
#get_records(params) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'app/components/marty/mcfly_grid_panel.rb', line 17 def get_records(params) ts = Mcfly.normalize_infinity(Marty::Util.get_posting_time) tb = model.table_name model.where("#{tb}.obsoleted_dt >= ? AND #{tb}.created_dt < ?", ts, ts).scoping do super end end |