1//get a single user who owns this task component 2function getUserForOwnedTaskComponent(title, description, type, component) { 3 APICall( masterPath + 'API/0.9/users', { 'taskComponenentUser': component }, function( xhrCall ) { 4 if( xhrCall.status == 200 ) { 5 var results = JSON.parse(xhrCall.responseText); 6 assigned = results; 7 // if(assigned == null || assigned == undefined) { createNuminiTask(title, description, type, component, 4659); } 8 // else { createNuminiTask(title, description, type, component, assigned.ID); } 9 //The above code fixes a bug, but the bug only appears in dev 10 createNuminiTask(title, description, type, component, assigned.ID); 11 } 12 }); 13} 14 15//create a new task based on quick tasks specs 16function createNuminiTask(title, description, type, component, assignedID) { 17 APICall( masterPath + 'API/0.9/tasks/', { 'create': true, 'title': title, 'description': description, 'type': type, 'component': component, 'assignedID': assignedID }, function( xhrCall ) 18 { 19 if( xhrCall.status == 200 ) 20 { 21 var task = JSON.parse( xhrCall.responseText ); 22 if(type == 'Bug' || type == 'Feature') { 23 var fd; 24 html2canvas(document.body, {scrollY: -window.scrollY}).then(function(canvas) { 25 var screenshot = canvas.toBlob(function(blob) { 26 fd = new FormData(); 27 fd.append('file', blob, 'bugshot.png'); 28 jQ.ajax( { type: 'POST', url: masterPath + 'API/0.9/files?uploadFile&private=1', data: fd, processData: false, contentType: false } ).done( function( response ) 29 { 30 var bugshot = response[0]; 31 APICall( masterPath + 'API/0.9/tasks/' + task.ID, { "associateFile": bugshot.ID }); 32 }); 33 }); 34 }); 35 } 36 } 37 }); 38} 39 40//close miniTask callback (empties everything and cleans up) 41function miniTaskClosePopupCallback() { 42 jQ("#miniTaskDescriptionTextarea").val(''); 43 jQ("#miniTaskTitleInput").val(''); 44 jQ(".iconDiv").each(function() { jQ(this).children().css("color", "black"); }); 45 jQ("#awesomeCheck").css("color", "rgb(89, 190, 224)"); 46} 47 48function setupMiniTasks() { 49 if(!jQ('#miniTaskDiv').length) { 50 jQ("#dashboardFooter").prepend(jQ('<div>', { 'id': 'miniTaskDiv'}).append(jQ('<div>', { 'id': 'miniTask' }).text("Quick Task")) ); 51 52 var miniTaskPopup = jQ("#miniTaskPopup"); 53 var icon = jQ(".iconDiv"); 54 var miniTaskSaveButton = jQ("#miniTaskSaveButton"); 55 var miniTaskDescriptionTextarea = jQ("#miniTaskDescriptionTextarea"); 56 var miniTaskTitleInput = jQ("#miniTaskTitleInput"); 57 var miniTaskDiv = jQ("#miniTaskDiv"); 58 59 var miniTaskType = ""; 60 61 miniTaskDiv.click( function () { 62 miniTaskType = ""; 63 openPopup(miniTaskPopup); 64 miniTaskPopup.data('closePopupCallback', miniTaskClosePopupCallback); 65 }); 66 67 icon.click( function() { 68 jQ(".iconDiv").each(function() { jQ(this).children().css("color", "black"); }); 69 jQ(this).children().css("color", "rgb(89, 190, 224)"); 70 if( jQ(this).children().attr('id') == 'awesomeBug' ) { miniTaskType = "awesomeBug"; } 71 else if( jQ(this).children().attr('id') == 'awesomeLight' ) { miniTaskType = "awesomeLight"; } 72 else if( jQ(this).children().attr('id') == 'awesomeCheck' ) { miniTaskType = ""; } 73 }); 74 75 miniTaskSaveButton.click( function() { 76 var title = miniTaskTitleInput.val(); 77 var description = miniTaskDescriptionTextarea.val(); 78 //if both title and description are empty don't make a new task 79 if(title == null || title == undefined || title == '') { 80 if(description == null || description == undefined || description == '') { closePopup(miniTaskPopup); return; } 81 } 82 var type = miniTaskType; 83 var assignedID = me.ID; 84 var component = 'Quick Task'; 85 86 var tabOpen = jQ("#dashboardMenuTable .tabOpen"); 87 var navLink = tabOpen.find('.navOption .navLink'); 88 var pane = navLink.text(); 89 var nuComponent = 'Website/Dashboard/' + pane; 90 91 closePopup(miniTaskPopup); 92 93 if(type == "awesomeBug") { 94 type = 'Bug'; 95 component = nuComponent; 96 getUserForOwnedTaskComponent(title, description, type, component); 97 } 98 else if(type == "awesomeLight") { 99 type = 'Feature'; 100 component = nuComponent; 101 getUserForOwnedTaskComponent(title, description, type, component); 102 } 103 else { 104 createNuminiTask(title, description, type, component, assignedID); 105 } 106 }); 107 } 108} 109 110
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.