API Docs for: 0.2.0
Show:

Card Class

Constructor

Card

(
  • el
  • options
)

Parameters:

  • el HTMLElement
  • options Object

    Configuration for the card

    • [id] String optional

      Unique identifier for this card

    • [cardType] String optional

      Type of predefined card configuration

    • [title] String optional

      Title for this card

    • [icon] String optional

      Icon class used for this card

    • [lazyLoad] Boolean optional

      Whether to load the details section on load or wait until its needed

    • [usePopoutLayout] Boolean optional

      Whether or not to place card content inside card layout when the card when the card is a popout

    • [hasPopout] Boolean optional

      Whether or not the card can be popped out into a new window

    • [expandable] Boolean optional

      Whether or not the card can be expanded

    • [showFooter] Boolean optional

      Show the footer for this card

    • [summaryContentHtml] String | Function optional

      Can be a HTMLElement or String of HTML or a function with a callback that takes the generated HTML for the summary section of the card

    • [summaryContentUrl] String optional

      Url to request HTML content for summary section of card

    • [detailsContentHtml] String | Function optional

      Can be a HTMLElement or String of HTML or a function with a callback that takes the generated HTML for the details section of the card

    • [detailsContentUrl] String optional

      Url to request HTML content for details section of card

    • [leftControlsHtml] String | Function optional

      Can be a HTMLElement or String of HTML or a function with a callback that takes the generated HTML for the left controls content for this card

    • [leftControlsContentUrl] String optional

      Url to request HTML content for the left controls content for this card

    • [rightControlsHtml] String | Function optional

      Can be a HTMLElement or String of HTML or a function with a callback that takes the generated HTML for the right controls content for this card

    • [rightControlsContentUrl] String optional

      Url to request HTML content for the right controls content for this card

    • [position] Object optional

      Settings for how to position this card in the deck

      • [size_x] Number optional
        Number of columns this card spans in deck
      • [size_y] Number optional
        Number of rows this card spans in deck
      • [expanded_x] Number optional
        Max number of columns this card spans when expanded
      • [expanded_y] Number optional
        Max number of rows this card spans when expanded
      • [col] Number optional
        Col the card should be positioned in
      • [row] Number optional
        Row the card should be positioned in
    • [onSummaryLoad] Function optional

      Function triggered when summary content is loaded; passes through the card

    • [onSummaryDisplayed] Function optional

      Function triggered when summary content is displayed

    • [onDetailsLoad] Function optional

      Function triggered when details content is loaded; passes through the card

    • [onDetailsDisplayed] Function optional

      Function triggered when details content is displayed

    • [onResize] Function optional

      Function triggered when this card is resized

    • [onExpand] Function optional

      Function triggered when this card is expanded

    • [onCollapse] Function optional

      Function triggered when this card is collapsed

    • [loadData] Function optional

      Function used to load data into card

Methods

bindCardHandlers

() Card

Binds handlers to card element

Returns:

Card:

changeSection

(
  • newSection
  • oldSection
)
Card

Changes the section of the card from one section to another section

Parameters:

  • newSection Object

    Section the card is being changed to

  • oldSection Object

    Current section

Returns:

Card:

collapseCard

(
  • cb
)

Collapse the card

Parameters:

  • cb Object

    Callback to call after function has been collapsed

destroy

()

Function used to destroy the card and remove it from the deck

expandCard

(
  • cb
)

Expand the card

Parameters:

  • cb Object

    Callback to call after function has been expanded

getCardData

() Object

Returns the current options associated with this card

Returns:

Object:

getCardHash

(
  • opts
)
Number

Returns a numerical hash for the value the card options passed in

Parameters:

  • opts Object

Returns:

Number:

getCardHtml

(
  • opts
)
HTMLElement | String

Generates the layout for a card with given options

Parameters:

  • opts Object

    locals used to generate layout for card

Returns:

HTMLElement | String:

of card layout html

getDefaults

() Object

Returns the card defaults

Returns:

Object:

Card defaults

loadCard

() Card

Loads the content of the different sections of the card. If lazyLoad is enabled only the summary content will be loaded when the card is initialized.

Returns:

Card:

loadContent

(
  • section
)
Card

Loads the content for the specified section

Parameters:

  • section String

    'summary'|'details'

Returns:

Card:

loadDetailsContent

() Card

Loads the details content for this card

Returns:

Card:

loadPopout

() Card

Loads the popout for a card. The card element won't have the layout injected yet so we need to do that first before loading the card.

Returns:

Card:

loadSummaryContent

() Card

Loads the summary content for this card

Returns:

Card:

reloadContent

() Card

Reloads the content of this card

Returns:

Card:

setCardContent

(
  • section
  • html
)
Card

Loads the given HTML content into the specified section for this card

Parameters:

  • section String

    'summary'|'details'

  • html HTMLElement | String

    content for this section

Returns:

Card:

toggleCard

(
  • cb
)

Toggles a card between expanded and collapsed

Parameters:

  • cb Object

toggleSection

(
  • section
)
Card

Loads and displays the specified section if its not current displayed

Parameters:

  • section String

    'summary'|'details'

Returns:

Card: