lib/voom/presenters/dsl/components/event.rb in voom-presenters-0.1.7 vs lib/voom/presenters/dsl/components/event.rb in voom-presenters-0.1.8
- old
+ new
@@ -57,24 +57,31 @@
type: :dialog,
target: dialog_id,
params: params, &block)
end
- def toggle_visiblity(component_id, **params, &block)
+ def toggle_visibility(component_id, **params, &block)
@actions << Components::Action.new(parent: self,
type: :toggle_visibility,
target: component_id,
params: params, &block)
end
- def selects(input_name=nil, **params, &block)
+ def show(component_id, **params, &block)
@actions << Components::Action.new(parent: self,
- type: :selects,
- target: input_name,
- params: params, &block)
+ type: :toggle_visibility,
+ target: component_id,
+ params: params.merge(action: :show), &block)
end
+ def hide(component_id, **params, &block)
+ @actions << Components::Action.new(parent: self,
+ type: :toggle_visibility,
+ target: component_id,
+ params: params.merge(action: :hide), &block)
+ end
+
def snackbar(text, **params, &block)
@actions << Components::Action.new(parent: self,
type: :snackbar,
params: params.merge(text: text), &block)
end
@@ -89,12 +96,24 @@
def navigates(direction, **params, &block)
@actions << Components::Action.new(parent: self,
type: :navigates,
direction: direction,
- params: params, &block)
+ params: params.merge(direction: direction), &block)
end
+
alias navigate navigates
+
+ # Clears or blanks out a control or form.
+ # Takes either an id or a list of ids.
+ # If the id is that of a form then all the clearable inputs on the form will be cleared.
+ def clear(*ids, **params, &block)
+ @actions << Components::Action.new(parent: self,
+ type: :clear,
+ params: params.merge(ids: ids), &block)
+ end
+
+ alias clears clear
end
end
end
end
end