Metadata Feedback Tool API

The contents of this page are still in development and may change.

Overview

The feedback tool component creates a sticky toolbar at the top of the page where users can provide metadata feedback for the page content. The feedback tool also saves users' feedback, currently into a local pouch database, for statistical purposes.

 

var feedback = gpii.metadata.feedbackLoader(container[, options]);

 

Feedback Model

Feedback model
{
  id: <user_id>,
  model: {
    match: boolean,
    mismatch: boolean,
    notInteresting: boolean,
    other: boolean,     // Users can turn on "other" without giving any "otherFeedback"
    otherFeedback: string,
    requests: {
      text: boolean,
      transcripts: boolean,
      audio: boolean,
      audioDesc: boolean
    },
    votes: {
      <voteType>: boolean
    }
  }
} 

API

Creator
gpii.metadata.feedbackLoader(container, options)
Supported Events

onTemplatesLoaded
Fires when all templates are loaded.

onSave

Fires before the data gets saved into the db.

afterSave

Fires when the data has been saved. This event is fired in the callback function of the database set() function.

afterMatchConfirmationButtonClicked
Fires when the happy face button for showing the match confirmation dialog is clicked and actions defined in the click event handler are performed.

afterMismatchDetailsButtonClicked
Fires when the sad face button for showing the mismatch details dialog is clicked and actions defined in the click event handler are performed.

onSkipAtMismatchDetails

Fires when the skip link on the mismatch details dialog is clicked.

onSubmitAtMismatchDetails
Fires when the submit button on the mismatch details dialog is clicked.

MethodsNone
Options

templatePrefix

(Optional) A string value representing the relative path to the directory containing the templates.

templates

(Optional) An object containing pairs of a template name and the relative path to this template. The default value is:
{
    feedback: "%prefix/feedbackTemplate.html",
    matchConfirmation: "%prefix/matchConfirmationTemplate.html",
    mismatchDetails: "%prefix/mismatchDetailsTemplate.html"
}

feedback

(Optional) The data structure that configures the feedback component.
Subcomponents

templateLoader

Load in all templates needed by the feedback tool.

feedback

Renders the feedback toolbar.