Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
AnujaK committed Feb 9, 2015
1 parent ffd19ee commit c9e97f1
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/main/resources/static/js/views/conversation-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ define(function(require) {
var response = conversation.get('rfResponse');

this.$el.find("#apiRequestName").html(conversation.get('name'));
this.$el.find("#apiRequestDescription").html(conversation.get('description'));
this.$el.find("#apiRequestDescription").html(conversation.get('description'));

this.$el.find("#apiUrl").val(request.apiUrlString);
this.$el.find(".apiRequestType").val(request.methodType);
Expand Down
32 changes: 23 additions & 9 deletions src/main/resources/static/js/views/star-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,29 @@ define(function (require) {
console.log("Event star a node was fired for node Id " + "");
if (APP.appView.getCurrentRequestNodeId() != null) {
console.log("conversation id is ..." + APP.appView.getCurrentRequestNodeId());
var starModel = new StarModel();
starModel.set('id', APP.appView.getCurrentRequestNodeId());
starModel.set('starred', true);
starModel.save(null, {
success: function () {
console.log("changes saves successfully");
},
error: function () {
alert('some error occured while saving the request');
var node = new NodeModel({
id : APP.appView.getCurrentRequestNodeId()
});
node.fetch({
success : function(response) {
var starred = !response.get("starred");
var starModel = new StarModel();
starModel.set('id', APP.appView.getCurrentRequestNodeId());
starModel.set('starred', !response.get("starred"));
starModel.save(null, {
success: function () {
console.log("changes saves successfully");
if(starred){
$('#starNodeBtn').html('<span class="glyphicon glyphicon-star"></span>&nbsp;Unstar');
}
else{
$('#starNodeBtn').html('<span class="glyphicon glyphicon-star"></span>&nbsp;Star');
}
},
error: function () {
alert('some error occured while saving the request');
}
});
}
});
}
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/static/js/views/tree-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,12 @@ define(function(require) {
node.fetch({
success : function(response) {
console.log(response.get("conversation"));
if(response.get("starred")){
$('#starNodeBtn').html('<span class="glyphicon glyphicon-star"></span>&nbsp;Unstar');
}
else{
$('#starNodeBtn').html('<span class="glyphicon glyphicon-star"></span>&nbsp;Star');
}
var conversation = new ConversationModel(response.get("conversation"));
conversation.set("id", conversation.get("id"));
conversation.set("name", response.get("name"));
Expand Down

0 comments on commit c9e97f1

Please sign in to comment.