leaflet: annotation: wizard: added insert comments options
added insert comment option in comment wizard titlebar added option to add comment from empty wizard state Signed-off-by: Pranam Lashkari <lpranam@collabora.com> Change-Id: I2d30483d586ce798bc3d77b3b47c7ab26eebe684
This commit is contained in:
parent
d7c1c388d2
commit
4bc6e2e900
4 changed files with 39 additions and 9 deletions
|
@ -983,6 +983,15 @@ input[type='checkbox'][disabled] {
|
|||
}
|
||||
|
||||
/* Annotations - comments */
|
||||
|
||||
#insert_comment {
|
||||
right: 0px;
|
||||
position: absolute;
|
||||
top: 20%;
|
||||
height: initial !important;
|
||||
width: initial !important;
|
||||
}
|
||||
|
||||
#mobile-wizard .loleaflet-annotation-content {
|
||||
margin: 3px 3px 3px 38px;
|
||||
padding: 0px 10px;
|
||||
|
|
|
@ -2156,7 +2156,7 @@ L.Control.JSDialogBuilder = L.Control.extend({
|
|||
_rootCommentControl: function(parentContainer, data, builder) {
|
||||
|
||||
if (data.type === 'emptyCommentWizard') {
|
||||
builder._emptyCommentWizard(parentContainer, data);
|
||||
builder._emptyCommentWizard(parentContainer, data, builder);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2213,7 +2213,7 @@ L.Control.JSDialogBuilder = L.Control.extend({
|
|||
return false;
|
||||
},
|
||||
|
||||
_emptyCommentWizard: function(parentContainer, data) {
|
||||
_emptyCommentWizard: function(parentContainer, data, builder) {
|
||||
var emptyCommentWizard = L.DomUtil.create('figure', 'empty-comment-wizard-container', parentContainer);
|
||||
var imgNode = L.DomUtil.create('img', 'empty-comment-wizard-img', emptyCommentWizard);
|
||||
imgNode.src = 'images/lc_showannotations.svg';
|
||||
|
@ -2221,9 +2221,9 @@ L.Control.JSDialogBuilder = L.Control.extend({
|
|||
var textNode = L.DomUtil.create('figcaption', 'empty-comment-wizard', emptyCommentWizard);
|
||||
textNode.innerText = data.text;
|
||||
L.DomUtil.create('br', 'empty-comment-wizard', textNode);
|
||||
var linkNode = L.DomUtil.create('a', 'empty-comment-wizard-link', textNode);
|
||||
linkNode.href = '#';
|
||||
linkNode.innerText = 'Insert Comment';
|
||||
var linkNode = L.DomUtil.create('div', 'empty-comment-wizard-link', textNode);
|
||||
linkNode.innerText = _('Insert Comment');
|
||||
linkNode.onclick = builder.map.insertComment.bind(builder.map);
|
||||
},
|
||||
|
||||
_createIconURL: function(name) {
|
||||
|
|
|
@ -15,6 +15,7 @@ L.Control.MobileWizard = L.Control.extend({
|
|||
_inBuilding: false,
|
||||
_currentDepth: 0,
|
||||
_mainTitle: '',
|
||||
_customTitle: false,
|
||||
_isTabMode: false,
|
||||
_currentPath: [],
|
||||
_tabs: [],
|
||||
|
@ -234,7 +235,12 @@ L.Control.MobileWizard = L.Control.extend({
|
|||
this._currentDepth++;
|
||||
if (!this._inBuilding)
|
||||
history.pushState({context: 'mobile-wizard', level: this._currentDepth}, 'mobile-wizard-level-' + this._currentDepth);
|
||||
this._setTitle(contentToShow.title);
|
||||
|
||||
if (this._customTitle)
|
||||
this._setCustomTitle(this._customTitle);
|
||||
else
|
||||
this._setTitle(contentToShow.title);
|
||||
|
||||
this._inMainMenu = false;
|
||||
|
||||
this._currentPath.push(contentToShow.title);
|
||||
|
@ -262,9 +268,9 @@ L.Control.MobileWizard = L.Control.extend({
|
|||
|
||||
var parent = $('.ui-content.mobile-wizard:visible');
|
||||
if (this._currentDepth > 0 && parent)
|
||||
this._setTitle(parent.get(0).title);
|
||||
this._customTitle ? this._setCustomTitle(parent.get(0).customTitleBar) : this._setTitle(parent.get(0).title);
|
||||
else
|
||||
this._setTitle(this._mainTitle);
|
||||
this._customTitle ? this._setCustomTitle(this._customTitle) : this._setTitle(this._mainTitle);
|
||||
|
||||
var headers;
|
||||
if (this._currentDepth === 0) {
|
||||
|
@ -306,6 +312,11 @@ L.Control.MobileWizard = L.Control.extend({
|
|||
right.text(title);
|
||||
},
|
||||
|
||||
_setCustomTitle: function(title) {
|
||||
var right = $('#mobile-wizard-title');
|
||||
right.html(title);
|
||||
},
|
||||
|
||||
_scrollToPosition: function(position) {
|
||||
if (this._currentScrollPosition) {
|
||||
$('#mobile-wizard-content').animate({ scrollTop: position }, 0);
|
||||
|
@ -438,7 +449,9 @@ L.Control.MobileWizard = L.Control.extend({
|
|||
this._builder.build(this.content.get(0), [data]);
|
||||
|
||||
this._mainTitle = data.text ? data.text : '';
|
||||
this._setTitle(this._mainTitle);
|
||||
this._customTitle = data.customTitle;
|
||||
|
||||
this._customTitle ? this._setCustomTitle(this._customTitle) : this._setTitle(this._mainTitle);
|
||||
|
||||
if (data.id === 'menubar' || data.id === 'insertshape') {
|
||||
$('#mobile-wizard').height('100%');
|
||||
|
|
|
@ -3935,12 +3935,20 @@ L.TileLayer = L.GridLayer.extend({
|
|||
},
|
||||
|
||||
getCommentWizardStructure: function(menuStructure) {
|
||||
var customTitleBar = L.DomUtil.create('div');
|
||||
var title = L.DomUtil.create('span', '', customTitleBar);
|
||||
title.innerText = _('Comment');
|
||||
var button = L.DomUtil.createWithId('button', 'insert_comment', customTitleBar);
|
||||
button.innerText = '+';
|
||||
button.onclick = this._map.insertComment.bind(this._map);
|
||||
|
||||
if (menuStructure === undefined) {
|
||||
menuStructure = {
|
||||
id : 'comment',
|
||||
type : 'mainmenu',
|
||||
enabled : true,
|
||||
text : _('Comment'),
|
||||
customTitle : customTitleBar,
|
||||
executionType : 'menu',
|
||||
data : [],
|
||||
children : []
|
||||
|
|
Loading…
Reference in a new issue