Skip to content

Commit e020d15

Browse files
committed
adds proper toolbar lock, fixes django-cms#2306
1 parent 708f4d8 commit e020d15

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

cms/static/cms/js/plugins/cms.toolbar.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ $(document).ready(function () {
440440

441441
openMessage: function (msg, dir, delay, error) {
442442
// set toolbar freeze
443-
this.lockToolbar = true;
443+
this._lockToolbar(true);
444444

445445
// add content to element
446446
this.messages.find('.cms_messages-inner').html(msg);
@@ -517,7 +517,7 @@ $(document).ready(function () {
517517
closeMessage: function () {
518518
this.messages.fadeOut(300);
519519
// unlock toolbar
520-
this.lockToolbar = false;
520+
this._lockToolbar(false);
521521
},
522522

523523
openModal: function (url, name, breadcrumb) {
@@ -765,7 +765,7 @@ $(document).ready(function () {
765765
this.sideframe.find('.cms_sideframe-btn').css('right', -20);
766766
}
767767

768-
this.lockToolbar = true;
768+
this._lockToolbar(true);
769769
},
770770

771771
_hideSideframe: function (close) {
@@ -785,7 +785,8 @@ $(document).ready(function () {
785785
// should we reload
786786
if(this.enforceReload) CMS.API.Helpers.reloadBrowser();
787787

788-
this.lockToolbar = false;
788+
// lock toolbar
789+
this._lockToolbar(false);
789790
},
790791

791792
_minimizeSideframe: function () {
@@ -1246,6 +1247,18 @@ $(document).ready(function () {
12461247
$(window).scrollTop(this.body.data('scroll'));
12471248
},
12481249

1250+
_lockToolbar: function (lock) {
1251+
if(lock) {
1252+
this.lockToolbar = true;
1253+
// make button look disabled
1254+
this.toolbarTrigger.css('opacity', 0.2);
1255+
} else {
1256+
this.lockToolbar = false;
1257+
// make button look disabled
1258+
this.toolbarTrigger.css('opacity', 1);
1259+
}
1260+
},
1261+
12491262
_debug: function () {
12501263
var that = this;
12511264
var timeout = 1000;

0 commit comments

Comments
 (0)