Class: Marty::Tree

Inherits:
Netzke::Tree::Base
  • Object
show all
Extended by:
Permissions
Defined in:
app/components/marty/tree.rb

Direct Known Subclasses

PromiseView

Constant Summary

Constants included from Permissions

Permissions::NETZKE_ENDPOINTS

Instance Method Summary collapse

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

#initialize(args, kwargs = nil) ⇒ Tree

parent tree is the tree in which child/linked_components is defined child components are components dependent on the selected parent row linked components will update whenever the parent is updated



9
10
11
12
13
# File 'app/components/marty/tree.rb', line 9

def initialize args, kwargs = nil
  super(args, kwargs)
  client_config[:child_components]  = child_components  || []
  client_config[:linked_components] = linked_components || []
end

Instance Method Details

#child_componentsObject



36
37
38
# File 'app/components/marty/tree.rb', line 36

def child_components
  []
end

#class_can?(op) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'app/components/marty/tree.rb', line 21

def class_can?(op)
  self.class.can_perform_action?(op)
end

#configure(c) ⇒ Object



25
26
27
28
29
30
31
32
33
34
# File 'app/components/marty/tree.rb', line 25

def configure(c)
  super

  c.permissions = {
    create: class_can?(:create),
    read:   class_can?(:read),
    update: class_can?(:update),
    delete: class_can?(:delete)
  }
end

#configure_form_window(c) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
# File 'app/components/marty/tree.rb', line 44

def configure_form_window(c)
  super

  c.klass = Marty::RecordFormWindow

  # Fix Add in form/Edit in form modal popup width
  # Netzke 0.10.1 defaults width to 80% of screen which is too wide
  # for a form where the fields are stacked top to bottom
  # Netzke 0.8.4 defaulted width to 400px - let's make it a bit wider
  c.width = 475
end

#linked_componentsObject



40
41
42
# File 'app/components/marty/tree.rb', line 40

def linked_components
  []
end