Constructor
new PortEditorSectionView()
Extends
- Backbone.View
Members
className :string
The HTML classes to use for this view's element
Type:
- string
editorView :PortalEditorView
A reference to the PortalEditorView
Type:
events :Object
The events this view will listen to and the associated function to call.
Type:
- Object
model :PortalSection
The PortalSectionModel being displayed
Type:
- PortalSection
sectionsOptions :Array.<PorttEditorSectionView#sectionOption>
Information about each of the section types available to a user. Note that the key (e.g. "freeform") is used to ID the UI selection element.
Type:
sectionsOptionsContainer :string
A jQuery selector for the element that the section option buttons should be inserted into
Type:
- string
tagName :string
The HTML tag name for this view's element
Type:
- string
template
References to templates for this view. HTML files are converted to Underscore.js templates
type :string
The type of View this is
Type:
- string
uniqueSectionLabel :string
The unique label for this Section. It most likely matches the label on the model, but
may include a number after if more than one section has the same name.
Type:
- string
Methods
addNewSection(e)
Gets the section type to add, and triggers an event so the rest of the app will add a new section
Parameters:
Name | Type | Description |
---|---|---|
e |
Event | The element that was clicked that represents the section option |
disableSectionOption(sectionType)
Adds styling and content to a section option element to indicate that the user already added the maximum allowable number of this section type (i.e. it's disabled).
Parameters:
Name | Type | Description |
---|---|---|
sectionType |
string | The section name. This is the same string used as the key in sectionsOptions (e.g. "freeform"). |
enableSectionOption(sectionType)
Adds styling and content to a section option element to indicate that the user is able to add more of this section type (i.e. it's not disabled).
Parameters:
Name | Type | Description |
---|---|---|
sectionType |
string | The section name. This is the same string used as the key in sectionsOptions (e.g. "freeform"). |
initialize(options)
Creates a new PortEditorSectionView
Parameters:
Name | Type | Description |
---|---|---|
options |
Object | A literal object with options to pass to the view |
Properties:
Name | Type | Description |
---|---|---|
options.model |
PortalSection | The PortalSection rendered in this view |
render()
Renders this view
toggleDisableSectionOption(sectionType)
Checks whether a section type is available to a user to add, then calls functions that change content and styling to indicate the availability to the user.
Parameters:
Name | Type | Description |
---|---|---|
sectionType |
string | The section name. This is the same string used as the key in sectionsOptions (e.g. "freeform"). |