1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
(function (FMS, Backbone, _, $) {
_.extend( FMS, {
ExistingView: FMS.FMSView.extend({
template: 'existing',
id: 'existing',
events: {
'pagehide': 'destroy',
'pageshow': 'afterDisplay',
'click #use_report': 'useReport',
'click #discard': 'discardReport'
},
useReport: function() {
localStorage.currentDraftID = FMS.currentDraft.id;
this.navigate('around');
},
discardReport: function() {
var uri = FMS.currentDraft.get('file');
FMS.allDrafts.remove(FMS.currentDraft);
FMS.currentDraft.destroy();
localStorage.currentDraftID = null;
FMS.currentDraft = new FMS.Draft();
if ( uri ) {
var del = FMS.files.deleteURI( uri );
var that = this;
del.done( function() { that.navigate( 'around' ); } );
} else {
this.navigate( 'around', 'left' );
}
}
})
});
})(FMS, Backbone, _, $);
|