Created
August 20, 2012 11:57
Revisions
-
timgremore created this gist
Jan 3, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ - title "#{@game.name}" %h1= yield(:title) #documents = form_tag(assessment_game_documents_path(@game)) do %ul %script{ type: "text/x-handlebars" } {{#collection Game.DocumentsCollectionView contentBinding="Game.documentsController"}} %li {{content.name}} {{/collection}} This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ window.Game ||= Ember.Application.create ready: () -> setInterval(() -> Game.documentsController.refresh() , 10000) this._super() Game.Document = Ember.Object.extend name: null, description: null Game.documentsController = Ember.ArrayController.create content: [], createDocument: (name, description) -> document = Game.Document.create name: name, description: description this.pushObject(document) refresh: () -> $.getJSON("index.json", (data) -> for item in data Game.documentsController.createDocument item["document"]["name"], item["document"]["description"] ) Game.DocumentsCollectionView = Ember.CollectionView.extend itemView: Ember.View.extend mouseDown: (evt) -> alert "You clicked on " + this.get('content') Game.documentsController.refresh()