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 { button {
&:extend(.btn); &:extend(.btn all);
} }
.block { .block {
@ -404,6 +407,14 @@ label .list-group-item-text {
font-weight:normal; font-weight:normal;
} }
/* Paste buttons */
button[data-paste-content] {
&:extend(.btn all);
&:extend(.btn-default all);
& + pre {
margin-top: 10px;
}
}
/** Breadcrumb **/ /** Breadcrumb **/

View file

@ -23,8 +23,15 @@
// Password min length // Password min length
data.password_min_length = PASSWORD_MIN_LENGTH; data.password_min_length = PASSWORD_MIN_LENGTH;
c.view('user/user_create', data, function(){
c.view('user/user_create', data); 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'); store.set('slide', 'to');
} }
}); });
// Paste <pre> helper
c.prePaste();
// Run callback
callback(); callback();
// Force scrollTop on page load // Force scrollTop on page load
$('html, body').scrollTop(0); $('html, body').scrollTop(0);
@ -236,6 +239,9 @@
} }
} else { } else {
rendered.swap(function(){ rendered.swap(function(){
// Paste <pre> helper
c.prePaste();
// Run callback
callback(); callback();
// Force scrollTop on page load // Force scrollTop on page load
$('html, body').scrollTop(0); $('html, body').scrollTop(0);
@ -373,6 +379,35 @@
return data; 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"> <div class="panel-body">
{{#logs}} {{#logs}}
<h3>{{file_name}}</h3> <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}} {{/logs}}
</div> </div>
</div> </div>

View file

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

View file

@ -14,11 +14,12 @@
<h2 class="panel-title"><span class="fa-fw fa-stethoscope"></span> {{t 'diagnosis'}}</h2> <h2 class="panel-title"><span class="fa-fw fa-stethoscope"></span> {{t 'diagnosis'}}</h2>
</div> </div>
<div class="panel-body"> <div class="panel-body">
<pre>{{ diagnosis }}</pre> <pre id="diagnosis">{{ diagnosis }}</pre>
{{#if private}} {{#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}} {{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}} {{/if}}
<button data-paste-content="#diagnosis"><i class="fa-cloud-upload"></i> {{t 'upload'}}</button>
</div> </div>
</div> </div>

View file

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