Cleanup and fix media type selector highlight in calendar page

This commit is contained in:
Albert Santoni 2015-08-18 17:29:23 -04:00
parent b3371c2a2f
commit a84c33f0ed
4 changed files with 33 additions and 68 deletions

View file

@ -50,30 +50,6 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
</script> </script>
<!--<div id="nav">
<div class="logo"></div>
<div class="personal-block solo">
<ol>
<li>
<a id="current-user" href=<?php /*echo $baseUrl . "user/edit-user"*/?>><span class="name"><?php /*echo $this->escape($this->loggedInAs()); */?></span></a>
| <a href=<?php /*echo $baseUrl . "login/logout"*/?>><?php /*echo _("Logout")*/?></a>
</li>
</ol>
</div>
<div id="mobile-nav">
<div class="menu-btn" id="menu-btn">
<div></div>
<span></span>
<span></span>
<span></span>
</div>
</div>
<div class="responsive-menu">
<?php /*echo $this->navigation()->menu() */?>
</div>
<div style="clear:both;"></div>
</div>-->
<?php endif; //suspended ?> <?php endif; //suspended ?>
</div> </div>

View file

@ -230,9 +230,3 @@ function getUsabilityHint() {
}); });
} }
$(document).mouseup(function (e) {
var mb = $("#menu-btn"), w = $(window).width();
if (!mb.is(e.target) && mb.has(e.target).length === 0 && w <= 970) {
$('#nav').find('.responsive-menu').slideUp();
}
});

View file

@ -1322,6 +1322,7 @@ var validationTypes = {
"year" : "i" "year" : "i"
}; };
$(document).ready(function() { $(document).ready(function() {
$('.active-tab .md-save').live("click", function() { $('.active-tab .md-save').live("click", function() {
var file_id = $('#file_id').val(), var file_id = $('#file_id').val(),
@ -1345,44 +1346,6 @@ $(document).ready(function() {
} }
}); });
if (location.hash === "") {
$("a[href$='#files']").parent().addClass("selected");
}
$("a[href$='"+location.hash+"']").parent().addClass("selected");
// Slightly hacky way of triggering the click event when it's outside of the anchor text
$(".media_type_selector").on("click", function() {
// Need get(0) here so we don't create a stack overflow by recurring the click on the parent
$(this).find("a").get(0).click();
});
$(window).on('hashchange', function() {
// If we click Dashboard from one of the media views, do nothing
if (!location.hash) {
return;
}
AIRTIME.library.selectNone();
$(".media_type_selector").each(function () {
$(this).removeClass("selected");
});
$("a[href$='"+location.hash+"']").parent().addClass("selected");
oTable.fnDraw();
});
/* Overridden by hashchange function
$(".media_type_selector").on("click", function() {
if (!$(this).hasClass("selected")) {
AIRTIME.library.selectNone();
$(".media_type_selector").each(function () {
$(this).removeClass("selected");
});
$(this).addClass("selected");
oTable.fnDraw();
}
});
*/
$("#advanced-options").on("click", function() { $("#advanced-options").on("click", function() {
resizeAdvancedSearch(); resizeAdvancedSearch();
}); });

View file

@ -143,6 +143,35 @@ AIRTIME = (function(AIRTIME) {
} }
} }
function highlightMediaTypeSelector()
{
if (location.hash === "") {
$("a[href$='#files']").parent().addClass("selected");
}
$("a[href$='"+location.hash+"']").parent().addClass("selected");
// Slightly hacky way of triggering the click event when it's outside of the anchor text
$(".media_type_selector").on("click", function() {
// Need get(0) here so we don't create a stack overflow by recurring the click on the parent
$(this).find("a").get(0).click();
});
$(window).on('hashchange', function() {
// If we click Dashboard from one of the media views, do nothing
if (!location.hash) {
return;
}
AIRTIME.library.selectNone();
$(".media_type_selector").each(function () {
$(this).removeClass("selected");
});
$("a[href$='"+location.hash+"']").parent().addClass("selected");
oTable.fnDraw();
});
}
mod.onReady = function() { mod.onReady = function() {
// Normally we would just use audio/*, but it includes file types that we can't handle (like .m4a) // Normally we would just use audio/*, but it includes file types that we can't handle (like .m4a)
// We initialize the acceptedMimeTypes variable in Bootstrap so we don't have to duplicate the list // We initialize the acceptedMimeTypes variable in Bootstrap so we don't have to duplicate the list
@ -171,6 +200,9 @@ AIRTIME = (function(AIRTIME) {
} }
}); });
//Highlight the media type selector we're currently on.
highlightMediaTypeSelector();
/* /*
* Icon hover states for search. * Icon hover states for search.
*/ */