Close add entry and search nav JS action improved

This commit is contained in:
Simounet 2017-12-28 23:27:45 +01:00 committed by Nicolas Lœuillet
parent 2831e77cce
commit 91f5992423
2 changed files with 12 additions and 12 deletions

View file

@ -35,6 +35,13 @@ $(document).ready(() => {
initFilters();
initExport();
const toggleNav = (toShow, toFocus) => {
$('.nav-panel-actions').hide(100);
$(toShow).show(100);
$('.nav-panels').css('background', 'white');
$(toFocus).focus();
};
$('#nav-btn-add-tag').on('click', () => {
$('.nav-panel-add-tag').toggle(100);
$('.nav-panel-menu').addClass('hidden');
@ -42,10 +49,7 @@ $(document).ready(() => {
return false;
});
$('#nav-btn-add').on('click', () => {
$('.nav-panel-actions').hide(100);
$('.nav-panel-add').show(100);
$('.nav-panels').css('background', 'white');
$('#entry_url').focus();
toggleNav('.nav-panel-add', '#entry_url');
return false;
});
const materialAddForm = $('.nav-panel-add');
@ -54,15 +58,11 @@ $(document).ready(() => {
$('input#entry_url', materialAddForm).prop('readonly', true).trigger('blur');
});
$('#nav-btn-search').on('click', () => {
$('.nav-panel-actions').hide(100);
$('.nav-panel-search').show(100);
$('.nav-panels').css('background', 'white');
$('#search_entry_term').focus();
toggleNav('.nav-panel-search', '#search_entry_term');
return false;
});
$('.close').on('click', () => {
$('.nav-panel-add').hide(100);
$('.nav-panel-search').hide(100);
$('.close').on('click', (e) => {
$(e.target).parent('.nav-panel-item').hide(100);
$('.nav-panel-actions').show(100);
$('.nav-panels').css('background', 'transparent');
return false;

File diff suppressed because one or more lines are too long