From 93243f432ff5b049284873fde6144b3187cc0e6d Mon Sep 17 00:00:00 2001 From: opi Date: Fri, 6 May 2016 17:17:09 +0200 Subject: [PATCH 1/4] [enh][ux] Prefill email field value with username if empty. --- src/js/yunohost/controllers/users.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/js/yunohost/controllers/users.js b/src/js/yunohost/controllers/users.js index cbc4999d..8b029eba 100644 --- a/src/js/yunohost/controllers/users.js +++ b/src/js/yunohost/controllers/users.js @@ -23,8 +23,15 @@ // Password min length data.password_min_length = PASSWORD_MIN_LENGTH; - - c.view('user/user_create', data); + c.view('user/user_create', data, function(){ + var usernameField = $('#username'); + usernameField.on('blur', function(){ + var emailField = $('#email'); + if (emailField.val() == '') { + emailField.val(usernameField.val()); + } + }); + }); }); }); From 34d775be735c08b04cf42add375986832e4f1128 Mon Sep 17 00:00:00 2001 From: opi Date: Fri, 6 May 2016 18:50:12 +0200 Subject: [PATCH 2/4] [enh] Implements 'paste online' helper. --- src/css/style.less | 13 ++++++++++++- src/js/yunohost/helpers.js | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/src/css/style.less b/src/css/style.less index 0ccaf589..e85f117e 100644 --- a/src/css/style.less +++ b/src/css/style.less @@ -80,8 +80,11 @@ body { } } +.btn { + & + .btn {margin-left: 8px;} +} button { - &:extend(.btn); + &:extend(.btn all); } .block { @@ -404,6 +407,14 @@ label .list-group-item-text { font-weight:normal; } +/* Paste buttons */ +button[data-paste-content] { + &:extend(.btn all); + &:extend(.btn-default all); + & + pre { + margin-top: 10px; + } +} /** Breadcrumb **/ diff --git a/src/js/yunohost/helpers.js b/src/js/yunohost/helpers.js index bee3b9e2..a6c5cb8d 100644 --- a/src/js/yunohost/helpers.js +++ b/src/js/yunohost/helpers.js @@ -199,6 +199,9 @@ store.set('slide', 'to'); } }); + // Paste
 helper
+                        c.prePaste();
+                        // Run callback
                         callback();
                         // Force scrollTop on page load
                         $('html, body').scrollTop(0);
@@ -236,6 +239,9 @@
                 }
             } else {
                 rendered.swap(function(){
+                    // Paste 
 helper
+                    c.prePaste();
+                    // Run callback
                     callback();
                     // Force scrollTop on page load
                     $('html, body').scrollTop(0);
@@ -373,6 +379,35 @@
 
             return data;
         },
+
+        // Paste 
+        prePaste: function() {
+            var pasteButtons = $('button[data-paste-content]');
+            pasteButtons.on('click', function(){
+                // Get paste content element
+                var preElement = $($(this).data('paste-content'));
+
+                // Add pacman loader
+                $('#main').append('
'); + + // Send to paste.yunohost.org + $.ajax({ + type: "POST", + url: 'https://paste.yunohost.org/documents', + data: preElement[0].innerHTML, + }) + .success(function(data, textStatus, jqXHR) { + window.open('https://paste.yunohost.org/' + data.key, '_blank'); + }) + .fail(function() { + c.flash('fail', y18n.t('paste_error')); + }) + .always(function(){ + // Remove pacman + $('div.loader').remove(); + }); + }); + } }); })(); From aecd90cf6d70b34b8569e3f0e53c1de33c89a2ba Mon Sep 17 00:00:00 2001 From: opi Date: Fri, 6 May 2016 19:16:58 +0200 Subject: [PATCH 3/4] [enh] Use paste button on every log section. --- src/views/app/app_debug.ms | 3 ++- src/views/service/service_log.ms | 3 ++- src/views/tools/tools_diagnosis.ms | 3 ++- src/views/upgrade/upgrade.ms | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/views/app/app_debug.ms b/src/views/app/app_debug.ms index 2e68d6ca..d233f1be 100644 --- a/src/views/app/app_debug.ms +++ b/src/views/app/app_debug.ms @@ -22,7 +22,8 @@
{{#logs}}

{{file_name}}

-
{{file_content}}
+
{{file_content}}
+ {{/logs}}
diff --git a/src/views/service/service_log.ms b/src/views/service/service_log.ms index cc9d46e7..0a03601d 100644 --- a/src/views/service/service_log.ms +++ b/src/views/service/service_log.ms @@ -10,8 +10,9 @@
{{#logs}}

{{filename}}

-
+        
         {{filecontent}}
         
+ {{/logs}}
diff --git a/src/views/tools/tools_diagnosis.ms b/src/views/tools/tools_diagnosis.ms index 6a2db2da..32f75dbc 100644 --- a/src/views/tools/tools_diagnosis.ms +++ b/src/views/tools/tools_diagnosis.ms @@ -14,11 +14,12 @@

{{t 'diagnosis'}}

-
{{ diagnosis }}
+
{{ diagnosis }}
{{#if private}} {{t 'diagnosis_hide_private'}} {{else}} {{t 'diagnosis_view_private'}} {{/if}} +
diff --git a/src/views/upgrade/upgrade.ms b/src/views/upgrade/upgrade.ms index f5a9336b..cf8d087f 100644 --- a/src/views/upgrade/upgrade.ms +++ b/src/views/upgrade/upgrade.ms @@ -7,11 +7,12 @@
{{#if logs}} -
+
 {{#logs}}
     {{.}}
 {{/logs}}
 
+ {{else}} {{t 'no_log'}} {{/if}} From eb53cca9a82eac1cde4a6a8c0df59303cd00b6d7 Mon Sep 17 00:00:00 2001 From: opi Date: Fri, 6 May 2016 19:20:47 +0200 Subject: [PATCH 4/4] [enh] Add icon for diagnosis toggle button. --- src/views/tools/tools_diagnosis.ms | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/tools/tools_diagnosis.ms b/src/views/tools/tools_diagnosis.ms index 32f75dbc..2105a134 100644 --- a/src/views/tools/tools_diagnosis.ms +++ b/src/views/tools/tools_diagnosis.ms @@ -16,9 +16,9 @@