Class: MetadataController

Inherits:
ApplicationController show all
Defined in:
app/controllers/metadata_controller.rb

Instance Method Summary (collapse)

Methods included from RequestType

#json_request?

Methods included from LogRecent

#log_user_recent_route

Methods included from Cookies

#digest_cookie, #digested_cookie_exists?

Methods included from Whitelist

#whitelist_constantize

Methods included from ProjectsHelper

#invalid_object, #project_link, #project_matches, #project_tag, #projects_list, #projects_search_form

Methods included from Api::Intercept

#intercept_api

Instance Method Details

- (Object) get_klass (protected)



18
19
20
21
22
23
24
25
26
27
28
# File 'app/controllers/metadata_controller.rb', line 18

def get_klass
  render json: {status: 400} if (params[:type] && params[:global_id]) || (params[:type].blank? && params[:global_id].blank?)

  if params[:type]
    @klass = params[:type] 
    @object = nil
  else
    @object = GlobalID::Locator.locate(params.require(:global_id))
    @klass = OBJECT_RADIALS[@object.class.name] ? @object.class.name : @object.class.base_class.name
  end
end

- (Object) index



4
5
6
7
# File 'app/controllers/metadata_controller.rb', line 4

def index
  @klass = params[:klass]
  render '/shared/data/metadata/index'
end

- (Object) object_radial

:klass is a base class name, like “Otu”



10
11
12
13
14
# File 'app/controllers/metadata_controller.rb', line 10

def object_radial 
  get_klass
  @data = OBJECT_RADIALS[@klass]
  render '/workbench/navigation/object_radial'
end