mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
Install app
This commit is contained in:
parent
1a8def8c7f
commit
7cff1d7690
2 changed files with 22 additions and 1 deletions
22
js/app.js
22
js/app.js
|
@ -16,6 +16,16 @@ app = Sammy('#main', function (sam) {
|
|||
*/
|
||||
sam.helpers({
|
||||
|
||||
// Serialize an object
|
||||
serialize : function(obj) {
|
||||
var str = [];
|
||||
for(var p in obj)
|
||||
if (obj.hasOwnProperty(p)) {
|
||||
str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
|
||||
}
|
||||
return str.join("&");
|
||||
},
|
||||
|
||||
// Flash helper to diplay instant notifications
|
||||
flash: function (level, message) {
|
||||
flashs = store.get('flash');
|
||||
|
@ -421,7 +431,7 @@ app = Sammy('#main', function (sam) {
|
|||
});
|
||||
|
||||
sam.get('#/apps/:app', function (c) {
|
||||
c.api('/app/'+c.params['app']+'?raw=true', function(data) { // http://api.yunohost.org/#!/app/app_list_get_8
|
||||
c.api('/app/'+c.params['app']+'?raw=true', function(data) { // http://api.yunohost.org/#!/app/app_info_get_9
|
||||
c.view('app_info', data);
|
||||
});
|
||||
});
|
||||
|
@ -432,6 +442,16 @@ app = Sammy('#main', function (sam) {
|
|||
});
|
||||
});
|
||||
|
||||
sam.post('#/apps', function(c) {
|
||||
params = { 'label': c.params['label'], 'app': c.params['app'] }
|
||||
delete c.params['label'];
|
||||
delete c.params['app'];
|
||||
params['args'] = c.serialize(c.params.toHash());
|
||||
c.api('/app', function() { // http://api.yunohost.org/#!/app/app_install_post_2
|
||||
c.redirect('#/apps');
|
||||
}, 'POST', params);
|
||||
});
|
||||
|
||||
sam.get('#/apps/refresh', function (c) {
|
||||
c.api('/app/lists', function(data) { // http://api.yunohost.org/#!/app/app_fetchlist_put_5
|
||||
c.redirect(store.get('path'));
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
</div>
|
||||
{{/manifest.arguments.install}}
|
||||
<hr>
|
||||
<input type="hidden" name="app" value="{{manifest.id}}">
|
||||
<div class="text-center">
|
||||
<input type="submit" class="btn btn-success slide back" value="Install">
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue