aboutsummaryrefslogtreecommitdiffstats
path: root/www/js/views/existing.js
blob: b4af57442d14141c02d212ed3b2758e1ca28d6cc (plain)
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
(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() {
                FMS.currentDraft.destroy();
                FMS.currentDraft = new FMS.Draft();
                this.navigate('around');
            }
        })
    });
})(FMS, Backbone, _, $);