Merge branch 'unstable' into testing

This commit is contained in:
opi 2016-05-06 19:54:24 +02:00
commit f9370f5d04
7 changed files with 66 additions and 9 deletions

View file

@ -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 **/

View file

@ -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());
}
});
});
});
});

View file

@ -199,6 +199,9 @@
store.set('slide', 'to');
}
});
// Paste <pre> helper
c.prePaste();
// Run callback
callback();
// Force scrollTop on page load
$('html, body').scrollTop(0);
@ -236,6 +239,9 @@
}
} else {
rendered.swap(function(){
// Paste <pre> helper
c.prePaste();
// Run callback
callback();
// Force scrollTop on page load
$('html, body').scrollTop(0);
@ -373,6 +379,35 @@
return data;
},
// Paste <pre>
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('<div class="loader loader-content"></div>');
// 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();
});
});
}
});
})();

View file

@ -22,7 +22,8 @@
<div class="panel-body">
{{#logs}}
<h3>{{file_name}}</h3>
<pre class="service-log">{{file_content}}</pre>
<pre id="service-log-{{ @index }}" class="service-log">{{file_content}}</pre>
<button data-paste-content="#service-log-{{ @index }}"><i class="fa-cloud-upload"></i> {{t 'upload'}}</button>
{{/logs}}
</div>
</div>

View file

@ -10,8 +10,9 @@
<div class="container">
{{#logs}}
<h2>{{filename}}</h2>
<pre class="service-log">
<pre id="log" class="service-log">
{{filecontent}}
</pre>
<button data-paste-content="#log"><i class="fa-cloud-upload"></i> {{t 'upload'}}</button>
{{/logs}}
</div>

View file

@ -14,11 +14,12 @@
<h2 class="panel-title"><span class="fa-fw fa-stethoscope"></span> {{t 'diagnosis'}}</h2>
</div>
<div class="panel-body">
<pre>{{ diagnosis }}</pre>
<pre id="diagnosis">{{ diagnosis }}</pre>
{{#if private}}
<a class="btn btn-primary" href="#/tools/diagnosis">{{t 'diagnosis_hide_private'}}</a>
<a class="btn btn-primary" href="#/tools/diagnosis"><i class="fa-eye-slash"></i> {{t 'diagnosis_hide_private'}}</a>
{{else}}
<a class="btn btn-primary" href="#/tools/diagnosis/private">{{t 'diagnosis_view_private'}}</a>
<a class="btn btn-primary" href="#/tools/diagnosis/private"><i class="fa-eye"></i> {{t 'diagnosis_view_private'}}</a>
{{/if}}
<button data-paste-content="#diagnosis"><i class="fa-cloud-upload"></i> {{t 'upload'}}</button>
</div>
</div>

View file

@ -7,11 +7,12 @@
<div class="separator"></div>
{{#if logs}}
<pre class="upgrade-log log">
<pre id="upgrade-log" class="upgrade-log log">
{{#logs}}
{{.}}
{{/logs}}
</pre>
<button data-paste-content="#upgrade-log"><i class="fa-cloud-upload"></i> {{t 'upload'}}</button>
{{else}}
{{t 'no_log'}}
{{/if}}