averez-83-incident-urls: Have one URL per incident URL (also fixes refresh in an incident page), Closes #83

This commit is contained in:
Anthony Verez 2014-04-25 15:43:48 -07:00
Родитель 0f692c0606
Коммит 0d715216a5
3 изменённых файлов: 15 добавлений и 15 удалений

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

@ -31,7 +31,6 @@ Jeff Bryner jbryner@mozilla.com
</style>
{{>veristags}}
{{#with incident}}
<form id="editincidentform" class="form-horizontal editincidentform" style="margin: 0px 30% 20px;">
<legend>Edit Incident</legend>
<fieldset>
@ -120,7 +119,5 @@ Jeff Bryner jbryner@mozilla.com
</fieldset>
</form>
{{/with}}
</template>

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

@ -96,8 +96,7 @@ if (Meteor.isClient) {
"click": function(e,t){
if (this._id != undefined){
Session.set('displayMessage','Starting edit for incident._id: ' + this._id);
Session.set('incidentID',this._id);
Router.go('/incidents/edit')
Router.go('/incident/' + this._id + '/edit');
}
}
});
@ -133,18 +132,18 @@ if (Meteor.isClient) {
"drop .tags": function(e){
e.preventDefault();
//console.log(e)
tagtext=e.originalEvent.dataTransfer.getData("text/plain")
tagtext = e.originalEvent.dataTransfer.getData("text/plain");
//e.target.textContent=droptag
//console.log(tagtext)
incidents.update(Session.get('incidentID'),{
$addToSet:{tags:tagtext}
incidents.update(Session.get('incidentID'), {
$addToSet: {tags:tagtext}
});
},
"click .tagdelete": function(e){
tagtext=e.target.parentNode.firstChild.wholeText;
incidents.update(Session.get('incidentID'),{
$pull:{tags:tagtext}
tagtext = e.target.parentNode.firstChild.wholeText;
incidents.update(Session.get('incidentID'), {
$pull: {tags:tagtext}
});
},
@ -153,7 +152,7 @@ if (Meteor.isClient) {
// tags are saved in realtime
incidents.update(Session.get('incidentID'),{$set:{
incidents.update(Session.get('incidentID'), {$set: {
summary: template.find("#incidentSummary").value,
dateOpened: template.find("#dateOpened").value,
dateClosed: template.find("#dateClosed").value,
@ -177,7 +176,7 @@ if (Meteor.isClient) {
Template.editincidentform.rendered = function() {
if (typeof console !== 'undefined') {
console.log('load edit incident form')
console.log('load edit incident form ' + Session.get('incidentID'));
}
$('#dateClosed').daterangepicker({
singleDatePicker: true,

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

@ -33,7 +33,6 @@ Router.map(function () {
layoutTemplate: 'layout'
});
this.route('incidentnew', {
path: '/incidents/new',
template: 'addincidentform',
@ -41,11 +40,16 @@ Router.map(function () {
});
this.route('incidentedit', {
path: '/incidents/edit',
path: '/incident/:_id/edit',
data: function() {
Session.set('incidentID', this.params._id);
return incidents.findOne(this.params._id);
},
template: 'editincidentform',
layoutTemplate: 'layout'
});
this.route('attackers', {
path: '/incidents/attackers',
template: 'attackers',