mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
Merge 0ed417b85e
into 9f0d85cb6c
This commit is contained in:
commit
4d31a1d1b8
8 changed files with 99 additions and 71 deletions
23
README.md
23
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 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
|
||||
|
|
|
@ -96,10 +96,6 @@ button {
|
|||
padding: 5px;
|
||||
}
|
||||
|
||||
.move {
|
||||
transition: margin-left 0.2s ease-in-out;
|
||||
}
|
||||
|
||||
.placehold {
|
||||
font-size: 0.0001em;
|
||||
color: transparent;
|
||||
|
@ -196,12 +192,18 @@ button {
|
|||
width: 200%;
|
||||
height: 100%;
|
||||
min-height: 150px;
|
||||
transition: margin-left 0.15s ease-in-out;
|
||||
}
|
||||
|
||||
#slideBack, #slideTo, #main {
|
||||
.block;
|
||||
}
|
||||
|
||||
#slideTo, #slideBack {
|
||||
// Force left & right pane height to 1px (prevent empty space before footer).
|
||||
height: 1px;
|
||||
}
|
||||
|
||||
/*
|
||||
* The main part of the app
|
||||
*
|
||||
|
@ -215,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
|
||||
*
|
||||
|
|
|
@ -54,6 +54,10 @@
|
|||
<div id="slideTo" style="display: none; z-index: 100;"></div>
|
||||
|
||||
</div><!--/#slider-container-->
|
||||
|
||||
<footer class="page-footer">
|
||||
<p id="yunohost-version"></p>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<div id="modal" tabindex="-1" role="dialog" aria-labelledby="modalLabel" aria-hidden="true">
|
||||
|
|
|
@ -103,14 +103,22 @@
|
|||
|
||||
// Input with choices becomes select list
|
||||
if (typeof data.manifest.arguments.install[k].choices !== 'undefined') {
|
||||
// Update choices values with key and checked data
|
||||
// Update choices values with key and checked data
|
||||
var choices = []
|
||||
$.each(data.manifest.arguments.install[k].choices, function(ck, cv){
|
||||
data.manifest.arguments.install[k].choices[ck] = {
|
||||
value: cv,
|
||||
// Non key/value choices have numeric key, that we don't want.
|
||||
if (typeof ck == "number") {
|
||||
// Key is Value in this case.
|
||||
ck = cv;
|
||||
}
|
||||
|
||||
choices.push({
|
||||
value: ck,
|
||||
label: cv,
|
||||
selected: (cv == data.manifest.arguments.install[k].default) ? true : false,
|
||||
};
|
||||
selected: (ck == data.manifest.arguments.install[k].default) ? true : false,
|
||||
});
|
||||
});
|
||||
data.manifest.arguments.install[k].choices = choices;
|
||||
}
|
||||
|
||||
// Special case for domain input.
|
||||
|
|
|
@ -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,54 +206,40 @@
|
|||
store.set('slide', 'to');
|
||||
}
|
||||
});
|
||||
// Paste <pre> helper
|
||||
c.prePaste();
|
||||
// Run callback
|
||||
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);
|
||||
});
|
||||
};
|
||||
|
||||
blockSize = $('#slider').width();
|
||||
|
||||
// Slide back effect
|
||||
if (store.get('slide') == 'back') {
|
||||
store.clear('slide');
|
||||
$('#slideBack').css('display', 'none');
|
||||
$('#slider-container').removeClass('move').css('margin-left', '-100%');
|
||||
$('#slideTo').show().html($('#main').html());
|
||||
leSwap();
|
||||
$('#slider-container').addClass('move').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');
|
||||
$('#slideBack').show().html($('#main').html());
|
||||
leSwap();
|
||||
$('#slider-container').addClass('move').css('margin-left', '-100%');
|
||||
|
||||
} else {
|
||||
leSwap();
|
||||
}
|
||||
} else {
|
||||
rendered.swap(function(){
|
||||
// Paste <pre> helper
|
||||
c.prePaste();
|
||||
|
||||
// Run callback
|
||||
callback();
|
||||
|
||||
// Force scrollTop on page load
|
||||
$('html, body').scrollTop(0);
|
||||
$('body').resize();
|
||||
});
|
||||
};
|
||||
|
||||
// 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();
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -70,6 +70,11 @@
|
|||
// Store url
|
||||
sam.store.set('url', window.location.hostname + '/yunohost/api');
|
||||
|
||||
// Get YunoHost version
|
||||
this.api('/version', function(versions) {
|
||||
$('#yunohost-version').html(y18n.t('footer_version', [versions.yunohost]));
|
||||
});
|
||||
|
||||
// Flash messages
|
||||
var flashMessage = $('#flashMessage');
|
||||
$('#toggle-btn', flashMessage).click(function(e) {
|
||||
|
|
|
@ -120,6 +120,7 @@
|
|||
"everyone_has_access": "Everyone has access.",
|
||||
"filesystem": "Filesystem",
|
||||
"firewall": "Firewall",
|
||||
"footer_version" : "Powered by <a href='https://yunohost.org'>YunoHost</a> %s.",
|
||||
"form_input_example" : "Example: %s",
|
||||
"free": "Free",
|
||||
"fs_type": "FS Type",
|
||||
|
|
|
@ -5,6 +5,13 @@
|
|||
"type": "git",
|
||||
"url": "https://github.com/YunoHost/yunohost-admin"
|
||||
},
|
||||
"scripts": {
|
||||
"postinstall": "bower install",
|
||||
"build": "gulp build",
|
||||
"build-dev": "gulp build --dev",
|
||||
"watch": "gulp watch",
|
||||
"watch-dev": "gulp watch --dev"
|
||||
},
|
||||
"author": "Yunohost",
|
||||
"license": "AGPL-3.0",
|
||||
"bugs": {
|
||||
|
|
Loading…
Add table
Reference in a new issue