aboutsummaryrefslogtreecommitdiff
path: root/app/views/javascript
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2013-10-12 15:35:56 +0200
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2013-10-12 15:35:56 +0200
commit39f2213e92040d2a8bffc3084f30d868fa7b8882 (patch)
tree220c3bdb8b634e20f8c88a5e1f95536bef941e45 /app/views/javascript
parentaa71754eeea171cbc37e49eee5eba0f2d4183693 (diff)
aside_flux: Modèle dynamique pour les menus
Utilise un modèle plutôt que le menu HTML répété en dur, pour beaucoup diminuer la taille de la page HTML
Diffstat (limited to 'app/views/javascript')
-rw-r--r--app/views/javascript/main.phtml14
1 files changed, 13 insertions, 1 deletions
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();
});