Mercurial > lada > lada-client
annotate app/model/Messung.js @ 316:7de16725d251
Added docstring
author | Torsten Irländer <torsten.irlaender@intevation.de> |
---|---|
date | Tue, 13 Aug 2013 08:05:32 +0200 |
parents | 65f8be677c8a |
children | 63eae13768f3 |
rev | line source |
---|---|
314
65f8be677c8a
Added docstring
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
299
diff
changeset
|
1 /** |
65f8be677c8a
Added docstring
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
299
diff
changeset
|
2 * Model class for Messungen |
65f8be677c8a
Added docstring
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
299
diff
changeset
|
3 */ |
103
3552b0ee4526
Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff
changeset
|
4 Ext.define('Lada.model.Messung', { |
3552b0ee4526
Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff
changeset
|
5 extend: 'Ext.data.Model', |
299
fe199b8828a8
Use ts2date function from lib.Helpers. Remove old code
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
212
diff
changeset
|
6 requires: ['Lada.lib.Helpers'], |
103
3552b0ee4526
Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff
changeset
|
7 fields: [ |
162
5eb0cfac0e30
Added nested id attribute which comes in JSON response to the model as we need
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
159
diff
changeset
|
8 {name: "id"}, |
159
f653bd7893c0
Fixed model. Added mapping.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
158
diff
changeset
|
9 {name: "messungsId", mapping:"id.messungsId"}, |
f653bd7893c0
Fixed model. Added mapping.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
158
diff
changeset
|
10 {name: "probeId", mapping:"id.probeId"}, |
103
3552b0ee4526
Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff
changeset
|
11 {name: "mmtId"}, |
3552b0ee4526
Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff
changeset
|
12 {name: "nebenprobenNr"}, |
3552b0ee4526
Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff
changeset
|
13 {name: "messdauer"}, |
299
fe199b8828a8
Use ts2date function from lib.Helpers. Remove old code
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
212
diff
changeset
|
14 {name: "messzeitpunkt", convert: Lada.lib.Helpers.ts2date, defaultValue: new Date()}, |
103
3552b0ee4526
Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff
changeset
|
15 {name: "fertig", type: "boolean"}, |
3552b0ee4526
Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff
changeset
|
16 {name: "letzteAenderung", type:"date"}, |
3552b0ee4526
Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff
changeset
|
17 {name: "geplant", type: "boolean"} |
3552b0ee4526
Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff
changeset
|
18 ], |
212
92facbaece42
add getEidi function to model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
171
diff
changeset
|
19 idProperty: "id", |
103
3552b0ee4526
Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff
changeset
|
20 proxy: { |
3552b0ee4526
Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff
changeset
|
21 type: 'rest', |
3552b0ee4526
Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff
changeset
|
22 appendId: true, //default |
3552b0ee4526
Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff
changeset
|
23 url: 'server/rest/messung', |
3552b0ee4526
Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff
changeset
|
24 reader: { |
3552b0ee4526
Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff
changeset
|
25 type: 'json', |
3552b0ee4526
Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff
changeset
|
26 root: 'data' |
3552b0ee4526
Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff
changeset
|
27 } |
212
92facbaece42
add getEidi function to model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
171
diff
changeset
|
28 }, |
92facbaece42
add getEidi function to model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
171
diff
changeset
|
29 getEidi: function() { |
92facbaece42
add getEidi function to model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
171
diff
changeset
|
30 var messId = this.get('messungsId'); |
92facbaece42
add getEidi function to model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
171
diff
changeset
|
31 var probeId = this.get('probeId'); |
92facbaece42
add getEidi function to model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
171
diff
changeset
|
32 return "/" + messId + "/" + probeId; |
103
3552b0ee4526
Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff
changeset
|
33 } |
3552b0ee4526
Added Messungenlist to the Proben eddit view.
Torsten Irländer <torsten@irlaender.de>
parents:
diff
changeset
|
34 }); |
171
c5422819d7b9
Show messzeitpunkt in messung listing. Convert timestamp to date.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
162
diff
changeset
|
35 |
c5422819d7b9
Show messzeitpunkt in messung listing. Convert timestamp to date.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
162
diff
changeset
|
36 function ts2date(v, record){ |
c5422819d7b9
Show messzeitpunkt in messung listing. Convert timestamp to date.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
162
diff
changeset
|
37 // Converts a timestamp into a date object. |
c5422819d7b9
Show messzeitpunkt in messung listing. Convert timestamp to date.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
162
diff
changeset
|
38 return new Date(v); |
c5422819d7b9
Show messzeitpunkt in messung listing. Convert timestamp to date.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
162
diff
changeset
|
39 } |