From 039112897b09b05153d79ca9a2d9ed114827d294 Mon Sep 17 00:00:00 2001 From: Jan Szejko Date: Wed, 15 Mar 2017 18:06:11 +0100 Subject: [PATCH] dropdowns in top menu + changes in tutorial engine --- redakcja/static/js/catalogue/catalogue.js | 39 +++++++++--------- .../templates/registration/head_login.html | 40 +++++++++++++------ 2 files changed, 46 insertions(+), 33 deletions(-) diff --git a/redakcja/static/js/catalogue/catalogue.js b/redakcja/static/js/catalogue/catalogue.js index 2b5a9420..cb96d113 100755 --- a/redakcja/static/js/catalogue/catalogue.js +++ b/redakcja/static/js/catalogue/catalogue.js @@ -61,8 +61,9 @@ function tutreset() { if (start) $(start).popover('hide'); start = null; + var all_tutorial = $('[data-toggle="tutorial"]'); - tutorial = $.makeArray($('[data-toggle="tutorial"]').sort( + tutorial = $.makeArray(all_tutorial.sort( function(a, b) {return $(a).attr('data-tutorial') < $(b).attr('data-tutorial') ? -1 : 1} )); @@ -70,19 +71,15 @@ $.each(tutorial, function(i, e) { var but = (i < tutorial.length - 1) ? '>>' : 'OK'; $(e).popover({ - title: 'Tutorial', + title: '×Tutorial', trigger: 'focus', - template: '' - }).on('shown.bs.popover', function () { - if (!$(e).data('tut-yet')) { - $("#tutoff"+i).on('click', tutoff); - $("#nt"+i).on('click', tut); - $(e).data('tut-yet', 'yes'); - } + html: 'true', + template: '' }); - //$(start).on('hide.bs.popover', tut); }); first_reset = false; + } else { + all_tutorial.popover('enable'); } } @@ -93,21 +90,20 @@ return false; } function tutoff() { + $(this).popover('hide'); if (start) $(start).popover('hide'); start = null; sessionStorage.removeItem("tutorial"); + $('[data-toggle="tutorial"]').popover('disable'); return false; } function tut() { - if (start) $(start).popover('hide'); + if (start) { + $(start).popover('hide').popover('disable'); + } if (tutorial.length) { start = tutorial.shift(); $(start).popover('show'); - //~ if (!$(start).data('tut-yet')) { - //~ $(".popover .tutorial-off").on('click', tutoff); - //~ $(".popover .tutorial-next").on('click', tut); - //~ $(start).data('tut-yet', 'yes'); - //~ } } else { start = null; @@ -115,14 +111,15 @@ return false; } $('#tutModal').on('hidden.bs.modal', tut); - - if (sessionStorage.getItem("tutorial") == "on" && $("#tuton").length == 0) { + + var $tuton = $("#tuton"); + if (sessionStorage.getItem("tutorial") == "on" && $tuton.length == 0) { tutreset(); tut(); } - $("#tuton").on('click', tuton); - - + $tuton.on('click', tuton); + $(document).on('click', '.tutorial-off', tutoff); + $(document).on('click', '.tutorial-next', tut); }); })(jQuery); diff --git a/redakcja/templates/registration/head_login.html b/redakcja/templates/registration/head_login.html index f743f409..3077af38 100644 --- a/redakcja/templates/registration/head_login.html +++ b/redakcja/templates/registration/head_login.html @@ -16,21 +16,38 @@
  • {% trans "About" %}
  • {% trans "App Your School" %}
  • {#
  • {% trans "Competition" %}
  • #} -
  • {% trans "New organization" %}
  • -
  • + + {% trans "Organizations" %} + + + +
  • + + data-content='{% trans "Here you can start editing a new resource or view your resources and all published resources." %}' + {% endif %}> + + {% trans "Resources" %} + + + + + {% if user.is_authenticated %} -
  • {% trans "My resources" %}