Sha256: aaa6186f8140a74464d0d127a4972e62a2f590d62cbb932049f11a70fcc6d6ba

Contents?: true

Size: 746 Bytes

Versions: 41

Compression:

Stored size: 746 Bytes

Contents

module Plugins
  module Core
    class BooleanCell < Plugins::Core::Cell
      def checkbox
        render
      end

      def switch
        render
      end

      private

      def value
        if data
          data['value'] == 'true' ? true : false
        else
          false
        end
      end

      def checkbox_id
        @options[:field_name]
      end

      def render_checkbox_label
        @options[:form].label :data, field.name, class: 'mdl-checkbox__label'
      end

      def render_checkbox
        @options[:form].check_box 'data[value]', { checked: value, class: 'mdl-checkbox__input', id: checkbox_id }, 'true', 'false'
      end

      def render_switch
        raise 'not implemented'
      end
    end
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
cortex-plugins-core-3.2.0 app/cells/plugins/core/boolean_cell.rb
cortex-plugins-core-3.1.0 app/cells/plugins/core/boolean_cell.rb
cortex-plugins-core-3.0.0 app/cells/plugins/core/boolean_cell.rb
cortex-plugins-core-2.1.1 app/cells/plugins/core/boolean_cell.rb
cortex-plugins-core-2.1.0 app/cells/plugins/core/boolean_cell.rb
cortex-plugins-core-2.0.1 app/cells/plugins/core/boolean_cell.rb
cortex-plugins-core-1.1.1 app/cells/plugins/core/boolean_cell.rb
cortex-plugins-core-1.1.0 app/cells/plugins/core/boolean_cell.rb
cortex-plugins-core-1.0.0 app/cells/plugins/core/boolean_cell.rb
cortex-plugins-core-0.12.4 app/cells/plugins/core/boolean_cell.rb
cortex-plugins-core-0.12.3 app/cells/plugins/core/boolean_cell.rb
cortex-plugins-core-0.12.2 app/cells/plugins/core/boolean_cell.rb
cortex-plugins-core-0.12.1 app/cells/plugins/core/boolean_cell.rb
cortex-plugins-core-0.12.0 app/cells/plugins/core/boolean_cell.rb
cortex-plugins-core-0.11.3 app/cells/plugins/core/boolean_cell.rb
cortex-plugins-core-0.11.2 app/cells/plugins/core/boolean_cell.rb
cortex-plugins-core-0.11.1 app/cells/plugins/core/boolean_cell.rb
cortex-plugins-core-0.11.0 app/cells/plugins/core/boolean_cell.rb
cortex-plugins-core-0.10.4 app/cells/plugins/core/boolean_cell.rb
cortex-plugins-core-0.10.2 app/cells/plugins/core/boolean_cell.rb