Bug with creating several synchronize tips.
This commit is contained in:
parent
6036d08f92
commit
76e49ef7da
|
@ -39,8 +39,6 @@ define([
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
Common.UI.SynchronizeTip = Common.UI.BaseView.extend(_.extend((function() {
|
Common.UI.SynchronizeTip = Common.UI.BaseView.extend(_.extend((function() {
|
||||||
var tipEl;
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
options : {
|
options : {
|
||||||
target : $(document.body),
|
target : $(document.body),
|
||||||
|
@ -76,42 +74,43 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
tipEl = $(this.template({ scope: this }));
|
if (!this.cmpEl) {
|
||||||
tipEl.find('.close').on('click', _.bind(function() { this.trigger('closeclick');}, this));
|
this.cmpEl = $(this.template({ scope: this }));
|
||||||
tipEl.find('.show-link label').on('click', _.bind(function() { this.trigger('dontshowclick');}, this));
|
$(document.body).append(this.cmpEl);
|
||||||
|
this.cmpEl.find('.close').on('click', _.bind(function() { this.trigger('closeclick');}, this));
|
||||||
|
this.cmpEl.find('.show-link label').on('click', _.bind(function() { this.trigger('dontshowclick');}, this));
|
||||||
|
}
|
||||||
|
|
||||||
$(document.body).append(tipEl);
|
|
||||||
this.applyPlacement();
|
this.applyPlacement();
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
show: function(){
|
show: function(){
|
||||||
if (tipEl) {
|
if (this.cmpEl) {
|
||||||
this.applyPlacement();
|
this.applyPlacement();
|
||||||
tipEl.show()
|
this.cmpEl.show()
|
||||||
} else
|
} else
|
||||||
this.render();
|
this.render();
|
||||||
},
|
},
|
||||||
|
|
||||||
hide: function() {
|
hide: function() {
|
||||||
if (tipEl) tipEl.hide();
|
if (this.cmpEl) this.cmpEl.hide();
|
||||||
},
|
},
|
||||||
|
|
||||||
applyPlacement: function () {
|
applyPlacement: function () {
|
||||||
var showxy = this.target.offset();
|
var showxy = this.target.offset();
|
||||||
|
|
||||||
if (this.placement == 'top')
|
if (this.placement == 'top')
|
||||||
tipEl.css({bottom : Common.Utils.innerHeight() - showxy.top + 'px', right: Common.Utils.innerWidth() - showxy.left - this.target.width()/2 + 'px'});
|
this.cmpEl.css({bottom : Common.Utils.innerHeight() - showxy.top + 'px', right: Common.Utils.innerWidth() - showxy.left - this.target.width()/2 + 'px'});
|
||||||
else if (this.placement == 'left')
|
else if (this.placement == 'left')
|
||||||
tipEl.css({top : showxy.top + this.target.height()/2 + 'px', right: Common.Utils.innerWidth() - showxy.left - 5 + 'px'});
|
this.cmpEl.css({top : showxy.top + this.target.height()/2 + 'px', right: Common.Utils.innerWidth() - showxy.left - 5 + 'px'});
|
||||||
else // right
|
else // right
|
||||||
tipEl.css({top : showxy.top + this.target.height()/2 + 'px', left: showxy.left + this.target.width() + 'px'});
|
this.cmpEl.css({top : showxy.top + this.target.height()/2 + 'px', left: showxy.left + this.target.width() + 'px'});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
isVisible: function() {
|
isVisible: function() {
|
||||||
return tipEl && tipEl.is(':visible');
|
return this.cmpEl && this.cmpEl.is(':visible');
|
||||||
},
|
},
|
||||||
|
|
||||||
textDontShow : 'Don\'t show this message again',
|
textDontShow : 'Don\'t show this message again',
|
||||||
|
|
Loading…
Reference in a new issue