import ItemView from 'typhonjs-backbone-parse-todos/site/js/views/ItemView.js'
ItemView
The Backbone.View
for an item which encapsulates the ability to edit the content of the item. With a desktop
browser an Item
can be edited with a double click or double tap when running on a mobile device. Zepto is the
jQuery equivalent library being used and the touch API is added so additional touch events, doubleTap
are
available.
Member Summary
Public Members | ||
public get |
Delegated events for interacting with an |
|
public |
|
|
public get |
Defines the tag that is created for an |
|
public get |
template: *: * Cache the template function for a single item. |
Method Summary
Public Methods | ||
public |
clear() Remove the item, destroy the model. |
|
public |
Close the |
|
public |
edit() Switch this view into |
|
public |
The ItemView listens for changes to its model, re-rendering. |
|
public |
Re-render the contents of the Item. |
|
public |
Toggle the |
|
public |
updateOnEnter(e: object) If you hit |
Inherited Summary
From class Events | ||
public |
bind(): * Delegates to |
|
public |
Tell an object to listen to a particular event on an other object. |
|
public |
listenToOnce(obj: object, name: string, callback: function): Events Just like |
|
public |
Remove a previously-bound callback function from an object. |
|
public |
Bind a callback function to an object. |
|
public |
Just like |
|
public |
stopListening(obj: object, name: string, callback: function): Events Tell an object to stop listening to events. |
|
public |
Trigger callbacks for the given event, or space-delimited list of events. |
|
public |
unbind(): * Delegates to |
From class View | ||
public get |
The default |
|
public |
Cached jQuery context for element. |
|
public |
Client ID |
|
public |
Cached element |
|
public |
If jQuery is included on the page, each view has a $ function that runs queries scoped within the view's element. If you use this scoped jQuery function, you don't have to use model ids as part of your query to pull out specific elements in a list, and can rely much more on HTML class attributes. |
|
public |
Add a single event listener to the view's element (or a child element using |
|
public |
delegateEvents(events: object): View Uses jQuery's on function to provide declarative callbacks for DOM events within a view. If an events hash is not passed directly, uses this.events as the source. Events are written in the format {"event selector": "callback"}. The callback may be either the name of a method on the view, or a direct function body. Omitting the selector causes the event to be bound to the view's root element (this.el). |
|
public abstract |
Initialize is an empty function by default. |
|
public |
Removes a view and its el from the DOM, and calls stopListening to remove any bound events that the view has listenTo'd. |
|
public abstract |
The default implementation of render is a no-op. |
|
public |
setElement(element: string | object): View If you'd like to apply a Backbone view to a different DOM element, use setElement, which will also create the cached $el reference and move the view's delegated events from the old element to the new one. |
|
public |
undelegate(eventName: string, selector: string, listener: function): View A finer-grained |
|
public |
Removes all of the view's delegated events. Useful if you want to disable or remove a view from the DOM temporarily. |
|
protected |
_createElement(tagName: string): Element Produces a DOM element to be assigned to your view. |
|
protected |
Ensure that the View has a DOM element to render into. |
|
protected |
Remove this view's element from the document and all event listeners attached to it. Exposed for subclasses using an alternative DOM manipulation API. |
|
protected |
_setAttributes(attributes: object) Set attributes from a hash on this view's element. Exposed for subclasses using an alternative DOM manipulation API. |
|
protected |
_setElement(el: string | object) Creates the |
Public Members
public get tagName: string: string source
Defines the tag that is created for an Item
.
Override:
View#tagNamePublic Methods
public initialize() source
The ItemView listens for changes to its model, re-rendering. Since there's a one-to-one correspondence between an
Item and an ItemView. If the model is deleted then the Backbone.View->remove
method is invoked.