Browse Source

Merge pull request #3166 from RaananW/viewer-small-changes

Modifications and further size improvements
Raanan Weber 7 years ago
parent
commit
cc16d776d7

BIN
Viewer/assets/img/close.png


BIN
Viewer/assets/img/fullscreen.png


BIN
Viewer/assets/img/help-circle.png


BIN
Viewer/assets/img/loading.png


+ 2 - 2
Viewer/assets/templates/default/navbar.html

@@ -102,11 +102,11 @@
 </div>
 </div>
 <div class="button-container flex-container">
 <div class="button-container flex-container">
     <!-- holding the buttons -->
     <!-- holding the buttons -->
-    {{#each buttons}}
+    {{#eachInMap buttons}}
     <div id="{{id}}" class="button">
     <div id="{{id}}" class="button">
         {{#if text}}
         {{#if text}}
         <span>{{text}}</span>> {{/if}} {{#if image}}
         <span>{{text}}</span>> {{/if}} {{#if image}}
         <img src="{{image}}" alt="{{altText}}"> {{/if}}
         <img src="{{image}}" alt="{{altText}}"> {{/if}}
     </div>
     </div>
-    {{/each}}
+    {{/eachInMap}}
 </div>
 </div>

File diff suppressed because it is too large
+ 26 - 13
Viewer/dist/viewer.js


File diff suppressed because it is too large
+ 2 - 2
Viewer/dist/viewer.min.js


File diff suppressed because it is too large
+ 8 - 12
Viewer/src/configuration/types/default.ts


+ 14 - 0
Viewer/src/templateManager.ts

@@ -144,6 +144,20 @@ export class TemplateManager {
 
 
 
 
 import * as Handlebars from 'handlebars/dist/handlebars.min.js';
 import * as Handlebars from 'handlebars/dist/handlebars.min.js';
+// register a new helper. modified https://stackoverflow.com/questions/9838925/is-there-any-method-to-iterate-a-map-with-handlebars-js
+Handlebars.registerHelper('eachInMap', function (map, block) {
+    var out = '';
+    Object.keys(map).map(function (prop) {
+        let data = map[prop];
+        if (typeof data === 'object') {
+            data.id = data.id || prop;
+            out += block.fn(data);
+        } else {
+            out += block.fn({ id: prop, value: data });
+        }
+    });
+    return out;
+});
 
 
 export class Template {
 export class Template {
 
 

+ 4 - 1
Viewer/webpack.config.js

@@ -37,7 +37,10 @@ module.exports = {
         {
         {
             test: /\.(html)$/,
             test: /\.(html)$/,
             use: {
             use: {
-                loader: 'html-loader'
+                loader: 'html-loader',
+                options: {
+                    minimize: true
+                }
             }
             }
         },
         },
         {
         {