Class: Glib::ApiDocsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/glib/api_docs_controller.rb

Instance Method Summary collapse

Instance Method Details

#componentObject

GET /glib/json_ui_api/:category/:component



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'app/controllers/glib/api_docs_controller.rb', line 48

def component
  @category = params[:category]
  @component_key = params[:component]
  @doc = load_documentation(@category)

  unless @doc
    render plain: "Category '#{@category}' not found", status: :not_found
    return
  end

  @component = @doc['components'][@component_key]

  unless @component
    render plain: "Component '#{@component_key}' not found in category '#{@category}'", status: :not_found
    return
  end
end

#indexObject

GET /glib/json_ui_api



30
31
32
# File 'app/controllers/glib/api_docs_controller.rb', line 30

def index
  @categories = load_all_categories
end

#json_inject_feature_usage_analyticsObject



22
# File 'app/controllers/glib/api_docs_controller.rb', line 22

def json_inject_feature_usage_analytics; end

#json_inject_flash_actionsObject



23
# File 'app/controllers/glib/api_docs_controller.rb', line 23

def json_inject_flash_actions; end

#json_inject_left_menuObject

Override injection methods to do nothing



21
# File 'app/controllers/glib/api_docs_controller.rb', line 21

def json_inject_left_menu; end

#set_path_prefixObject



25
26
27
# File 'app/controllers/glib/api_docs_controller.rb', line 25

def set_path_prefix
  @path_prefix = 'glib/api_docs'
end

#showObject

GET /glib/json_ui_api/:category



35
36
37
38
39
40
41
42
43
44
45
# File 'app/controllers/glib/api_docs_controller.rb', line 35

def show
  @category = params[:category]
  @doc = load_documentation(@category)

  unless @doc
    render plain: "Category '#{@category}' not found", status: :not_found
    return
  end

  @components = @doc['components'] || {}
end