fatfreecrm/fat_free_crm

View on GitHub
app/views/fields/_group_table.html.haml

Summary

Maintainability
Test Coverage
%table
  - field_group.fields.without_pairs.in_groups_of(2, false) do |group|
    %tr
      - group.each_with_index do |field, i|
        %td{class: (f.object.errors[field.name].present? ? 'fieldWithErrors' : nil)}
          - if field.hint.present?
            = image_tag "info_tiny.png", title: field.hint, class: "tooltip-icon"
          - if field.as == 'check_boxes'
            - value = f.object.send(field.name)
            - checked = YAML.load(value.to_s)
          .label.top{class: (field.required? ? 'req': nil)}
            = "#{field.label}:"
          = f.input_field field.name, field.input_options.merge(checked: checked)
        - if i == 0
          %td= spacer