Sha256: f51d08896b71fe1570807a5ff9703e7e4fff232347b0de71f9c3640d2a362150

Contents?: true

Size: 816 Bytes

Versions: 1

Compression:

Stored size: 816 Bytes

Contents

require 'yaml'

module CriteriaOperator
  module UiComponent
    class CriteriaEditorCell < BaseCell

      def show(options = {})
        @input_id = options[:id] if options.has_key? :id
        @input_name = options[:name] if options.has_key? :name
        # TODO: provide support for read_only
        render
      end

      def choose_template(options = {})
        if model.kind_of? BinaryOperator
          ExpressionCell.call(model).call(:show, options)
        else
          GroupCell.call(model).call(:show, options)
        end
      end

      private

      def input_id
        @input_id
      end

      def input_name
        @input_name
      end

      def serialized_operator
        YAML.dump(model) if model.is_a? BaseOperator
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
criteria_operator-ui_component-0.2.2 app/cells/criteria_operator/ui_component/criteria_editor_cell.rb