Sha256: e07bc399544118122983502e5297d49cb3e1392d830741eabfd22ce242e873a5

Contents?: true

Size: 908 Bytes

Versions: 2

Compression:

Stored size: 908 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

        @operator = model.is_a?(String) ? BaseOperator.deserialize(model) : model
        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
        @operator.serialize if @operator.is_a? BaseOperator
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
criteria_operator-ui_component-0.3.1 app/cells/criteria_operator/ui_component/criteria_editor_cell.rb
criteria_operator-ui_component-0.3.0 app/cells/criteria_operator/ui_component/criteria_editor_cell.rb