Expand all

IconButton

Extends

Constructor

new IconButton(options) #

A wrapper for creating an icon button.

Parameters:

Name Type Description
options Object

Configuration options

Source:
A wrapper for creating an icon button.

Properties

defaults #

Properties:

Name Type Description
defaults Object

Default options hash.

Properties:
Name Type Attributes Description
tagName string

The name of the tag in which the button is wrapped. Defaults to 'a' when href option present.

href string optional

value of href attribute, when set tagName will default to anchor tag

additionalClassNames string

Additional classes to be added to the button

title string

Tooltip text.

size string

Button size. Defaults to 'large'.

weight boolean

Button weight. Defaults to 'quiet'.

action boolean

Button action.

isIconOnly boolean

Whether button is an icon only button Defaults to true.

disabled boolean

should only be used with tagName button

base string

String used as a base for generating class names. Defaults to 'mf-icon'.

glyphPrefix string

Prefix for the icon class

icon string

Name of the icon.

rotation boolean

will rotate the icon by a certain number of degrees. Must be ±90, 0 or ±180 or will throw exception.

isSmall boolean

Whether the icon should be small.

Overrides:
Mixes in:
Source:

isTemplateMode #

Tells the View to ignore tagName and className when constructing the element and to rely solely on the template

Properties:

Name Type Description
isTemplateMode boolean
Overrides:
Source:

Tells the View to ignore tagName and className when constructing the element and to rely solely on the template

tagName #

Name of tag that contains the rendered template

Properties:

Name Type Description
tagName string
Inherited from:
Source:
Name of tag that contains the rendered template

template #

Properties:

Name Type Description
Specifies any

the template used in render(). Object|string

Inherited from:
Source:

templatePartials #

Specifies partials (sub-templates) for the main template. Example:

Example

// example content for the "some" template (sub-template will be
    // inserted where {{>content}} is):
    // <h1>Heading</h1>
    // {{>content}}

    oo.mfExtend( SomeView, View, {
      template: util.template( '<source-code>' ),
      templatePartials: { content: util.template( '<source-code>' ) }
    }

Properties:

Type Description
Object
Inherited from:
Source:
Specifies partials (sub-templates) for the main template.

Methods

delegate(eventName, selector, listener) #

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 or blur.

Parameters:

Name Type Description
eventName string
selector string
listener function
Inherited from:
Source:

Add a single event listener to the view's element (or a child element using selector).

delegateEvents(events) #

Set callbacks for events.

this.options.events is a hash of pairs:

{ 'event selector': 'callback' }

{
  'mousedown .title': 'edit',
  'click .button': 'save',
  'click .open': function(e) { ... }
}

Callbacks will be bound to the view, with this set properly. Uses event delegation for efficiency. Omitting the selector binds the event to this.el.

Parameters:

Name Type Description
events Object

Optionally set this events instead of the ones on this.

Inherited from:
Source:
Set callbacks for events.

getClassName() → {string} #

Return the full class name that is required for the icon to render

Source:

Returns:

Type
string
Return the full class name that is required for the icon to render

initialize(options) #

Run once during construction to set up the View

Parameters:

Name Type Description
options Object

Object passed to the constructor.

Properties:
Name Type Attributes Description
events Object.<string, string> optional
Inherited from:
Source:
Run once during construction to set up the View

parseHTML(html) → {jQuery.Object} #

See parseHTML method of util singleton

Parameters:

Name Type Description
html string

to turn into a jQuery object.

Inherited from:
Source:

Returns:

Type
jQuery.Object
See parseHTML method of util singleton

postRender() #

Function called after the view is rendered. Can be redefined in objects that extend View.

Inherited from:
Source:
Function called after the view is rendered.

preRender() #

Function called before the view is rendered. Can be redefined in objects that extend View.

Overrides:
Source:
Function called before the view is rendered.

render(data)chainable #

Fill this.$el with template rendered using data if template is set.

Parameters:

Name Type Description
data Object

Template data. Will be merged into the view's options

Inherited from:
Source:
Fill this.$el with template rendered using data if template is set.

undelegate(eventName, selector, listener) #

A finer-grained undelegateEvents for removing a single delegated event. selector and listener are both optional.

Parameters:

Name Type Description
eventName string
selector string
listener function
Inherited from:
Source:
A finer-grained undelegateEvents for removing a single delegated event.

undelegateEvents() #

Clears all callbacks previously bound to the view by delegateEvents. You usually don't need to use this, but may wish to if you have multiple views attached to the same DOM element.

Inherited from:
Source:
Clears all callbacks previously bound to the view by delegateEvents.