Skip to content

Instantly share code, notes, and snippets.

@howarddierking
Created June 7, 2012 15:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save howarddierking/2889580 to your computer and use it in GitHub Desktop.
Save howarddierking/2889580 to your computer and use it in GitHub Desktop.
RestBugs Bug JavaScript Object
function Bug(title, description) {
var self = this;
this.title = title;
this.description = description;
this.assignedTo = '';
this.status = '';
this.history = [];
function addToHistory(comments, stateChanges){
self.history.push({
addedOn: new Date(),
comments: comments,
changes: stateChanges
});
};
function updateStatus(status, comments){
self.status = status;
addToHistory(comments, {status : self.status});
};
this.activate = function(comments){
updateStatus('Working', comments);
};
this.resolve = function(comments){
updateStatus('QA', comments);
};
this.close = function(comments){
updateStatus('Done', comments);
};
this.toBacklog = function(comments){
updateStatus('Backlog', comments);
};
this.toBacklog("created");
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment