diff --git a/js/app.js b/js/app.js index 2419df88..a586ea98 100644 --- a/js/app.js +++ b/js/app.js @@ -396,25 +396,40 @@ app = Sammy('#main', function (sam) { */ sam.get('#/apps', function (c) { - c.api('/app/list', function(data) { // http://api.yunohost.org/#!/app/app_list_get_8 + c.api('/apps', function(data) { // http://api.yunohost.org/#!/app/app_list_get_8 // Keep only installed apps data2 = { 'Apps': [], 'Installed': true } $.each(data['Apps'], function(k, v) { - if (v['Installed'] !== 'No') data2['Apps'].push(v); + if (v['Installed']) data2['Apps'].push(v); }); c.view('app_list', data2); }); }); sam.get('#/apps/install', function (c) { - c.api('/app/list', function(data) { // http://api.yunohost.org/#!/app/app_list_get_8 + c.api('/apps', function(data) { // http://api.yunohost.org/#!/app/app_list_get_8 + c.api('/apps?raw=true', function(dataraw) { // http://api.yunohost.org/#!/app/app_list_get_8 // Keep only uninstalled apps data2 = { 'Apps': [] } $.each(data['Apps'], function(k, v) { - if (v['Installed'] !== 'Yes') data2['Apps'].push(v); + if (dataraw[v['ID']].manifest.multi_instance) v['Installed'] = false; + if (!v['Installed']) data2['Apps'].push(v); }); c.view('app_list', data2); }); + }); + }); + + 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.view('app_info', data); + }); + }); + + sam.get('#/apps/install/:app', function (c) { + c.api('/apps?raw=true', function(data) { // http://api.yunohost.org/#!/app/app_list_get_8 + c.view('app_install', data[c.params['app']]); + }); }); sam.get('#/apps/refresh', function (c) { diff --git a/views/app_info.ms b/views/app_info.ms new file mode 100644 index 00000000..a5096cb3 --- /dev/null +++ b/views/app_info.ms @@ -0,0 +1,38 @@ +
+ App list +
+
+ Access +
+
+
{{settings.label}}
+ +
+ + + +
+ Uninstall +
diff --git a/views/app_install.ms b/views/app_install.ms new file mode 100644 index 00000000..85672556 --- /dev/null +++ b/views/app_install.ms @@ -0,0 +1,51 @@ +
+ App list +
+
+
Install {{manifest.name}}
+ +
+ +
+ + +
+
+
+
+ +
+ +
+
+ {{#manifest.arguments.install}} +
+ +
+ +
+
+ {{/manifest.arguments.install}} +
+
+ +
+
+
+ +
diff --git a/views/app_list.ms b/views/app_list.ms index 15dcfa49..ea916edd 100644 --- a/views/app_list.ms +++ b/views/app_list.ms @@ -25,11 +25,11 @@
{{#Apps}} - +

{{Name}} {{ID}}

-

{{Description}}

+

{{Description.en}}

{{/Apps}}