Constructor
new EMLAttributesView()
- Source:
Extends
Members
className :string
The className to add to the view container
Type:
- Source:
Settings for the semantic UI popup used to indicate that an attribute
will be removed when the remove button is clicked
Type:
- Source:
Methods
addNewAttribute()
Adds a blank attribute to the end of the collection for the user to
fill out.
- Source:
Create a menu item for an attribute
Parameters:
Name |
Type |
Description |
attributeModel |
EMLAttribute
|
The attribute model |
- Source:
Returns:
The menu item element
-
Type
-
HTMLElement
Creates an instance of an add attribute button.
Parameters:
Name |
Type |
Description |
classes |
Array.<string>
|
Extra classes to add to the button |
- Source:
Returns:
The add attribute button element
-
Type
-
HTMLElement
events()
The events this view will listen to and the associated function to
call.
- Source:
Get the label of a menu item
Parameters:
Name |
Type |
Description |
menuItem |
HTMLElement
|
The menu item element |
- Source:
Returns:
The label of the menu item
-
Type
-
string
handleMenuItemClick(e)
Handle the click event on a menu item
Parameters:
Name |
Type |
Description |
e |
Event
|
The click event |
- Source:
handleRemove(e)
Handle the remove event for an attribute
Parameters:
Name |
Type |
Description |
e |
Event
|
The click event |
- Source:
hideAddAttributeMessage()
Hide the add attribute help message
- Source:
hideAllAttributes()
Hide all attribute views
- Source:
hideAttribute(attributeModel)
Hide an attribute
Parameters:
Name |
Type |
Description |
attributeModel |
EMLAttribute
|
The attribute model |
- Source:
hideAttributeValidation(attributeModel)
Hide the attribute validation errors from the attribute navigation menu
Parameters:
Name |
Type |
Description |
attributeModel |
EMLAttribute
|
The attribute model |
- Source:
hideAutofill()
Hide the autofill view and show the attributes
- Source:
hideEverything()
Hide the attributes, autofill view, and references panel
- Source:
hideReferences()
Hide the references panel
- Source:
initialize(options)
Creates a new EMLAttributesView
Parameters:
Name |
Type |
Description |
options |
object
|
A literal object with options to pass to the
view
Properties
Name |
Type |
Attributes |
Description |
collection |
EMLAttributes
|
|
The collection of
EMLAttribute models to display |
references |
References
|
<optional>
|
The reference element to
display instead of the collection. Will be ignored if collection is
provided. |
parentModel |
EMLEntity
|
|
The entity model to which
these attributes belong |
isNew |
boolean
|
<optional>
|
Set to true if this is a new
attribute |
|
- Source:
listenToAttributeModel(attributeModel)
Sets up listeners for the specified attribute model to handle various
events. Updates the UI and triggers appropriate actions when the
model's state changes.
Parameters:
Name |
Type |
Description |
attributeModel |
Backbone.Model
|
The attribute model to listen
to. |
- Source:
listenToAttributesCollection()
Set up event listeners for the collection and its models
- Source:
The HTML template for an attribute
Parameters:
Name |
Type |
Description |
attrs |
object
|
The attributes to render in the template
Properties
Name |
Type |
Description |
classes |
string
|
Extra classes to add to the menu item
separated by spaces |
attrId |
string
|
The if of the attribute |
attributeName |
string
|
The name of the attribute |
|
- Source:
Returns:
The HTML template for an attribute
-
Type
-
HTMLElement
onClose()
Actions to perform when the view is removed
- Source:
Re-order the menu items to match the order of the collection
- Source:
previewAttrRemove(e)
Show the user what will be removed when this remove button is clicked
Parameters:
Name |
Type |
Description |
e |
Event
|
The click event |
- Source:
referencesTemplate(sourceTitle, sourceAttrNames) → {HTMLElement}
Creates a template for the references panel
Parameters:
Name |
Type |
Description |
sourceTitle |
string
|
The title of the source entity |
sourceAttrNames |
Array.<string>
|
The names of the attributes in the
source entity |
- Source:
Returns:
The references panel element
-
Type
-
HTMLElement
removeAttribute(attributeModel)
Remove an attribute from the view that was just removed from the
collection
Parameters:
Name |
Type |
Description |
attributeModel |
EMLAttribute
|
The attribute model |
- Source:
removeAutofill()
Remove the autofill view
- Source:
Renders this view
- Source:
Returns:
A reference to this view
-
Type
-
EMLAttributesView
renderAddAttributeMessage()
When there are no attrbutes yet, show a message to the user to help
them add an attribute. Include a button to add a new attribute.
- Source:
renderAttribute(attributeModel)
Render an attribute
Parameters:
Name |
Type |
Description |
attributeModel |
EMLAttribute
|
The attribute model to render |
- Source:
renderAttributes()
Create an attribute view & menu item for each attribute in the
collection, set up event listeners on the attributes, and set the first
attribute as active. Creates a new attribute for the user to fill out.
This function can be used to re-render the attributes.
- Source:
Render the autofill view and save a reference to it
- Source:
Returns:
The autofill view
-
Type
-
AutofillAttributesView
renderReferences() → {HTMLElement|null}
Renders the references button and panel
- Source:
Returns:
The references button element or null if
the references' linked model can't be found
-
Type
-
HTMLElement
|
null
renderReferencesOrAttributes()
Check if the attrList has references or attributes (since both are not
allowed), and render the appropriate UI.
- Source:
showAddAttributeMessage()
Show the add attribute help message
- Source:
showAttribute(attributeModel)
Show an attribute
Parameters:
Name |
Type |
Description |
attributeModel |
EMLAttribute
|
The attribute model |
- Source:
showAttributeValidation(attributeModel)
Show the attribute validation errors in the attribute navigation menu
Parameters:
Name |
Type |
Description |
attributeModel |
EMLAttribute
|
The attribute model |
- Source:
showAutofill()
Display the autofill view, hide the attributes.
- Source:
showReferences()
Show the references panel and hide everything else
- Source:
startAllListeners()
Initializes event listeners for all attribute models in the collection
and the attributes collection itself.
- Source:
stopAllListeners()
Stops all event listeners associated with the attribute models in the
collection and the attributes collection itself.
- Source:
stopListeningToAttributeModel(attributeModel)
Stops listening to events from the specified attribute model.
Parameters:
Name |
Type |
Description |
attributeModel |
Backbone.Model
|
The attribute model to stop
listening to. |
- Source:
stopListeningToAttributesCollection()
Stop listening to the attributes collection
- Source:
switchToSourceEntity()
Close the modal containing this view and open the modal for a different
entity in the same entities collection. Requires that the parent
EMLEntityView is on this view.
- Source:
template() → {DocumentFragment}
Generates the HTML template for the EMLAttributesView.
- Source:
Returns:
The HTML template content for the
EMLAttributesView.
-
Type
-
DocumentFragment
Update the label of a menu item
Parameters:
Name |
Type |
Description |
menuItem |
HTMLElement
|
The menu item element |
text |
string
|
The new label text |
- Source:
validatePreviousAttribute()
Validate the previous attribute
- Source: