Class: CriteriaOperator::UiComponent::AjaxController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- CriteriaOperator::UiComponent::AjaxController
- Defined in:
- app/controllers/criteria_operator/ui_component/ajax_controller.rb
Instance Method Summary collapse
- #create_expression ⇒ Object
- #create_group ⇒ Object
- #delete_element ⇒ Object
- #expression_type_change ⇒ Object
- #group_type_change ⇒ Object
- #operand_change ⇒ Object
Instance Method Details
#create_expression ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'app/controllers/criteria_operator/ui_component/ajax_controller.rb', line 9 def create_expression return unless ajax_params.has_key? :root_operator root_operator = root_op_from_params operator = BinaryOperator.new add_sub_operator root_operator, operator, ajax_params[:locator] html = ExpressionCell.call(operator).call(:show, locator: new_locator) render json: { html: html, operator: YAML.dump(root_operator) } end |
#create_group ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'app/controllers/criteria_operator/ui_component/ajax_controller.rb', line 18 def create_group return unless ajax_params.has_key? :root_operator root_operator = root_op_from_params operator = GroupOperator.new add_sub_operator root_operator, operator, ajax_params[:locator] html = GroupCell.call(operator).call(:show, locator: new_locator) render json: { html: html, operator: YAML.dump(root_operator) } end |
#delete_element ⇒ Object
27 28 29 30 31 32 |
# File 'app/controllers/criteria_operator/ui_component/ajax_controller.rb', line 27 def delete_element return unless (ajax_params.has_key? :root_operator) && (ajax_params.has_key? :locator) root_operator = root_op_from_params remove_sub_operator root_operator, ajax_params[:locator] render json: { operator: YAML.dump(root_operator) } end |
#expression_type_change ⇒ Object
43 44 45 46 47 48 49 |
# File 'app/controllers/criteria_operator/ui_component/ajax_controller.rb', line 43 def expression_type_change return unless (ajax_params.has_key? :root_operator) && (ajax_params.has_key? :locator) root_operator = root_op_from_params op = locate_sub_operator root_operator, ajax_params[:locator] op.operator_type = ajax_params[:operator_type_value] render json: { operator: YAML.dump(root_operator) } end |
#group_type_change ⇒ Object
51 52 53 54 55 56 |
# File 'app/controllers/criteria_operator/ui_component/ajax_controller.rb', line 51 def group_type_change return unless (ajax_params.has_key? :root_operator) && (ajax_params.has_key? :locator) root_operator = root_op_from_params root_operator = change_sub_group_type root_operator, ajax_params[:locator], ajax_params[:operator_type_value].to_i render json: { operator: YAML.dump(root_operator) } end |
#operand_change ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'app/controllers/criteria_operator/ui_component/ajax_controller.rb', line 34 def operand_change return unless (ajax_params.has_key? :root_operator) && (ajax_params.has_key? :locator) root_operator = root_op_from_params op = locate_sub_operator root_operator, ajax_params[:locator] op.left_operand = OperandProperty.new(ajax_params[:operand_value]) if ajax_params[:operand_type] == 'left' op.right_operand = OperandValue.new(ajax_params[:operand_value]) if ajax_params[:operand_type] == 'right' render json: { operator: YAML.dump(root_operator) } end |