BagItProfileController

BagItProfileController

BagItProfileController provides methods to display and update BagItProfile objects.

Constructor

new BagItProfileController(params)

Parameters:
Name Type Description
params url.URLSearchParams

Query parameters. The most important of these is "id", which specifies the id the BagItProfile to load.

Source:

Members

defaultOrderBy :string

The property by which this controller sorts the list display. Here, it's the "name" property of the BagItProfile object.

Source:

defaultSortDirection :string

The default order in which to sort the list of BagItProfiles. Can be "asc" or "desc". This is set to "asc".

Source:

formClass :Form

This is the name of the form class that can render a form for this controller's model. For this controller, it's BagItProfileForm

Source:

formTemplate :handlebars.Template

This is the template that renders this controller's form. Templates are properties of the Template object.

Source:

listTemplate :handlebars.Template

This is the template that renders this controller's object list. Templates are properties of the Template object.

Source:

model :PersistentObject|object

The model which the controller represents. In this case, it's the class BagItProfile.

Source:

nameProperty :string

The name property of this template's model. This is used when ordering lists of objects by name. For the BagItProfile object, it's would "name".

Source:

typeMap :url.URLSearchParams

A url.URLSearchParams object containing parameters that the controller will need to render the display. For forms, the only required param is usually "id", which is the UUID of the object to be edited. For lists, this typically includes limit, offset, orderBy, and sortDirection.

Source:

Methods

_enterKeyHandler()

Handle the enter key press in the New Tag File modal. If we don't handle this, the Electron browser window takes the default action of submitting the single-element form, resulting in a blank window.

This handler does what the user expects, which is the same as clicking on the save button.

Source:

_getPageHTML(profile, opts) → {string}

This fills in the page-level data structure and passes it to the BagItProfileForm template. It returns the HTML rendered by the template.

Parameters:
Name Type Description
profile BagItProfile

The BagItProfile whose properties should be displayed in the form.

opts object

Additional options to pass into the template context. These may include errors, errMessage, and alertMessage.

Source:

create()

This method creates a new BagItProfile, either from scratch or based on an existing profile that the user selected. It then redirects to the edit() method, so the user can customize the new profile.

Source:

deleteTagDef()

This deletes a TagDefinition from this BagItProfile, if the user confirms the deletion.

Source:

edit()

This presents the tabbed BagItProfile edit form that enables the user to customize a BagItProfile.

Source:

exportProfile()

Exports a DART BagIt Profile to the format used by https://github.com/bagit-profiles/bagit-profiles/

The exported profile appears in a modal window.

Source:

getNewProfileFromBase() → {BagItProfile}

This returns an entirely new BagItProfile, or a new BagItProfile that is a copy of a base profile.

Source:

importStart()

This shows a screen where user can choose to import a profile from a URL or a textarea.

Source:

new()

This method presents a form that asks if the user would like to create a new BagItProfile from scratch or based on an existing BagItProfile. The user has to go through this form before actually getting to the BagItProfile form.

Source:

newTagFile()

This displays a modal dialog asking the user to name a new tag file to be added to this profile.

Source:

newTagFileCreate()

This creates a new tag file in the BagItProfile by adding a single new TagDefinition whose tagFile attribute matches the tag file name the user typed in.

Source:

update()

This is called when the user clicks the Save button on the BagItProfile edit form. It saves the profile, if the profile is valid, or re-displays the form with error message if the profile is not valid.

Source: