зеркало из https://github.com/mozilla/MozDef.git
Merge pull request #82 from netantho/averez-6-incident-dragdrop
averez-6-incident-dragdrop: fix drag and drop on the incident page
This commit is contained in:
Коммит
eb3e6202f4
|
@ -69,7 +69,8 @@ if (Meteor.isClient) {
|
||||||
|
|
||||||
Template.veristags.events({
|
Template.veristags.events({
|
||||||
'dragstart .tag': function(e){
|
'dragstart .tag': function(e){
|
||||||
//console.log('dragging ' + this.tag)
|
//console.log(this.tag)
|
||||||
|
//console.log(e)
|
||||||
e.originalEvent.dataTransfer.setData("text/plain",this.tag);
|
e.originalEvent.dataTransfer.setData("text/plain",this.tag);
|
||||||
},
|
},
|
||||||
'load': function(e, template){
|
'load': function(e, template){
|
||||||
|
@ -131,7 +132,7 @@ if (Meteor.isClient) {
|
||||||
},
|
},
|
||||||
"drop .tags": function(e){
|
"drop .tags": function(e){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
//console.log('drop event' + e)
|
//console.log(e)
|
||||||
tagtext=e.originalEvent.dataTransfer.getData("text/plain")
|
tagtext=e.originalEvent.dataTransfer.getData("text/plain")
|
||||||
//e.target.textContent=droptag
|
//e.target.textContent=droptag
|
||||||
//console.log(tagtext)
|
//console.log(tagtext)
|
||||||
|
@ -141,21 +142,27 @@ if (Meteor.isClient) {
|
||||||
},
|
},
|
||||||
|
|
||||||
"click .tagdelete": function(e){
|
"click .tagdelete": function(e){
|
||||||
//console.log( e);
|
tagtext=e.target.parentNode.firstChild.wholeText;
|
||||||
//console.log(e.target.parentNode.firstChild.data);
|
|
||||||
tagtext=e.target.parentNode.firstChild.data
|
|
||||||
incidents.update(Session.get('incidentID'),{
|
incidents.update(Session.get('incidentID'),{
|
||||||
$pull:{tags:tagtext}
|
$pull:{tags:tagtext}
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
"submit form":function (event,template){
|
"submit form": function (event,template){
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
|
var tags = [];
|
||||||
|
$.each($(".incidenttag"), function(index, value) {
|
||||||
|
var matches = value.innerHTML.match(/(\w+)(\.\w+)+/);
|
||||||
|
tags.push(matches[0]);
|
||||||
|
});
|
||||||
|
|
||||||
incidents.update(Session.get('incidentID'),{
|
incidents.update(Session.get('incidentID'),{
|
||||||
summary: template.find("#incidentSummary").value,
|
summary: template.find("#incidentSummary").value,
|
||||||
dateOpened: template.find("#dateOpened").value,
|
dateOpened: template.find("#dateOpened").value,
|
||||||
dateClosed: template.find("#dateClosed").value,
|
dateClosed: template.find("#dateClosed").value,
|
||||||
phase: template.find("#phase").value,
|
phase: template.find("#phase").value,
|
||||||
|
tags: tags,
|
||||||
dateReported: template.find("#dateReported").value,
|
dateReported: template.find("#dateReported").value,
|
||||||
dateVerified: template.find("#dateVerified").value,
|
dateVerified: template.find("#dateVerified").value,
|
||||||
dateMitigated: template.find("#dateMitigated").value,
|
dateMitigated: template.find("#dateMitigated").value,
|
||||||
|
@ -674,4 +681,4 @@ if (Meteor.isClient) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ models={
|
||||||
dateClosed:"",
|
dateClosed:"",
|
||||||
theories:[],
|
theories:[],
|
||||||
notes:[],
|
notes:[],
|
||||||
tags:['tag here'],
|
tags:[],
|
||||||
phase:"Identification",
|
phase:"Identification",
|
||||||
discovery:"",
|
discovery:"",
|
||||||
verification:"",
|
verification:"",
|
||||||
|
|
Загрузка…
Ссылка в новой задаче