From 39f2213e92040d2a8bffc3084f30d868fa7b8882 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 12 Oct 2013 15:35:56 +0200 Subject: aside_flux: Modèle dynamique pour les menus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Utilise un modèle plutôt que le menu HTML répété en dur, pour beaucoup diminuer la taille de la page HTML --- app/views/javascript/main.phtml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'app/views/javascript/main.phtml') diff --git a/app/views/javascript/main.phtml b/app/views/javascript/main.phtml index 03c60cc52..f6700330a 100644 --- a/app/views/javascript/main.phtml +++ b/app/views/javascript/main.phtml @@ -403,7 +403,18 @@ function init_nav_entries() { }); } -$(document).ready (function () { +function init_templates() { + $('#aside_flux').on('click', '.dropdown-toggle', function () { + if ($(this).nextAll('.dropdown-menu').length === 0) { + var feed_id = $(this).data('fid'), + feed_web = $(this).data('fweb'), + template = $('#feed_config_template').html().replace(/!!!!!!/g, feed_id).replace('http://example.net/', feed_web); + $(this).attr('href', '#dropdown-' + feed_id).prev('.dropdown-target').attr('id', 'dropdown-' + feed_id).parent().append(template); + } + }); +} + +$(function () { if(is_reader_mode()) { hide_posts = false; } @@ -412,4 +423,5 @@ $(document).ready (function () { init_shortcuts (); init_stream_delegates($('#stream')); init_nav_entries(); + init_templates(); }); -- cgit v1.2.3