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

Methods included from TokenAuthentication

#intercept_project, #intercept_user, #intercept_user_or_project, #project_token_authenticate, #token_authenticate

Instance Method Details

#get_klassObject (protected)


25
26
27
28
29
30
31
32
33
34
35
# File 'app/controllers/metadata_controller.rb', line 25

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

#indexObject


6
7
8
9
# File 'app/controllers/metadata_controller.rb', line 6

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

#object_navigationObject


18
19
20
21
# File 'app/controllers/metadata_controller.rb', line 18

def object_navigation
  @object = GlobalID::Locator.locate(params.require(:global_id))
  render json: {status: 200} 
end

#object_radialObject

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


12
13
14
15
16
# File 'app/controllers/metadata_controller.rb', line 12

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