From 802cbac017f8ff48ed0c66795061483fddf5cf53 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 8 Nov 2017 17:35:23 +0300 Subject: [PATCH] SynchronizeTip: added 'left' placement, added option for changing link text and visibility. --- .../main/lib/component/SynchronizeTip.js | 19 +++++++++++++++---- .../main/resources/less/synchronize-tip.less | 15 +++++++++++++++ 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/apps/common/main/lib/component/SynchronizeTip.js b/apps/common/main/lib/component/SynchronizeTip.js index a6c3f24ed..a3df4656b 100644 --- a/apps/common/main/lib/component/SynchronizeTip.js +++ b/apps/common/main/lib/component/SynchronizeTip.js @@ -45,7 +45,8 @@ define([ options : { target : $(document.body), text : '', - placement: 'right' + placement: 'right', + showLink: true }, template: _.template([ @@ -56,7 +57,9 @@ define([ '
<%= scope.text %>
', '
', '', - '', + '<% if ( scope.showLink ) { %>', + '', + '<% } %>', '', '' ].join('')), @@ -67,7 +70,9 @@ define([ Common.UI.BaseView.prototype.initialize.call(this, options); this.target = this.options.target; this.text = !_.isEmpty(this.options.text) ? this.options.text : this.textSynchronize; + this.textLink = !_.isEmpty(this.options.textLink) ? this.options.textLink : this.textDontShow; this.placement = this.options.placement; + this.showLink = this.options.showLink; }, render: function() { @@ -95,8 +100,14 @@ define([ applyPlacement: function () { var showxy = this.target.offset(); - (this.placement == 'top') ? tipEl.css({bottom : Common.Utils.innerHeight() - showxy.top + 'px', right: Common.Utils.innerWidth() - showxy.left - this.target.width()/2 + 'px'}) - : tipEl.css({top : showxy.top + this.target.height()/2 + 'px', left: showxy.left + this.target.width() + 'px'}); + + if (this.placement == 'top') + tipEl.css({bottom : Common.Utils.innerHeight() - showxy.top + 'px', right: Common.Utils.innerWidth() - showxy.left - this.target.width()/2 + 'px'}); + else if (this.placement == 'left') + tipEl.css({top : showxy.top + this.target.height()/2 + 'px', right: Common.Utils.innerWidth() - showxy.left - 5 + 'px'}); + else // right + tipEl.css({top : showxy.top + this.target.height()/2 + 'px', left: showxy.left + this.target.width() + 'px'}); + }, isVisible: function() { diff --git a/apps/common/main/resources/less/synchronize-tip.less b/apps/common/main/resources/less/synchronize-tip.less index 6de6e6e41..df5b141c9 100644 --- a/apps/common/main/resources/less/synchronize-tip.less +++ b/apps/common/main/resources/less/synchronize-tip.less @@ -23,6 +23,21 @@ } } + &.left { + margin: -32px 15px 0 0; + + .tip-arrow { + right: -15px; + top: 20px; + width: 15px; + height: 30px; + &:after { + top: 5px; + left: -8px; + } + } + } + &.top { margin: 0 -32px 15px 0;