From a3d410776dcaf84ab2a0cb22eebb6e75a3251033 Mon Sep 17 00:00:00 2001
From: ulrich <not disclosed>
Date: Sat, 25 Feb 2017 17:18:59 +0000
Subject: [PATCH] Mustache Templates ausgelagert (noch in Arbeit)

---
 web/ui/ui.js |  115 ++++++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 77 insertions(+), 38 deletions(-)

diff --git a/web/ui/ui.js b/web/ui/ui.js
index 0547019..9f66ee4 100644
--- a/web/ui/ui.js
+++ b/web/ui/ui.js
@@ -301,20 +301,20 @@
 function fm_render_list(fl) {
   if(modus == 'kacheln') {
     // Kachelansicht
-    var template = $('#tpl-kacheln').html();
-    Mustache.parse(template);   // optional, speeds up future uses
+    $.get('tpl-kacheln.txt', function(template) {
+      $('#dateien').empty();
+      $('#dateien').html(Mustache.render(template, fl));
+      $('.figure').click(fm_dateiwahl);
+    });
     $('.datei-zeile').attr('onclick','').unbind('click');
-    $('#dateien').empty();
-    $('#dateien').html(Mustache.render(template, fl));
-    $('.figure').click(fm_dateiwahl);
   } else {
     // Listenansicht
-    var template = $('#tpl-liste').html();
-    Mustache.parse(template);   // optional, speeds up future uses
+    $.get('tpl-liste.txt', function(template) {
+      $('#dateien').empty();
+      $('#dateien').html(Mustache.render(template, fl));
+      $('.datei-zeile').click(fm_dateiwahl);
+    });
     $('.figure').attr('onclick','').unbind('click');
-    $('#dateien').empty();
-    $('#dateien').html(Mustache.render(template, fl));
-    $('.datei-zeile').click(fm_dateiwahl);
   }
 }
 
@@ -341,7 +341,7 @@
     }
     
     // Breadcrumb-Ansicht
-    var template;
+    //var template;
     $('.breadcrumb-item').attr('onclick','').unbind('click');
     $('#bcnav').empty();
     var dirList = new Array();
@@ -362,35 +362,74 @@
       }
       var bl = new BcrFiles(dirList);
 
-      if(dirList.length > 0) {
-        template = $('#tpl-bcr').html();
-        Mustache.parse(template);   // optional, speeds up future uses
-        $('#bcnav').html(Mustache.render(template, bl));
-      }
-      
-      if(dirs.length > 0) {
-        dirList.push(new BcrFile(rp + '/' + dirs[dirs.length-1], dirs[dirs.length-1]));
-        template = $('#tpl-bcr2').html();
-        Mustache.parse(template);   // optional, speeds up future uses
-        $('#bcnav').append(Mustache.render(template, dirList[dirList.length-1]));        
+      if(dirList.length > 0) {        
+        $.get('tpl-bcr.txt', function(template) {
+          $('#bcnav').html(Mustache.render(template, bl));
+          if(dirs.length > 0) {
+            dirList.push(new BcrFile(rp + '/' + dirs[dirs.length-1], dirs[dirs.length-1]));
+            $.get('tpl-bcr2.txt', function(template) {
+              $('#bcnav').append(Mustache.render(template, dirList[dirList.length-1]));  
+              $('#bcnav').append($('#tpl-bcr3').html());
+              fm_bcr_end();
+            });
+            //template = $('#tpl-bcr2').html();
+            //Mustache.parse(template);   // optional, speeds up future uses
+            //$('#bcnav').append(Mustache.render(template, dirList[dirList.length-1]));        
+          } else {
+            $.get('tpl-bcr2.txt', function(template) {
+              $('#bcnav').append(Mustache.render(template, dirList[0]));
+              $('#bcnav').append($('#tpl-bcr3').html());
+              fm_bcr_end();
+        });
+            //template = $('#tpl-bcr2').html();
+            //Mustache.parse(template);   // optional, speeds up future uses
+            //$('#bcnav').append(Mustache.render(template, dirList[0]));        
+          }
+        });
       } else {
-        template = $('#tpl-bcr2').html();
-        Mustache.parse(template);   // optional, speeds up future uses
-        $('#bcnav').append(Mustache.render(template, dirList[0]));        
+        if(dirs.length > 0) {
+          dirList.push(new BcrFile(rp + '/' + dirs[dirs.length-1], dirs[dirs.length-1]));
+          $.get('tpl-bcr2.txt', function(template) {
+            $('#bcnav').append(Mustache.render(template, dirList[dirList.length-1]));  
+            $('#bcnav').append($('#tpl-bcr3').html());
+            fm_bcr_end();
+          });
+          //template = $('#tpl-bcr2').html();
+          //Mustache.parse(template);   // optional, speeds up future uses
+          //$('#bcnav').append(Mustache.render(template, dirList[dirList.length-1]));        
+        } else {
+          $.get('tpl-bcr2.txt', function(template) {
+            $('#bcnav').append(Mustache.render(template, dirList[0]));
+            $('#bcnav').append($('#tpl-bcr3').html());
+            fm_bcr_end();
+          });
+          //template = $('#tpl-bcr2').html();
+          //Mustache.parse(template);   // optional, speeds up future uses
+          //$('#bcnav').append(Mustache.render(template, dirList[0]));        
+        }
       }
-      
-      $('#bcnav').append($('#tpl-bcr3').html());
     } else {
       pfad = '';
-      template = $('#tpl-bcr2').html();
-      Mustache.parse(template);   // optional, speeds up future uses
-      $('#bcnav').append(Mustache.render(template, dirList[0]));   
-      $('#bcnav').append($('#tpl-bcr3').html());
+      $.get('tpl-bcr2.txt', function(template) {
+        $('#bcnav').append(Mustache.render(template, dirList[0]));
+        $('#bcnav').append($('#tpl-bcr3').html());
+        fm_bcr_end();
+      });
+      //template = $('#tpl-bcr2').html();
+      //Mustache.parse(template);   // optional, speeds up future uses
+      //$('#bcnav').append(Mustache.render(template, dirList[0]));   
+      //$('#bcnav').append($('#tpl-bcr3').html());
     }
-    $('.breadcrumb-item').click(fm_bc_click);
-    $('#ansicht').click(fm_ansicht_umschalten);
-    fm_set_modus();
+    //$('.breadcrumb-item').click(fm_bc_click);
+    //$('#ansicht').click(fm_ansicht_umschalten);
+    //fm_set_modus();
   });  
+}
+
+function fm_bcr_end() {
+  $('.breadcrumb-item').click(fm_bc_click);
+  $('#ansicht').click(fm_ansicht_umschalten);
+  fm_set_modus();
 }
 
 function fm_menu_datei_speichern() {
@@ -523,15 +562,15 @@
   this.typeClass = function() {
     if(modus == 'kacheln') {
       if(self.fr.isDirectory) {
-        return 'fa-folder';
+        return 'fa-folder ordner';
       } else {
-        return 'fa-file';
+        return 'fa-file datei';
       }
     } else {
       if(self.fr.isDirectory) {
-        return 'fa-folder';
+        return 'fa-folder ordner';
       } else {
-        return 'fa-file-o';
+        return 'fa-file-o datei';
       }
     }
   };

--
Gitblit v1.9.3