Class: ApiComponent

Inherits:
Component show all
Defined in:
app/components/api_component.rb

Overview

Api — AJAX request management wrapper.

Usage:

Api(url: "/api/users", method_val: :get) {
  Button { text "Load Users" }
}

Constant Summary

Constants inherited from Component

Component::HTML_OPTIONS

Instance Method Summary collapse

Methods inherited from Component

default, #initialize, #render_in, slot

Constructor Details

This class inherits a constructor from Component

Instance Method Details

#to_sObject



16
17
18
19
20
21
22
23
# File 'app/components/api_component.rb', line 16

def to_s
  data = { controller: "fui-api", fui_api_method_value: method_val }
  data[:fui_api_url_value] = url if url
  data[:fui_api_action_value] = action_val if action_val
  data[:fui_api_state_context_value] = state_context if state_context

  tag.div(data: data) { @content }
end