Utils

confirm

class confirm()
confirm.confirmModal(message, acceptCb, refuseCb, textYes="Ok", textNo="Cancel")

Renders a modal dialog asking the user a yes/no question.

Arguments
  • message (String) – The message that the user will be asked

  • acceptCb (function) – Will be called if the user accepts

  • refuseCb (function) – Will be called if the user denies

  • textYes (String) – Text to be displayed in the Yes button

  • textNo (String) – Text to be displayed in the No button

Returns

View – The view that got instanced.

Examples:

var modal = Utils.confirmModal('Are you sure?', () => {}, () => {}, 'Sure', 'Not Really');

cssEscape

class cssEscape()
cssEscape.escape(string, escapeNonASCII=true)

Escapes a string so it can be used for CSS classes

Arguments
  • string (String) – String to escape

  • escapeNonASCII (Boolean) – Whether to escape non ASCII characters

Returns

String – Escaped string

Examples:

var escaped = Utils.cssEscape.escape('foo');

facetParser

class facetParser()
facetParser.parse(query)

Parses the query and returns facets as a JSON object.

Arguments
  • query (String) – Query to parse

Returns

Object – Parsed facets

Examples:

var facets = Utils.facetParser.parse('foo:bar');

itemModal

class itemModal()
itemModal.ItemModalOptions()
Arguments
  • project (Model) – The project (this.project)

  • collection (Collection) – The item collection (for navigation)

  • pdfPageJump (Boolean) – Whether to jump to pdf first page

  • matching (Boolean) – Whether to show matching pages

  • duplicates (Boolean) – Whether to show duplicates

  • wideModal (Boolean) – Whether to make the modal wide

  • customTemplate (Template) – Custom template for the modal content view

  • customTemplateParams (Object) – Parameters object to pass into the custom template

itemModal.open(item, options)

Opens a item detail modal with custom parameters

Arguments
  • item (String) – Item to open

  • options (ItemModalOptions) – Options

Examples:

Utils.itemModal.open(item);

queryparam

class queryparam()
queryparam.parse()

Parses the current URL and returns the params (hash) object in the form of a JSON

Returns

Object – Params object

Examples:

var params = Utils.queryparam.parse();