From ac34f7fe291ecc271de147843c7809f9bec991e0 Mon Sep 17 00:00:00 2001 From: LupusUmbrae Date: Sat, 21 May 2016 16:57:49 +0100 Subject: [PATCH] Additional fix to submenus - Additionally disabled debug in the flask config --- kdm.py | 4 +--- static/javascript/kdm.js | 12 +++++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/kdm.py b/kdm.py index 5a599a1..ef5f328 100644 --- a/kdm.py +++ b/kdm.py @@ -1,9 +1,7 @@ from flask import Flask, request, session, g, redirect, url_for, abort, render_template, flash, Response # Config -DEBUG = True - - +DEBUG = False app = Flask(__name__) app.config.from_object(__name__) diff --git a/static/javascript/kdm.js b/static/javascript/kdm.js index f24b7c0..6503f7b 100644 --- a/static/javascript/kdm.js +++ b/static/javascript/kdm.js @@ -71,9 +71,15 @@ $(function() { $('.dropdown-submenu').click( - function() { - $('.dropdown-submenu > .dropdown-menu').css('display','block'); - return false; + function(event) { + // stop bootstrap.js to hide the parents + event.stopPropagation(); + // hide the open children + $( this ).find(".dropdown-submenu").removeClass('open'); + // add 'open' class to all parents with class 'dropdown-submenu' + $( this ).parents(".dropdown-submenu").addClass('open'); + // this is also open (or was) + $( this ).toggleClass('open'); }); $("#load-dialog").dialog({