Module: Glib::Json::Ui

Extended by:
ActiveSupport::Concern
Defined in:
app/controllers/concerns/glib/json/ui.rb

Instance Method Summary collapse

Instance Method Details

#__json_ui_commit(options) ⇒ Object



48
49
50
51
52
53
54
55
56
57
# File 'app/controllers/concerns/glib/json/ui.rb', line 48

def __json_ui_commit(options)
  if @__json_ui_rendering
    if (hash = json_transformation_start).is_a?(Hash)
      case params[:_render]
      when 'v1'
        __json_ui_vue(hash, options)
      end
    end
  end
end

#__json_ui_startObject



34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'app/controllers/concerns/glib/json/ui.rb', line 34

def __json_ui_start
  @__json_ui_activated = false
  @__json_ui_rendering = false
  if params[:_render].present?
    @__json_ui_activated = true
    request.variant = :ui

    if request.format.html? && params[:_skip_render] != 'true'
      @__json_ui_rendering = true
      request.format = 'json'
    end
  end
end

#form_authenticity_tokenObject

Override



17
18
19
# File 'app/controllers/concerns/glib/json/ui.rb', line 17

def form_authenticity_token
  Rails.env.test? ? 'test_token' : super
end

#json_ui_activated?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'app/controllers/concerns/glib/json/ui.rb', line 30

def json_ui_activated?
  @__json_ui_activated
end

#json_ui_url_optionsObject

NOTE: Override default_url_options and call this method



22
23
24
25
26
27
28
# File 'app/controllers/concerns/glib/json/ui.rb', line 22

def json_ui_url_options
  options = {}
  options[:_render] = params[:_render]
  options[:_locale] = params[:_locale]
  options[:format] = :json if request.format == :json
  options
end