Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Merged headerview docs #74

Merged
merged 1 commit into from
Aug 18, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 0 additions & 64 deletions src/components/header/docs/kdheaderview.md

This file was deleted.

38 changes: 38 additions & 0 deletions src/components/header/headerview.coffee
Original file line number Diff line number Diff line change
@@ -1,6 +1,33 @@
KDView = require './../../core/view.coffee'

###*
* # KDHeaderView
*
* KDHeaderView is a basic KDView to implement the
* `<h1>`/`<h2>`/`<h3>`/etc DOM elements.
*
* ## Usage
*
* ```coffee
* header = new KDHeaderView
* title: 'Header title!'
* type: 'big'
*
* appView.addSubView header
* ```
###
module.exports = class KDHeaderView extends KDView

###*
* Options supports the following keys:
* - **options.title**: The contents for your header view.
* - **options.type**: The level of your `H` element, represented in three
* options: `"big"`, `"medium"`, `"small"` which translates to `"h1"`,
* `"h2"`, ` "h3"` respectively.
*
* @param {Object} options
* @param {Object} data
###
constructor:(options,data)->
options = options ? {}
options.type = options.type ? "default"
Expand All @@ -11,9 +38,20 @@ module.exports = class KDHeaderView extends KDView
then @updateTitle options.title
else @setTitle options.title

###*
* Set the title of this heaer element.
*
* @param {String} title The title you want to set your header to
###
setTitle:(title)->
@getDomElement().append "<span>#{title}</span>"

###*
* Update the title for this header option. This can be used after you have
* already set the title, to change it to another title.
*
* @param {String} title The title you want to update your header to
###
updateTitle: (title) ->
@$().find('span').html title

Expand Down