GitHub PullRequestReviewCommentEvent at 2014-03-31 18:37:10
Repository: game-server
Actor: gurdotan
Payload: {"comment":{"url":"https://api.github.com/repos/soomla/game-server/pulls/comments/11129933","id":11129933,"diff_hunk":"@@ -1,15 +1,87 @@\n-define([\"marionette\", \"gravatar\"], function(Marionette, Gravatar) {\n+define([\"marionette\", \"gravatar\", \"handlebars\",\"modelSession\", \"hbs!dashboard/templates/header/header\", \"hbs!dashboard/templates/header/header-logo\", \"hbs!dashboard/templates/header/header-subapp-selector\", \"hbs!dashboard/templates/header/header-game-selector\"], function(Marionette, Gravatar, Handlebars, ModelSession, headerTemplate, topLogoTemplate, subAppSelectorTemplate, gameSelectorTemplate) {\n \n+    var TopLogoView = Marionette.ItemView.extend({\n+        id:\"top-logo\",\n+        template: topLogoTemplate\n+    });\n \n+    var SubAppSelectorView = Marionette.ItemView.extend({\n+        id:\"subapp-selector\",\n+        template: subAppSelectorTemplate,\n+        model: new Backbone.Model({subapps:[{label:'Overview', id:'TODO'}, {label:'Analytics',id:'TODO'}, {label:'Releases',id:'#releases'}, {label:'Economy Builder',id:'TODO'}, {label:'Key Value Store', id:'TODO'}, {label:'Files',id:'TODO'}, {label:'Integration',id:'TODO'}]}),\n+        events: {\n+            \"click a\" : \"subAppClicked\"\n+        },\n+        subAppClicked : function(e) {\n+            e.preventDefault();\n+            var id = $(e.currentTarget).data('id');\n+            return this.trigger(\"subapp:change\", id);\n+        }\n+    });\n \n-  // This layout will contain regions in the application's\n-  // header that will be populated by views, e.g. nav button, user dropdown\n-  return Marionette.Layout.extend({\n-    initialize : function() {\n+    var GameSelectorView = Marionette.ItemView.extend({\n+        id:\"game-selector\",\n+        template: gameSelectorTemplate,\n+        initialize: function() {\n+            $('.dropdown-toggle').dropdown();\n+        },\n+        events: {\n+            \"click a\" : \"gameClicked\"\n+        },\n+        gameClicked : function(e) {\n+            e.preventDefault();\n+            var id = $(e.currentTarget).data('id');\n+            return this.trigger(\"game:change\", id);\n+        }\n+    });\n \n-      // TODO: Attain email from some sort of model \\ javascript object, instead of from the DOM\n-      var email = this.$(\"#user-email\").val();\n-      if (email) this.$(\"#gravatar-img\").attr(\"src\", Gravatar.userImageUrl(email));\n-    }\n-  });\n+    // This layout will contain regions in the application's\n+    // header that will be populated by views, e.g. nav button, user dropdown\n+    var headerLayout =  Marionette.Layout.extend({\n+        initialize : function() {\n+            _.bindAll(this, \"fillGameSelector\");\n+\n+            // TODO: Attain email from some sort of model \\ javascript object, instead of from the DOM\n+            var email = this.$(\"#user-email\").val();\n+            if (email) this.$(\"#gravatar-img\").attr(\"src\", Gravatar.userImageUrl(email));\n+\n+            this.topLogoView = new TopLogoView();\n+            this.subAppSelectorView = new SubAppSelectorView();\n+            //this.gameSelectorView = new GameSelectorView();\n+\n+            this.listenTo(this.subAppSelectorView, \"subapp:change\", function(id) {\n+                this.trigger(\"subapp:change\", id);\n+            });\n+\n+            this.listenTo(this, \"games:loaded\", function(games) {","path":"client/js/dashboard/common/header-layout.js","position":66,"original_position":66,"commit_id":"f992f189f81f8efc4b6c0e2c07c26f79000758d1","original_commit_id":"f992f189f81f8efc4b6c0e2c07c26f79000758d1","user":{"login":"gurdotan","id":405975,"avatar_url":"https://avatars.githubusercontent.com/u/405975?","gravatar_id":"8d66ad1ec77ddb0189b96e537c627394","url":"https://api.github.com/users/gurdotan","html_url":"https://github.com/gurdotan","followers_url":"https://api.github.com/users/gurdotan/followers","following_url":"https://api.github.com/users/gurdotan/following{/other_user}","gists_url":"https://api.github.com/users/gurdotan/gists{/gist_id}","starred_url":"https://api.github.com/users/gurdotan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gurdotan/subscriptions","organizations_url":"https://api.github.com/users/gurdotan/orgs","repos_url":"https://api.github.com/users/gurdotan/repos","events_url":"https://api.github.com/users/gurdotan/events{/privacy}","received_events_url":"https://api.github.com/users/gurdotan/received_events","type":"User","site_admin":false},"body":"This connects with what I wrote above about bubbling messages \"up\" \\ \"cross\", and calling functions down. ","created_at":"2014-03-31T18:37:10Z","updated_at":"2014-03-31T18:37:10Z","html_url":"https://github.com/soomla/game-server/pull/2#discussion_r11129933","pull_request_url":"https://api.github.com/repos/soomla/game-server/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/soomla/game-server/pulls/comments/11129933"},"html":{"href":"https://github.com/soomla/game-server/pull/2#discussion_r11129933"},"pull_request":{"href":"https://api.github.com/repos/soomla/game-server/pulls/2"}}}}