Cheatsheet visibility code refactored.

This commit is contained in:
Waheed Ahmed
2014-05-23 14:46:47 +05:00
parent b2656bb24e
commit 6ad6f77ca2
4 changed files with 34 additions and 29 deletions

View File

@@ -132,17 +132,11 @@ define(["jquery", "underscore", "gettext", "js/views/modals/base_modal",
},
changeMode: function(event) {
this.removeCheatsheetVisibility();
var parent = $(event.target.parentElement),
mode = parent.data('mode');
event.preventDefault();
this.selectMode(mode);
var $cheatsheet = $('.simple-editor-cheatsheet');
if ($cheatsheet.length == 0){
$cheatsheet = $('.simple-editor-open-ended-cheatsheet');
}
$(".CodeMirror").css({"overflow": "none"});
$(".modal-content").removeAttr("style");
$cheatsheet.removeClass('shown');
},
selectMode: function(mode) {
@@ -204,6 +198,17 @@ define(["jquery", "underscore", "gettext", "js/views/modals/base_modal",
mode: mode,
displayName: displayName
}));
},
removeCheatsheetVisibility: function() {
var cheatsheet = $('article.simple-editor-open-ended-cheatsheet');
if (cheatsheet.length === 0) {
cheatsheet = $('article.simple-editor-cheatsheet');
}
if (cheatsheet.hasClass('shown')) {
cheatsheet.removeClass('shown');
$('.modal-content').removeClass('cheatsheet-is-shown');
}
}
});

View File

@@ -74,3 +74,11 @@ body b {
* use the @include placeholder Bourbon mixin (http://bourbon.io/docs/#placeholder) for any placeholder styling
*/
.modal-content.cheatsheet-is-shown {
overflow: visible !important;
.CodeMirror {
overflow: visible !important;
}
}