Module: Workbench::FormHelper

Defined in:
app/helpers/workbench/form_helper.rb

Instance Method Summary (collapse)

Instance Method Details



3
4
5
# File 'app/helpers/workbench/form_helper.rb', line 3

def destroy_related_link(f, text: 'x')
  (:span, text, class: 'destroyable', 'data-object-name' => f.object_name) if !f.object.new_record? 
end

- (html) lock_tag(locks, object_name, method, klass = 'lock')

Returns a check box and label, styled as SVG icons

Parameters:

  • locks (Field::Locks)
  • object_name (String, Symbol)

    the object

  • method (String, Symbo)

    the method

Returns:

  • (html)

    a check box and label, styled as SVG icons



11
12
13
14
15
16
17
18
# File 'app/helpers/workbench/form_helper.rb', line 11

def lock_tag( locks, object_name, method, klass = 'lock' )
  locked = locks.locked?(object_name, method)
  name = "locks[#{object_name}][#{method}]"

  css = klass
  check_box_tag(name, "1", locked, class: :locked) + 
  label_tag(name, '', class: css)
end