Module: Tiun::CoreHelper

Includes:
ActionView::Helpers::TagHelper
Included in:
CoreController
Defined in:
lib/tiun/core_helper.rb

Instance Method Summary collapse

Instance Method Details

#current_user_dataObject



12
13
14
15
16
17
18
# File 'lib/tiun/core_helper.rb', line 12

def current_user_data
   @current_user&.jsonize(only:
      ["id", "last_login_at", "last_active_at", "default_name", "refresh_token", "session_token",
      "accounts" => %w(id no type),
      "user_names" => %w(id kind way usage source main nomen_id name),
      "descriptions" => %w(id language_code alphabeth_code type text)])
end

#react_component(name, props = {}, options = {}, &block) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/tiun/core_helper.rb', line 4

def react_component name, props = {}, options = {}, &block
   html_options = options.reverse_merge(data: {
      react_class: name,
      react_props: (props.is_a?(String) ? props : props.to_json)
   })
   (:div, '', html_options, &block)
end