Class: Marty::ScriptForm

Inherits:
Form
  • Object
show all
Defined in:
app/components/marty/script_form.rb

Constant Summary collapse

DASH =
0x2012.chr('utf-8')

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?

Instance Method Details

#can_save?(script) ⇒ Boolean

Returns:

  • (Boolean)


41
42
43
# File 'app/components/marty/script_form.rb', line 41

def can_save?(script)
  script && self.class.has_perm?(:dev) && Mcfly.is_infinity(script.obsoleted_dt)
end

#configure(c) ⇒ Object



147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# File 'app/components/marty/script_form.rb', line 147

def configure(c)
  super

  c.title = 'Script Form'
  c.model = 'Marty::Script'
  c.items =
    [
      {
        line_numbers:   true,
        indent_unit:    4,
        tab_mode:       'shift',
        match_brackets: true,
        hide_label:     true,
        xtype:          :codemirror,
        mode:           'text/x-delorean',
        name:           :body,
        empty_text:     'No script selected.',
        getter:         lambda { |r| r.body },
      },
    ]
end

#default_bbarObject



138
139
140
141
142
143
# File 'app/components/marty/script_form.rb', line 138

def default_bbar
  [
    :apply,
    :do_print,
  ]
end