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
displayNewStatus(attributeModel)
Display the new status for an attribute
Parameters:
Name |
Type |
Description |
attributeModel |
EMLAttribute
|
The attribute model |
- Source:
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:
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:
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 |
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 |
attributeDescription |
string
|
The description 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:
removeAttribute(attributeModel)
Remove an attribute from the view
Parameters:
Name |
Type |
Description |
attributeModel |
EMLAttribute
|
The attribute model |
- Source:
removeAutofill()
Remove the autofill view
- Source:
removeNewStatus(menuItem)
Remove the new status from an attribute
Parameters:
Name |
Type |
Description |
menuItem |
HTMLElement
|
The menu item element |
- Source:
Renders this view
- Source:
Returns:
A reference to this view
-
Type
-
EMLAttributesView
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
showAsNew(menuItem)
Show an attribute as new
Parameters:
Name |
Type |
Description |
menuItem |
HTMLElement
|
The menu item element |
- 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:
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:
stopListenToAttributesCollection()
Stop listening to the attributes collection
- 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:
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: