From bde2e9f81d13568da1dae4d1a3282c6dcb1a6460 Mon Sep 17 00:00:00 2001 From: AnujaK Date: Sat, 13 Dec 2014 20:20:11 +0530 Subject: [PATCH] modifications for issue #54 --- .../resources/static/js/views/star-view.js | 13 +++------- .../static/js/views/tagged-node-view.js | 26 ++++++++++++++++++- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/src/main/resources/static/js/views/star-view.js b/src/main/resources/static/js/views/star-view.js index b642a2c..200a877 100644 --- a/src/main/resources/static/js/views/star-view.js +++ b/src/main/resources/static/js/views/star-view.js @@ -25,24 +25,19 @@ define(function (require) { $(this).removeClass('active'); }) this.$el.addClass("active"); - console.log('Starred Node Id : ' + this.$el.find('a').data('data-star-id')) + console.log('Starred Node Id : ' + this.$el.find('a').data('data-star-id')); var node = new NodeModel({ - id : this.$el.find('a').data('data-star-id') + id : this.model.id }); node.fetch({ success : function(response) { console.log(response.get("conversation")); - var conversation = new ConversationModel( - response.get("conversation")); + var conversation = new ConversationModel(response.get("conversation")); conversation.set("name", response.get("name")); conversation.set("description",response.get("description")); - // var conversationView = new - // app.ConversationView({model : conversation}); APP.conversation.render(conversation); - ConversationEvents.triggerChange(response - .get("conversation") ? response - .get("conversation").id : null); + ConversationEvents.triggerChange(response.get("conversation") ? response.get("conversation").id : null); } }); //ProjectEvents.triggerChange(this.$el.find('a').data('project-id')); diff --git a/src/main/resources/static/js/views/tagged-node-view.js b/src/main/resources/static/js/views/tagged-node-view.js index 3f7cb3b..8506f24 100644 --- a/src/main/resources/static/js/views/tagged-node-view.js +++ b/src/main/resources/static/js/views/tagged-node-view.js @@ -4,11 +4,35 @@ define(function(require) { var Backbone = require('backbone'); var _ = require('underscore'); + var ConversationEvents = require('events/conversation-event'); + + var NodeModel = require('models/node'); + var ConversationModel = require('models/conversation'); var TaggedNodeListItemView = Backbone.View.extend({ tagName : 'li', template: _.template($('#tpl-tagged-node-list-item').html()), - + events : { + "click a" : "showConversation" + }, + + showConversation : function(){ + var node = new NodeModel({ + id : this.model.id + }); + node.fetch({ + success : function(response) { + console.log(response.get("conversation")); + var conversation = new ConversationModel(response.get("conversation")); + conversation.set("name", response.get("name")); + conversation.set("description",response.get("description")); + APP.conversation.render(conversation); + ConversationEvents.triggerChange(response.get("conversation") ? response.get("conversation").id : null); + } + }); + + }, + render : function(eventName) { this.$el.html(this.template({node: this.model})); return this;