Skip to content

Instantly share code, notes, and snippets.

@gjbagrowski
Created June 11, 2014 22:27
Show Gist options
  • Save gjbagrowski/417f005c6c619cffc45b to your computer and use it in GitHub Desktop.
Save gjbagrowski/417f005c6c619cffc45b to your computer and use it in GitHub Desktop.
ActionBar = React.createClass
mixins: [
React.BackboneMixin("actions")
]
render: ->
<ul className="nav navbar-nav">
<li className="dropdown">
<a className="dropdown-toggle" data-toggle="dropdown" href='#'>
<span>Action</span>
<b className="caret" />
</a>
<ul className="dropdown-menu" role="menu">
{@props.actions.map (action) =>
<li key={action.id}>
<a href='#' onClick={@handleActionClick.bind(this, action.id)}>
{action.get('name')}
</a>
</li>
}
</ul>
</li>
</ul>
handleActionClick: (actionId) ->
# launch command handler registered for selected action
Backbone.Radio.Commands.command(actionId)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment