From 03e979f334d95dd04704c8167a8f2ab8a8c67175 Mon Sep 17 00:00:00 2001 From: Lars-Magnus Skog Date: Sat, 14 May 2016 23:22:41 +0200 Subject: [PATCH 1/9] simplify install and build --- README.md | 25 +++++++------------------ src/package.json | 5 +++++ 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index a661bdeb..b1d10dae 100644 --- a/README.md +++ b/README.md @@ -5,41 +5,30 @@ JS client for YunoHost API **Please report issues here** (no registration needed): https://dev.yunohost.org/projects/yunohost/issues - ## Installation -This client is a part of the YunoHost projet, and can not be installed -directly. Please visit [YunoHost website](https://yunohost.org) for -more information. +This client is a part of the YunoHost projet, and can not be installed directly. Please visit [YunoHost website](https://yunohost.org) for more information. ## Contributing Feel free to improve the plugin and send us a pull request. -We use gulp to compile Less files and minify the JavaScript. -Assuming [nodejs](http://nodejs.org/) is installed, you can run a -build with: +We use `gulp` to compile Less files and minify the JavaScript. Assuming [nodejs](http://nodejs.org/) is installed, you can install dependencies and run a build with: ```sh cd src -npm install -npm install -g bower -bower install -npm install -g gulp -gulp build +npm i +npm run build ``` -Alternatively you can pas the `--dev` option to gulp which improve building -speed by bypassing compression tasks. -On a YunoHost instance, the web admin files are located at -`/usr/share/yunohost/admin`. +Alternatively you can run `npm run build-dev` which improves building speed by bypassing compression tasks. + +On a YunoHost instance, the web admin files are located at `/usr/share/yunohost/admin`. **Note:** The `.ms` - moustache - files are cached by the browser. You have to reach them manually some times you modify them. (e.g. go to https://example.com/yunohost/admin/views/domain/domain_list.ms) - - ## Dependencies * Bootstrap 3.3.6 diff --git a/src/package.json b/src/package.json index cdd430d1..a546a0ec 100644 --- a/src/package.json +++ b/src/package.json @@ -5,6 +5,11 @@ "type": "git", "url": "https://github.com/YunoHost/yunohost-admin" }, + "scripts": { + "postinstall": "bower install", + "build": "gulp build", + "build-dev": "gulp build --dev" + }, "author": "Yunohost", "license": "AGPL-3.0", "bugs": { From 604a76759d181b041aa2cc82761f2d033fd23511 Mon Sep 17 00:00:00 2001 From: opi Date: Mon, 23 May 2016 20:55:25 +0200 Subject: [PATCH 2/9] [fix] Remove useless 'move' CSS class. --- src/css/style.less | 5 +---- src/js/yunohost/helpers.js | 8 ++++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/css/style.less b/src/css/style.less index 4b42407d..8d6f692f 100644 --- a/src/css/style.less +++ b/src/css/style.less @@ -96,10 +96,6 @@ button { padding: 5px; } -.move { - transition: margin-left 0.2s ease-in-out; -} - .placehold { font-size: 0.0001em; color: transparent; @@ -196,6 +192,7 @@ button { width: 200%; height: 100%; min-height: 150px; + transition: margin-left 0.15s ease-in-out; } #slideBack, #slideTo, #main { diff --git a/src/js/yunohost/helpers.js b/src/js/yunohost/helpers.js index 4b10707f..0dd1046a 100644 --- a/src/js/yunohost/helpers.js +++ b/src/js/yunohost/helpers.js @@ -221,19 +221,19 @@ if (store.get('slide') == 'back') { store.clear('slide'); $('#slideBack').css('display', 'none'); - $('#slider-container').removeClass('move').css('margin-left', '-100%'); + $('#slider-container').css('margin-left', '-100%'); $('#slideTo').show().html($('#main').html()); leSwap(); - $('#slider-container').addClass('move').css('margin-left', '0px'); + $('#slider-container').css('margin-left', '0px'); // Slide to effect } else if (store.get('slide') == 'to') { store.clear('slide'); $('#slideTo').css('display', 'none'); - $('#slider-container').removeClass('move').css('margin-left', '0px'); + $('#slider-container').css('margin-left', '0px'); $('#slideBack').show().html($('#main').html()); leSwap(); - $('#slider-container').addClass('move').css('margin-left', '-100%'); + $('#slider-container').css('margin-left', '-100%'); } else { leSwap(); From 48b8a536df1d68661c55ad3a35caf0f5844b0c28 Mon Sep 17 00:00:00 2001 From: opi Date: Mon, 23 May 2016 21:05:36 +0200 Subject: [PATCH 3/9] [fix] Prevent empty space before footer. --- src/css/style.less | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/css/style.less b/src/css/style.less index 8d6f692f..a8e096b3 100644 --- a/src/css/style.less +++ b/src/css/style.less @@ -199,6 +199,11 @@ button { .block; } +#slideTo, #slideBack { + // Force left & right pane height to 1px (prevent empty space before footer). + height: 1px; +} + /* * The main part of the app * From da9aa7d8c975b2010ac4cfd5f4d6b6b158621c2a Mon Sep 17 00:00:00 2001 From: opi Date: Mon, 23 May 2016 21:08:06 +0200 Subject: [PATCH 4/9] [fix] No need to resize body on every content update. --- src/js/yunohost/helpers.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/js/yunohost/helpers.js b/src/js/yunohost/helpers.js index 0dd1046a..e7a2f38a 100644 --- a/src/js/yunohost/helpers.js +++ b/src/js/yunohost/helpers.js @@ -206,12 +206,6 @@ callback(); // Force scrollTop on page load $('html, body').scrollTop(0); - - // Resize body after the animation finishes (0.2s css transition) - // https://github.com/YunoHost/yunohost-admin/blob/231aac076a3aa836409b0d33fe02e48975990b7a/src/css/style.less#L92 - setTimeout(function() { - $('body').resize(); - }, 210); }); }; @@ -246,7 +240,6 @@ callback(); // Force scrollTop on page load $('html, body').scrollTop(0); - $('body').resize(); }); } }, From 35146cbd419b1d31450bebe3457400a67e9eca86 Mon Sep 17 00:00:00 2001 From: opi Date: Mon, 23 May 2016 21:15:06 +0200 Subject: [PATCH 5/9] [enh] Cleanup app view() helper. --- src/js/yunohost/helpers.js | 75 +++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 38 deletions(-) diff --git a/src/js/yunohost/helpers.js b/src/js/yunohost/helpers.js index e7a2f38a..b4279360 100644 --- a/src/js/yunohost/helpers.js +++ b/src/js/yunohost/helpers.js @@ -180,18 +180,24 @@ view: function (view, data, callback, enableSlide) { c = this; + // Default callback = typeof callback !== 'undefined' ? callback : function() {}; - rendered = this.render('views/'+ view +'.ms', data); - enableSlide = (typeof enableSlide !== 'undefined') ? enableSlide : true; // Change to false to disable animation loaded = true; + + // Hide loader and modal $('div.loader').remove(); $('#modal').modal('hide'); - if (enableSlide) { - var leSwap = function() { - rendered.swap(function() { + // Render content + rendered = this.render('views/'+ view +'.ms', data); + + // Update content helper + var leSwap = function() { + rendered.swap(function() { + // Slide direction + if (enableSlide) { $('.slide, .btn-breadcrumb a:not(:last-child)').on('click', function() { $(this).addClass('active'); if ($(this).hasClass('back') || $(this).parent('.btn-breadcrumb').length) { @@ -200,47 +206,40 @@ store.set('slide', 'to'); } }); - // Paste
 helper
-                        c.prePaste();
-                        // Run callback
-                        callback();
-                        // Force scrollTop on page load
-                        $('html, body').scrollTop(0);
-                    });
-                };
+                    }
 
-                blockSize = $('#slider').width();
-
-                // Slide back effect
-                if (store.get('slide') == 'back') {
-                    store.clear('slide');
-                    $('#slideBack').css('display', 'none');
-                    $('#slider-container').css('margin-left', '-100%');
-                    $('#slideTo').show().html($('#main').html());
-                    leSwap();
-                    $('#slider-container').css('margin-left', '0px');
-
-                // Slide to effect
-                } else if (store.get('slide') == 'to') {
-                    store.clear('slide');
-                    $('#slideTo').css('display', 'none');
-                    $('#slider-container').css('margin-left', '0px');
-                    $('#slideBack').show().html($('#main').html());
-                    leSwap();
-                    $('#slider-container').css('margin-left', '-100%');
-
-                } else {
-                    leSwap();
-                }
-            } else {
-                rendered.swap(function(){
                     // Paste 
 helper
                     c.prePaste();
+
                     // Run callback
                     callback();
+
                     // Force scrollTop on page load
                     $('html, body').scrollTop(0);
                 });
+            };
+
+            // Slide back effect
+            if (enableSlide && store.get('slide') == 'back') {
+                store.clear('slide');
+                $('#slideBack').css('display', 'none');
+                $('#slider-container').css('margin-left', '-100%');
+                $('#slideTo').show().html($('#main').html());
+                leSwap();
+                $('#slider-container').css('margin-left', '0px');
+            }
+            // Slide to effect
+            else if (enableSlide && store.get('slide') == 'to') {
+                store.clear('slide');
+                $('#slideTo').css('display', 'none');
+                $('#slider-container').css('margin-left', '0px');
+                $('#slideBack').show().html($('#main').html());
+                leSwap();
+                $('#slider-container').css('margin-left', '-100%');
+            }
+            // No slideing effect
+            else {
+                leSwap();
             }
         },
 

