mirror of
https://github.com/Ekokumppanit/Bicyclesim.git
synced 2026-02-17 11:48:11 +00:00
After adding a new point, only compute the distance and the heading between the new and the previous point (instead of all points).
Add route save button. Routes should be saved after adding (or removing) points. Saving route will: - Update distance and heading between every point - Compute total length of route - Update encoded path used by static map images at frontpage
This commit is contained in:
@@ -12,6 +12,7 @@ function new_point(latlng) {
|
||||
add_point(latlng, num, true);
|
||||
++num;
|
||||
$('.sidebar').animate({scrollTop: $('.sidebar-inner').height()}, 'fast');
|
||||
Session.set('saved', false);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -92,6 +93,10 @@ Template.points.can_edit = function () {
|
||||
return (route && Meteor.user() && route.owner === Meteor.user()._id);
|
||||
};
|
||||
|
||||
Template.points.saved = function () {
|
||||
return Session.get('saved');
|
||||
};
|
||||
|
||||
Template.points.helpers(helpers);
|
||||
|
||||
Template.points.events({
|
||||
@@ -101,11 +106,17 @@ Template.points.events({
|
||||
'click a.remove': function () {
|
||||
Meteor.call('remove_point', this._id, function () {
|
||||
full_clear_required = true;
|
||||
Session.set('saved', false);
|
||||
});
|
||||
},
|
||||
'click .new-point button': function () {
|
||||
'click .new-point': function () {
|
||||
new_point(maps.getLatLng());
|
||||
},
|
||||
'click .save': function () {
|
||||
Meteor.call('update_route', Session.get('route'), function () {
|
||||
Session.set('saved', true);
|
||||
});
|
||||
},
|
||||
'change #points-autoadd': function (event) {
|
||||
Session.set('points-autoadd', event.currentTarget.checked);
|
||||
}
|
||||
@@ -124,6 +135,7 @@ Meteor.autorun(function () {
|
||||
if (Session.equals('page', 'edit') && Session.get('route')) {
|
||||
debug('sivu tai route vaihtui, route: ' + Session.get('route'));
|
||||
full_clear_required = true;
|
||||
Session.set('saved', true);
|
||||
|
||||
Meteor.deps.isolate(function () {
|
||||
var route = Routes.findOne({_id: Session.get('route')});
|
||||
|
||||
Reference in New Issue
Block a user