Class: UtilsController

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

Constant Summary

Constants included from Searchable

Searchable::ABSTRACT

Instance Method Summary collapse

Methods inherited from ApplicationController

#archivesspace, can_access?, permission_mappings, set_access_control

Methods included from JsonHelper

#merge_notes, #process_json_notes

Methods included from Searchable

#default_search_opts, #get_filter_years, #handle_results, #html_notes, #process_results, #process_search_results, #repo_context, #search_terms, #set_up_advanced_search, #set_up_and_run_search, #set_up_search, #strip_facet_fields

Methods included from HandleFaceting

#fetch_only_facets, #get_pretty_facet_value, #strip_facets

Methods included from ManipulateNode

#inheritance, #process_mixed_content, #strip_mixed_content

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, I18n.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 => I18n.t("shortcuts.quick_reference_window"), :partial => "shared/shortcuts", :large => true}
end