From c6aac064dae53feb88e98e82881c080865c2f3f6 Mon Sep 17 00:00:00 2001
From: opi 
Date: Thu, 21 Jul 2016 12:09:47 +0200
Subject: [PATCH 6/9] [enh] Add 'watch' npm script.

---
 src/package.json | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/package.json b/src/package.json
index a546a0ec..e233a204 100644
--- a/src/package.json
+++ b/src/package.json
@@ -8,7 +8,9 @@
   "scripts": {
     "postinstall": "bower install",
     "build": "gulp build",
-    "build-dev": "gulp build --dev"
+    "build-dev": "gulp build --dev",
+    "watch": "gulp watch",
+    "watch-dev": "gulp watch --dev"
   },
   "author": "Yunohost",
   "license": "AGPL-3.0",

From c8e3a9828405c1cdc8567872514103e7478f7d1d Mon Sep 17 00:00:00 2001
From: opi 
Date: Thu, 21 Jul 2016 12:12:44 +0200
Subject: [PATCH 7/9] [enh] Be more explicit on npm command.

---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index b1d10dae..067ec70a 100644
--- a/README.md
+++ b/README.md
@@ -17,7 +17,7 @@ We use `gulp` to compile Less files and minify the JavaScript. Assuming [nodejs]
 
 ```sh
 cd src
-npm i
+npm install
 npm run build
 ```
 

From 3d1d5c302fd112e810cc345b4e28bb457ef2a9d5 Mon Sep 17 00:00:00 2001
From: opi 
Date: Mon, 23 May 2016 20:50:53 +0200
Subject: [PATCH 8/9] [enh] Display YNH version in footer. Need body padding
 improvments. #316

---
 src/css/style.less      | 20 ++++++++++++++++++++
 src/index.html          |  4 ++++
 src/js/yunohost/main.js |  5 +++++
 src/locales/en.json     |  1 +
 4 files changed, 30 insertions(+)

diff --git a/src/css/style.less b/src/css/style.less
index a8e096b3..9e1a1300 100644
--- a/src/css/style.less
+++ b/src/css/style.less
@@ -217,6 +217,26 @@ button {
 }
 
 
+/*
+ * Page footer
+ *
+ */
+.page-footer {
+    .clearfix;
+    .make-row(12);
+    margin: 20px 0;
+    padding-top: 20px;
+    border-top: 1px solid #eee;
+    color: #999;
+    font-size: 0.9em;
+    text-align: right;
+    a {
+        color: #666;
+        &:hover,
+        &:focus {text-decoration: underline;}
+    }
+}
+
 /*
  * The pop up dialog
  *
diff --git a/src/index.html b/src/index.html
index e2be525e..c7c3b4d3 100644
--- a/src/index.html
+++ b/src/index.html
@@ -54,6 +54,10 @@
             
 
         
+
+        
+

+