Home Manual Reference Source Repository
public class | source

LogInView

Extends:

EventsView → LogInView

Provides a Backbone.View allowing a user to login or sign up.

Constructor Summary

Public Constructor
public

Sets the element this view is associated with to .content.

Member Summary

Public Members
public get

Delegated events for logging in and signing up.

Method Summary

Public Methods
public

Binds this to the methods specified and renders the view.

public

Attempts to login a user by invoking triggerThen sending a app:user:login event which is handled in App.js which subsequently returns a Promise.

public

render()

Renders the login view.

public

Attempts to sign up a user by invoking triggerThen sending a app:user:signup event which is handled in App.js which subsequently returns a Promise.

Inherited Summary

From class Events
public

bind(): *

Delegates to on.

public

listenTo(obj: object, name: string, callback: function): Events

Tell an object to listen to a particular event on an other object.

public

listenToOnce(obj: object, name: string, callback: function): Events

Just like listenTo, but causes the bound callback to fire only once before being removed.

public

off(name: string, callback: function, context: object): Events

Remove a previously-bound callback function from an object.

public

on(name: string, callback: function, context: object): *

Bind a callback function to an object.

public

once(name: string, callback: function, context: object): *

Just like on, but causes the bound callback to fire only once before being removed.

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 off.

From class View
public get

The default tagName of a View's element is "div".

public

Cached jQuery context for element.

public

Client ID

public

Cached element

public

$(selector: string): Element | $

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

delegate(eventName: string, selector: string, listener: function): View

Add a single event listener to the view's element (or a child element using selector). This only works for delegate-able events: not focus, blur, and not change, submit, and reset in Internet Explorer.

public

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 undelegateEvents for removing a single delegated event.

public

Removes all of the view's delegated events. Useful if you want to disable or remove a view from the DOM temporarily.

protected

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

Creates the this.el and this.$el references for this view using the given el.

Public Constructors

public constructor source

Sets the element this view is associated with to .content.

Override:

View#constructor

Public Members

public get events: object: * source

Delegated events for logging in and signing up.

Return:

object

Public Methods

public initialize() source

Binds this to the methods specified and renders the view.

Override:

View#initialize

public logIn(e: object) source

Attempts to login a user by invoking triggerThen sending a app:user:login event which is handled in App.js which subsequently returns a Promise.

Params:

NameTypeAttributeDescription
e object

event data

public render() source

Renders the login view.

Override:

View#render

public signUp(e: object) source

Attempts to sign up a user by invoking triggerThen sending a app:user:signup event which is handled in App.js which subsequently returns a Promise.

Params:

NameTypeAttributeDescription
e object

event data