1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-15 23:00:36 +02:00

Various changes

This commit is contained in:
Laurent Cozic
2017-07-18 19:27:10 +00:00
parent 6c75345435
commit 980e4bded1
11 changed files with 209 additions and 13 deletions

View File

@ -1,5 +1,6 @@
import { BaseModel } from 'lib/base-model.js';
import { Log } from 'lib/log.js';
import { sprintf } from 'sprintf-js';
import { Folder } from 'lib/models/folder.js';
import { BaseItem } from 'lib/models/base-item.js';
import { Setting } from 'lib/models/setting.js';
@ -40,6 +41,12 @@ class Note extends BaseItem {
return super.serialize(note, 'note', fieldNames);
}
static geolocationUrl(note) {
if (!('latitude' in note) || !('longitude' in note)) throw new Error('Latitude or longitude missing');
if (!note.latitude && !note.longitude) throw new Error(_('This note does not have geolocation information.'));
return sprintf('https://www.openstreetmap.org/?lat=%s&lon=%s&zoom=20', note.latitude, note.longitude)
}
static modelType() {
return BaseModel.TYPE_NOTE;
}