Index: lams_central/web/css/main.css =================================================================== diff -u -r8d104e54ae65a9dfc2915954cd4e6461c173e799 -r97deffe165055d02a9942930ec547b5ee040dc42 --- lams_central/web/css/main.css (.../main.css) (revision 8d104e54ae65a9dfc2915954cd4e6461c173e799) +++ lams_central/web/css/main.css (.../main.css) (revision 97deffe165055d02a9942930ec547b5ee040dc42) @@ -307,6 +307,9 @@ vertical-align: middle; border-radius: 10px; } +#notificationsPendingCount.btn-default { + background-color: #ddd; +} /*DIALOGS*/ .dialogContainer { Index: lams_central/web/includes/javascript/addLesson.js =================================================================== diff -u -r7f5de60cba2fa6ed056786c5461af6e29518723f -r97deffe165055d02a9942930ec547b5ee040dc42 --- lams_central/web/includes/javascript/addLesson.js (.../addLesson.js) (revision 7f5de60cba2fa6ed056786c5461af6e29518723f) +++ lams_central/web/includes/javascript/addLesson.js (.../addLesson.js) (revision 97deffe165055d02a9942930ec547b5ee040dc42) @@ -1,4 +1,4 @@ -// ********** MAIN FUNCTIONS ********** +// ********** MAIN FUNCTIONS ********** var tree, lastSelectedUsers = {}, sortOrderAscending = {}, @@ -7,7 +7,6 @@ originalThumbnailWidth = 0, originalThumbnailHeight = 0; - /** * For tabs changing. */ @@ -50,13 +49,17 @@ }); tree.singleNodeHighlight = true; - tree.subscribe('clickEvent', function(event){ - if (!event.node.data.learningDesignId){ - // it is a folder + tree.subscribe('clickEvent', function(event) { + // if it's a folder - do not select it. if design is already selected - do not allow deselecting it on subsequent click + if (!event.node.data.learningDesignId || event.node.highlightState == 1) { return false; } $('#lessonNameInput').val(event.node.label); + //focus element only if it's visible in the current viewport (to avoid unwanted scrolling) + if (isElementInViewport($('#lessonNameInput'))) { + $('#lessonNameInput').focus(); + } // display "loading" animation and finally LD thumbnail $('.ldChoiceDependentCanvasElement').css('display', 'none'); @@ -67,13 +70,46 @@ } }); tree.subscribe('clickEvent',tree.onEventToggleHighlight); + tree.subscribe('dblClickEvent', function(event){ + + // if it's a folder - do not select it + if (!event.node.data.learningDesignId) { + return false; + } + + //trigger "clickEvent" first so that addLesson() function will know which element is selected + tree.fireEvent("clickEvent", event); + + // start lesson + addLesson(); + }); tree.render(); // expand the first (user) folder tree.getRoot().children[0].expand(); + + // ability to start a lesson on pressing Enter button in a lesson name input + $('#lessonNameInput').on('keyup', function (e) { + if (e.keyCode == 13) { + addLesson(); + } + }); } +//checks whether element is visible in the current viewport +function isElementInViewport(el) { + el = el[0]; + var rect = el.getBoundingClientRect(); + return ( + rect.top >= 0 && + rect.left >= 0 && + rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && /*or $(window).height() */ + rect.right <= (window.innerWidth || document.documentElement.clientWidth) /*or $(window).width() */ + ); +} + + function initClassTab(){ // users variable is declared in newLesson.jsp fillUserContainer(users.selectedLearners, 'selected-learners'); Index: lams_central/web/includes/javascript/main.js =================================================================== diff -u -r15a0a16d66153b4f57df055b38b2c3143445b5fa -r97deffe165055d02a9942930ec547b5ee040dc42 --- lams_central/web/includes/javascript/main.js (.../main.js) (revision 15a0a16d66153b4f57df055b38b2c3143445b5fa) +++ lams_central/web/includes/javascript/main.js (.../main.js) (revision 97deffe165055d02a9942930ec547b5ee040dc42) @@ -446,6 +446,13 @@ }, success : function(count) { $('#notificationsPendingCount').text(count == 0 ? '0' : count); + + //#notificationsPendingCount will have .btn-primary class when there are some messages available and .btn-default otherwise + if (count == 0) { + $('#notificationsPendingCount').removeClass("btn-primary").addClass("btn-default"); + } else { + $('#notificationsPendingCount').removeClass("btn-default").addClass("btn-primary"); + } } }); } Index: lams_central/web/less/main.less =================================================================== diff -u -r4ebcb20e42c6296480b52fe6986a7da08442ebf3 -r97deffe165055d02a9942930ec547b5ee040dc42 --- lams_central/web/less/main.less (.../main.less) (revision 4ebcb20e42c6296480b52fe6986a7da08442ebf3) +++ lams_central/web/less/main.less (.../main.less) (revision 97deffe165055d02a9942930ec547b5ee040dc42) @@ -351,6 +351,9 @@ vertical-align: middle; border-radius: 10px; } +#notificationsPendingCount.btn-default { + background-color: #ddd; +} /*DIALOGS*/ .dialogContainer { Index: lams_central/web/main.jsp =================================================================== diff -u -rda3c4373fcf7b9dac02ab988aba796a16933521e -r97deffe165055d02a9942930ec547b5ee040dc42 --- lams_central/web/main.jsp (.../main.jsp) (revision da3c4373fcf7b9dac02ab988aba796a16933521e) +++ lams_central/web/main.jsp (.../main.jsp) (revision 97deffe165055d02a9942930ec547b5ee040dc42) @@ -275,14 +275,14 @@