Skip to content

Instantly share code, notes, and snippets.

@trabianmatt
Last active December 11, 2015 03:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trabianmatt/4539640 to your computer and use it in GitHub Desktop.
Save trabianmatt/4539640 to your computer and use it in GitHub Desktop.
A preview of what's in store for titanium-backbone. (Ignore the numbers and underscores in the file names - they are intended only to provide order to the gists).
SampleWindow = require './window'
person = new Backbone.Model
name: 'John Doe'
sampleWindow = new SampleWindow
model: person
sampleWindow.render().open()
# Update the person's name after 3 seconds. This update will be reflected in the view
setTimeout ->
person.set
name: 'Jane Doe'
, 3000
styles = require './styles'
template = require './template'
class SampleWindow extends Backbone.View
tagName: 'Window'
styles: styles
bindings:
'.name': 'name'
events:
'click .cancel': 'cancel'
'click .save': 'save'
cancel: ->
@el.close()
save: ->
@model.save().done =>
@el.close()
render: ->
@$el.html template
headingText: 'This is a sample'
@
open: -> @el.open()
Label.heading= headingText
Label.name
.buttons.horizontal
Button.save Save
Button.cancel Cancel
Window
backgroundColor #ccc
.horizontal
layout: horizontal
.buttons
top: 11
Label
color #333
.heading
font 14px bold
.name
font 12px
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment