Skip to content

Commit 620bce4

Browse files
author
Jens Kuebler
committed
F: OpenSeaMap#187 add gauges
1 parent 3ea5f7f commit 620bce4

File tree

2 files changed

+99
-0
lines changed

2 files changed

+99
-0
lines changed

src/js/oseam-views-gaugedialog.js

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
OSeaM.views.GaugeDialog = OSeaM.View.extend({
2+
3+
events : {
4+
'click #oseam-cancel' : 'onCancel',
5+
'click #close' : 'onCancel',
6+
'click #oseam-save' : 'onSave',
7+
},
8+
initialize : function() {
9+
OSeaM.frontend.on("change:language", this.render, this);
10+
},
11+
render : function() {
12+
new OSeaM.views.Wizard();
13+
var language = OSeaM.frontend.getLanguage();
14+
var template = OSeaM.loadTemplate('gaugedialog-' + language);
15+
//var template = OSeaM.loadTemplate('vessel');
16+
this.renderParams = {
17+
name : this.model.get('name')
18+
};
19+
var content = $(template(this.renderParams));
20+
OSeaM.frontend.translate(content);
21+
this.$el.append(content);
22+
this.el = content;
23+
return content;
24+
},
25+
onCancel : function(evt) {
26+
// removes the inserted dialog div and stops listening for events
27+
// this.wizard.remove();
28+
this.el.remove();
29+
this.undelegateEvents();
30+
},
31+
onSave : function(evt) {
32+
/*
33+
* If this is new project it won't have the ID attribute defined
34+
*/
35+
if (null == this.model.id) {
36+
/*
37+
* We are creating our model through its collection (this way we'll automatically update its views and persist it to DB)
38+
*/
39+
this.model.save();
40+
this.collection.add(this.model);
41+
} else {
42+
/*
43+
* Simple save will persist the model to the DB and update its view
44+
*/
45+
this.model.save();
46+
}
47+
/*
48+
* Hiding modal dialog window
49+
* removes the inserted dialog div and stops listening for events
50+
*/
51+
//
52+
// this.wizard.remove();
53+
this.el.remove();
54+
this.undelegateEvents();
55+
}
56+
});
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<div class="oseam-modal modal hide fade" id="gaugeedit" tabindex="-1" role="dialog" aria-labelledby="x" aria-hidden="true">
2+
<div class="modal-header">
3+
<button type="button" id="close" class="close" data-dismiss="modal" aria-hidden="true">×</button>
4+
<h3 id="gaugevalue">Gauges {{name}}</h3>
5+
</div>
6+
<div class="modal-body">
7+
<div class="span8">
8+
<h4>Gauge</h4>
9+
<h5>Edit details of gauge</h5>
10+
11+
<div class="control-group">
12+
<p><label class="tableft50">Name</label></p>
13+
<div class="input-append">
14+
<input type="text" class="input-mini" id="name" name="name" placeholder="0.00" value="{{name}}" title="Gauge Name"/>
15+
<span class="add-on">m</span>
16+
<span class="help-inline helpOsm"></span>
17+
</div>
18+
</div>
19+
20+
<div class="control-group">
21+
<p><label class="tableft50">Latitude</label></p>
22+
<div class="input-append">
23+
<input type="text" class="input-mini" id="latitude" name="latitude" placeholder="0.0" value="{{latitude}}" title="Latitude"/>
24+
<span class="add-on">Decimal Degree</span>
25+
<span class="help-inline helpOsm"></span>
26+
</div>
27+
</div>
28+
29+
<div class="control-group">
30+
<p><label class="tableft50">Longitude</label></p>
31+
<div class="input-append">
32+
<input type="text" class="input-mini" id="longitude" name="longitude" placeholder="0.0" value="{{longitude}}" title="Longitude"/>
33+
<span class="add-on">m</span>
34+
<span class="help-inline helpOsm"></span>
35+
</div>
36+
</div>
37+
38+
</div>
39+
<div class="modal-footer">
40+
<button class="btn" data-dismiss="modal" id="oseam-cancel" aria-hidden="true">Cancel</button>
41+
<button class="btn btn-primary" id="oseam-save">Save and Finish</button>
42+
</div>
43+
</div>

0 commit comments

Comments
 (0)