File tree Expand file tree Collapse file tree 2 files changed +29
-10
lines changed
src/main/resources/static/js/views Expand file tree Collapse file tree 2 files changed +29
-10
lines changed Original file line number Diff line number Diff line change @@ -25,24 +25,19 @@ define(function (require) {
2525 $ ( this ) . removeClass ( 'active' ) ;
2626 } )
2727 this . $el . addClass ( "active" ) ;
28- console . log ( 'Starred Node Id : ' + this . $el . find ( 'a' ) . data ( 'data-star-id' ) )
28+ console . log ( 'Starred Node Id : ' + this . $el . find ( 'a' ) . data ( 'data-star-id' ) ) ;
2929
3030 var node = new NodeModel ( {
31- id : this . $el . find ( 'a' ) . data ( 'data-star-id' )
31+ id : this . model . id
3232 } ) ;
3333 node . fetch ( {
3434 success : function ( response ) {
3535 console . log ( response . get ( "conversation" ) ) ;
36- var conversation = new ConversationModel (
37- response . get ( "conversation" ) ) ;
36+ var conversation = new ConversationModel ( response . get ( "conversation" ) ) ;
3837 conversation . set ( "name" , response . get ( "name" ) ) ;
3938 conversation . set ( "description" , response . get ( "description" ) ) ;
40- // var conversationView = new
41- // app.ConversationView({model : conversation});
4239 APP . conversation . render ( conversation ) ;
43- ConversationEvents . triggerChange ( response
44- . get ( "conversation" ) ? response
45- . get ( "conversation" ) . id : null ) ;
40+ ConversationEvents . triggerChange ( response . get ( "conversation" ) ? response . get ( "conversation" ) . id : null ) ;
4641 }
4742 } ) ;
4843 //ProjectEvents.triggerChange(this.$el.find('a').data('project-id'));
Original file line number Diff line number Diff line change @@ -4,11 +4,35 @@ define(function(require) {
44 var Backbone = require ( 'backbone' ) ;
55 var _ = require ( 'underscore' ) ;
66
7+ var ConversationEvents = require ( 'events/conversation-event' ) ;
8+
9+ var NodeModel = require ( 'models/node' ) ;
10+ var ConversationModel = require ( 'models/conversation' ) ;
711
812 var TaggedNodeListItemView = Backbone . View . extend ( {
913 tagName : 'li' ,
1014 template : _ . template ( $ ( '#tpl-tagged-node-list-item' ) . html ( ) ) ,
11-
15+ events : {
16+ "click a" : "showConversation"
17+ } ,
18+
19+ showConversation : function ( ) {
20+ var node = new NodeModel ( {
21+ id : this . model . id
22+ } ) ;
23+ node . fetch ( {
24+ success : function ( response ) {
25+ console . log ( response . get ( "conversation" ) ) ;
26+ var conversation = new ConversationModel ( response . get ( "conversation" ) ) ;
27+ conversation . set ( "name" , response . get ( "name" ) ) ;
28+ conversation . set ( "description" , response . get ( "description" ) ) ;
29+ APP . conversation . render ( conversation ) ;
30+ ConversationEvents . triggerChange ( response . get ( "conversation" ) ? response . get ( "conversation" ) . id : null ) ;
31+ }
32+ } ) ;
33+
34+ } ,
35+
1236 render : function ( eventName ) {
1337 this . $el . html ( this . template ( { node : this . model } ) ) ;
1438 return this ;
You can’t perform that action at this time.
0 commit comments