Class: UtilsController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#archivesspace, can_access?, permission_mappings, set_access_control

Instance Method Details

#generate_sequenceObject



7
8
9
# File 'frontend/app/controllers/utils_controller.rb', line 7

def generate_sequence
  render :json => SequenceGenerator.from_params(params)
end

#list_propertiesObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'frontend/app/controllers/utils_controller.rb', line 12

def list_properties
  resource_type = params[:resource_type]

  list = []

  JSONModel(resource_type).schema['properties'].each do |name, defn|

    next if params['editable'] && defn.has_key?('dynamic_enum')
    next if params['editable'] && %w(uri jsonmodel_type).include?(name)
    next if params['editable'] && defn['readonly']
    next if params['type'] && defn['type'] != params['type']

    list << [name, t("#{resource_type}.#{name}")]
  end

  render :json => list
end

#note_orderObject



35
36
37
38
39
40
41
# File 'frontend/app/controllers/utils_controller.rb', line 35

def note_order
  prefs = user_prefs
  if prefs['note_order'].empty?
    prefs['note_order'] = view_context.note_types_for(:resource).keys
  end
  render :json => prefs['note_order']
end

#shortcutsObject



31
32
33
# File 'frontend/app/controllers/utils_controller.rb', line 31

def shortcuts
  render_aspace_partial :partial => "shared/modal", :locals => {:title => t("shortcuts.quick_reference_window"), :partial => "shared/shortcuts", :large => true}
end