From 4744cb0e1df8ee7c1cd10c9fbd67caec73051024 Mon Sep 17 00:00:00 2001 From: Thomas LEBEAU Date: Sat, 8 Mar 2014 13:47:15 +0100 Subject: [PATCH] bagit link + overlay save link + listmode --- themes/baggy/_menu.twig | 2 +- themes/baggy/_pocheit-form.twig | 8 ++++ themes/baggy/css/main.css | 48 +++++++++++++++++++--- themes/baggy/home.twig | 2 +- themes/baggy/js/init.js | 71 +++++++++++++++++++++++++-------- 5 files changed, 107 insertions(+), 24 deletions(-) create mode 100755 themes/baggy/_pocheit-form.twig diff --git a/themes/baggy/_menu.twig b/themes/baggy/_menu.twig index e9cd9d4a..7dd799f9 100644 --- a/themes/baggy/_menu.twig +++ b/themes/baggy/_menu.twig @@ -4,7 +4,7 @@
  • {% trans "favorites" %}
  • {% trans "archive" %}
  • {% trans "tags" %}
  • -
  • {% trans "save a link" %}
  • +
  • {% trans "save a link" %}
  • {% trans "config" %}
  • {% trans "logout" %}
  • diff --git a/themes/baggy/_pocheit-form.twig b/themes/baggy/_pocheit-form.twig new file mode 100755 index 00000000..3c4a4d6e --- /dev/null +++ b/themes/baggy/_pocheit-form.twig @@ -0,0 +1,8 @@ +
    + +
    +

    {% trans "Save a link" %}

    + + +
    +
    diff --git a/themes/baggy/css/main.css b/themes/baggy/css/main.css index fe77a967..586501b0 100755 --- a/themes/baggy/css/main.css +++ b/themes/baggy/css/main.css @@ -173,7 +173,7 @@ h2:after { #links { position: fixed; top: 0; - width: 9em; + width: 10em; left: 0; text-align: right; background: #333; @@ -184,7 +184,7 @@ h2:after { } #main { - margin-left: 12em; + margin-left: 13em; position: relative; z-index: 10; padding-right: 5%; @@ -228,7 +228,7 @@ h2:after { #links li:last-child { position: fixed; bottom: 1em; - width: 9em; + width: 10em; } #links li:last-child a:before { @@ -322,6 +322,15 @@ footer a { letter-spacing:-5px; } +.listmode .entrie { + width: 100%!important; + margin-left: 0!important; +} + +.listmode .entrie p { + display: none; +} + .list-entries + .results { margin-bottom: 2em; } @@ -343,10 +352,10 @@ footer a { letter-spacing:normal; box-shadow: 0 3px 7px rgba(0,0,0,0.3); display: inline-block; - width: 32%; + width: 32%!important; margin-bottom: 1.5em; vertical-align: top; - margin-left: 1.5%; + margin-left: 1.5%!important; position: relative; overflow: hidden; padding: 1.5em 1.5em 3em 1.5em; @@ -481,7 +490,7 @@ footer a { } .entrie:nth-child(3n+1) { - margin-left: 0; + margin-left: 0!important; } .results { @@ -525,6 +534,33 @@ footer a { display: none; } +#bagit-form { + background: rgba(0,0,0,0.8); + position: fixed; + top: 0; + left: 10em; + z-index: 20; + height: 100%; + width: 100%; + margin: 0; + padding: 2em; + display: none; +} + +#bagit-form form { + background: #FFF; + position: absolute; + top: 50%; + left: 50%; + z-index: 20; + border: 10px solid #000; + width: 600px; + height: 300px; + margin: -150px 0 0 -300px; + padding: 2em; +} + + /* ========================================================================== 3 = Pictos ========================================================================== */ diff --git a/themes/baggy/home.twig b/themes/baggy/home.twig index 7bc0472d..e34897fa 100755 --- a/themes/baggy/home.twig +++ b/themes/baggy/home.twig @@ -30,7 +30,7 @@ {% endif %} {% endblock %} -
    +
    {% for entry in entries %}

    {{ entry.title|raw }}

    diff --git a/themes/baggy/js/init.js b/themes/baggy/js/init.js index 4a843548..99bffd09 100755 --- a/themes/baggy/js/init.js +++ b/themes/baggy/js/init.js @@ -1,36 +1,75 @@ -$(document).ready(function() { +$.fn.ready(function() { + + var $listmode = $('#listmode'), + $listentries = $("#list-entries"), + $bagit = $('#bagit'), + $bagitForm = $('#bagit-form'); + + /* ========================================================================== + Menu + ========================================================================== */ $("#menu").click(function(){ $("#links").toggle(); }); + /* ========================================================================== + List mode or Table Mode + ========================================================================== */ - $("#listmode").click(function(){ + $listmode.click(function(){ if ( $.cookie("listmode") == 1 ) { - $(".entrie").css("width", ""); - $(".entrie").css("margin-left", ""); - + // Cookie $.removeCookie("listmode"); - $("#listmode").removeClass("tablemode"); - $("#listmode").addClass("listmode"); + + $listentries.removeClass("listmode"); + $listmode.removeClass("tablemode"); + $listmode.addClass("listmode"); } else { + // Cookie $.cookie("listmode", 1, {expires: 365}); - $(".entrie").css("width", "100%"); - $(".entrie").css("margin-left", "0"); - $("#listmode").removeClass("listmode"); - $("#listmode").addClass("tablemode"); + $listentries.addClass("listmode"); + $listmode.removeClass("listmode"); + $listmode.addClass("tablemode"); } }); + /* ========================================================================== + Cookie listmode + ========================================================================== */ + if ( $.cookie("listmode") == 1 ) { - $(".entrie").css("width", "100%"); - $(".entrie").css("margin-left", "0"); - $("#listmode").removeClass("listmode"); - $("#listmode").addClass("tablemode"); + $listentries.addClass("listmode"); + $listmode.removeClass("listmode"); + $listmode.addClass("tablemode"); } + /* ========================================================================== + bag it link + ========================================================================== */ + + $bagit.click(function(){ + $bagitForm.toggle(); + }); + + /* ========================================================================== + Keyboard gestion + ========================================================================== */ + + $(window).keydown(function(e){ + switch (e.keyCode) { + // s letter + case 83: + $bagitForm.toggle(); + break; + case 27: + $bagitForm.hide(); + break; + } + }) + -}); +}); \ No newline at end of file -- 2.41.0