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/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()); + } + }); + }); }); }); 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(); + }); + }); + } }); })(); 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..2105a134 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'}} + {{t 'diagnosis_hide_private'}} {{else}} - {{t 'diagnosis_view_private'}} + {{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}}