On Github paulwittmann / colognejs-talk-2012-11
Cologne.js13. November 2012
Paul Wittmann paul@railslove.com
class IG.Models.Column extends Backbone.RelationalModel relations: [ type: Backbone.HasMany key: 'cards' relatedModel: 'IG.Models.Card' collectionType: 'IG.Collections.Cards' reverseRelation: key: 'column' includeInJSON: '_id' ]
card = IG.columns.first().get('cards').first()) # => erste Karte der Column card.get('column') # => IG.columns.first()
<!-- server-seitig --> <body> <div class='fork-me'></div> <div id='l-game-container'></div> </body>
class IG.AppLayout extends Backbone.Marionette.Layout template: 'layouts/application' el: '#l-game-container' regions: navigation: '#l-header-container--navigation-wrapper' content: '#l-content-container'
IG.appLayout.content.show new IG.Views.ColumnsCollection(collection: IG.columns)
class IG.Views.ColumnsCollection extends Backbone.Marionette. CollectionView itemViewContainer: '.columns-wrapper' itemView: IG.Views.ColumnsShow
class IG.Views.ColumnsShow extends Backbone.Marionette.CollectionView itemView: IG.Views.CardsShow
class IG.Views.CardsShow extends Backbone.Marionette.ItemView
data = "IG.stack.set(#{JSON.stringify(IG.stack)}); IG.columns.reset(#{JSON.stringify(IG.columns)}); IG.piles.reset(#{JSON.stringify(IG.piles)});" $('.octet-download') .attr 'href', "data:text/octet-stream;base64,#{$.base64.encode(data)}"grässliche Dateinamen in Firefox =(
+keyframes(nodeInserted) from clip: rect(1px, auto, auto, auto) to clip: rect(0px, auto, auto, auto) .m-column .m-card // abusing CSS3 animations to catch event of newly inserted DOM elements +animation-duration(0.001s) +animation-name(nodeInserted)
// http://davidwalsh.name/detect-node-insertion insertListener = (event) -> if event.animationName == 'nodeInserted' $(event.target).removeClass 'off-the-board' document.addEventListener('animationstart', insertListener, false)