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:
jeffbryner 2014-04-24 10:34:13 -07:00
Родитель 283576f935 a99d5ba135
Коммит eb3e6202f4
2 изменённых файлов: 16 добавлений и 9 удалений

Просмотреть файл

@ -69,7 +69,8 @@ if (Meteor.isClient) {
Template.veristags.events({
'dragstart .tag': function(e){
//console.log('dragging ' + this.tag)
//console.log(this.tag)
//console.log(e)
e.originalEvent.dataTransfer.setData("text/plain",this.tag);
},
'load': function(e, template){
@ -131,7 +132,7 @@ if (Meteor.isClient) {
},
"drop .tags": function(e){
e.preventDefault();
//console.log('drop event' + e)
//console.log(e)
tagtext=e.originalEvent.dataTransfer.getData("text/plain")
//e.target.textContent=droptag
//console.log(tagtext)
@ -141,21 +142,27 @@ if (Meteor.isClient) {
},
"click .tagdelete": function(e){
//console.log( e);
//console.log(e.target.parentNode.firstChild.data);
tagtext=e.target.parentNode.firstChild.data
tagtext=e.target.parentNode.firstChild.wholeText;
incidents.update(Session.get('incidentID'),{
$pull:{tags:tagtext}
})
});
},
"submit form":function (event,template){
"submit form": function (event,template){
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'),{
summary: template.find("#incidentSummary").value,
dateOpened: template.find("#dateOpened").value,
dateClosed: template.find("#dateClosed").value,
phase: template.find("#phase").value,
tags: tags,
dateReported: template.find("#dateReported").value,
dateVerified: template.find("#dateVerified").value,
dateMitigated: template.find("#dateMitigated").value,

Просмотреть файл

@ -22,7 +22,7 @@ models={
dateClosed:"",
theories:[],
notes:[],
tags:['tag here'],
tags:[],
phase:"Identification",
discovery:"",
verification:"",