Skip to content

Instantly share code, notes, and snippets.

@validkeys
Created September 25, 2013 18:03
Show Gist options
  • Select an option

  • Save validkeys/6703527 to your computer and use it in GitHub Desktop.

Select an option

Save validkeys/6703527 to your computer and use it in GitHub Desktop.
# View:
@Aplat.module "CommandCenterApp.Show", (Show, CommandCenterApp, Backbone, Marionette, $, _) ->
class Show.CommandCenter extends App.Views.ItemView
template: "command_center/show/templates/_command_center"
tagName: "li"
class Show.CommandCenters extends App.Views.CollectionView
template: 'command_center/show/templates/command_center'
className: 'iconbar'
itemView: Show.CommandCenter
# this is for composite view //
itemViewContainer: "ul.link-items"
# Controller:
@Aplat.module "CommandCenterApp.Show", (Show, CommandCenterApp, Backbone, Marionette, $, _) ->
Show.Controller =
showCommandCenter: ->
links = App.request "commandCenter:entities"
commandCenterView = @getCommandCenter links
App.commandCenterRegion.show commandCenterView
getCommandCenter: (links) ->
new Show.CommandCenters
collection: links
# App Controller
@Aplat.module "CommandCenterApp", (CommandCenterApp, App, Backbone, Marionette, $, _) ->
@startWithParent = false
API =
showCommandCenter: ->
CommandCenterApp.Show.Controller.showCommandCenter()
CommandCenter.addInitializer ->
API.showCommandCenter();
# Entities
@Aplat.module "Entities", (Entities, App, Backbone, Marionette, $, _) ->
class Entities.CommandCenter extends Backbone.Model
class Entities.CommandCenterCollection extends Backbone.Collection
model: Entities.CommandCenter
API =
getCommandCenters: ->
new Entities.CommandCenterCollection [
{ url: Routes.edit_user_registration_path(), icon: "fui-user" }
{ url: Routes.tasks_path(), icon: "fui-calendar" }
{ url: "/messages", icon: "fui-chat" }
]
App.reqres.setHandler "commandCenter:entities", ->
API.getCommandCenters()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment