fixed lightbox hiding

This commit is contained in:
Connor Turland 2014-06-04 16:41:02 -04:00
parent cac3a7c93b
commit f30904d828
4 changed files with 19 additions and 13 deletions

View file

@ -316,6 +316,7 @@ function cancelMetacodeSetSwitch() {
MetamapsModel.newSelectedMetacodes = MetamapsModel.selectedMetacodes.slice(0);
}
$('#metacodeSwitchTabs').tabs("select", MetamapsModel.selectedMetacodeSetIndex);
$('#topic_name').focus();
}
function MconsoleReset() {
@ -346,18 +347,27 @@ function openLightbox(which) {
$('#lightbox_overlay').show();
$('#lightbox_main').css('margin-top', '-' + ($('#lightbox_main').height() / 2) + 'px');
//if (MetamapsModel.selectedMetacodeSet == "metacodeset-custom" && !MetamapsModel.metacodeScrollerInit) {
if (!MetamapsModel.metacodeScrollerInit) {
//$('.customMetacodeList').mCustomScrollbar();
$('.customMetacodeList, .metacodeSetList').mCustomScrollbar({advanced: { updateOnContentResize: true }});
MetamapsModel.metacodeScrollerInit = true;
}
if (which == "switchMetacodes") {
MetamapsModel.isSwitchingSet = true;
}
}
function closeLightbox() {
$('#lightbox_overlay').hide();
cancelMapCreate('fork_map');
cancelMapCreate('new_map');
if (MetamapsModel.isSwitchingSet) {
cancelMetacodeSetSwitch();
MetamapsModel.isSwitchingSet = false;
}
}
function cancelMapCreate(id) {
$('#lightbox_overlay').hide();
var form = $('#' + id);
form.find('#map_name').val('');
@ -372,4 +382,5 @@ function cancelMapCreate(id) {
form.find('.mapCommonsIcon').addClass('selected');
return false;
}
}

View file

@ -132,12 +132,6 @@ $(document).ready(function () {
// recenter the lightbox when you switch tabs
$('#lightbox_main').css('margin-top', '-' + ($('#lightbox_main').height() / 2) + 'px');
});
/*$("#metacodeSetCustom").click(function () {
if (!MetamapsModel.metacodeScrollerInit) {
$('.customMetacodeList, .metacodeSetList').mCustomScrollbar({advanced: { updateOnContentResize: true }});
MetamapsModel.metacodeScrollerInit = true;
}
});*/
$('.customMetacodeList li').click(function () {
if ($(this).attr('class') != 'toggledOff') {
$(this).addClass('toggledOff');

View file

@ -6,7 +6,7 @@
<div id="lightbox_overlay">
<div id="lightbox_main">
<a id="lightbox_close" onclick="cancelMetacodeSetSwitch();cancelMapCreate('fork_map');cancelMapCreate('new_map');return false;" href="#"></a>
<a id="lightbox_close" onclick="closeLightbox(); return false;" href="#"></a>
<div id="lightbox_content">
<div class="lightboxContent" id="about">
@ -67,6 +67,6 @@
</div>
</div>
<div id="lightbox_screen" onclick="cancelMetacodeSetSwitch();cancelMapCreate('fork_map');cancelMapCreate('new_map');return false;" style="height: 100%;"></div>
<div id="lightbox_screen" onclick="closeLightbox();return false;" style="height: 100%;"></div>
</div>

View file

@ -6,6 +6,7 @@
<div class="anypage">
<%= form_for Topic.new, url: topics_url, remote: true do |form| %>
<div class="openMetacodeSwitcher openLightbox" data-open="switchMetacodes"></div>
<div id="metacodeImg">
<% @m = user.settings.metacodes %>
<% @metacodes = [] %>