mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
[enh] Split app list templates, add 'installed' badge.
This commit is contained in:
parent
df3bd90d0a
commit
66dbcf50da
4 changed files with 74 additions and 55 deletions
2
src/dist/js/script.min.js
vendored
2
src/dist/js/script.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -12,13 +12,13 @@
|
|||
app.get('#/apps', function (c) {
|
||||
c.api('/apps', function(data) { // http://api.yunohost.org/#!/app/app_list_get_8
|
||||
// Keep only installed apps
|
||||
data2 = { 'apps': [], 'installed_apps': true };
|
||||
apps = [];
|
||||
$.each(data['apps'], function(k, v) {
|
||||
if (v['installed']) data2['apps'].push(v);
|
||||
if (v['installed']) apps.push(v);
|
||||
});
|
||||
|
||||
c.arraySortById(data2.apps);
|
||||
c.view('app/app_list', data2);
|
||||
c.arraySortById(apps);
|
||||
c.view('app/app_list', {apps: apps});
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -27,17 +27,16 @@
|
|||
c.api('/apps', function(data) { // http://api.yunohost.org/#!/app/app_list_get_8
|
||||
c.api('/apps?raw', function(dataraw) { // http://api.yunohost.org/#!/app/app_list_get_8
|
||||
// Keep only uninstalled apps, or multi-instance apps
|
||||
data2 = { 'apps': [], 'installed_apps': false };
|
||||
apps = [];
|
||||
$.each(data['apps'], function(k, v) {
|
||||
if ((!v['installed'] || dataraw[v['id']].manifest.multi_instance == "true") && !v['id'].match(/__[0-9]{1,5}$/)) {
|
||||
v['install_link']=true;
|
||||
data2['apps'].push(v);
|
||||
apps.push(v);
|
||||
}
|
||||
});
|
||||
|
||||
// Sort app list
|
||||
c.arraySortById(data2.apps);
|
||||
c.view('app/app_list', data2);
|
||||
c.arraySortById(apps);
|
||||
c.view('app/app_list_install', {apps: apps});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
{{#installed_apps}}
|
||||
<div class="btn-breadcrumb">
|
||||
<a href="#/" ><i class="fa-home"></i><span class="sr-only">{{t 'home'}}</span></a>
|
||||
<a href="#/apps">{{t 'applications'}}</a>
|
||||
|
@ -9,29 +8,16 @@
|
|||
<span class="fa-plus"></span> {{t 'install'}}
|
||||
</a>
|
||||
</div>
|
||||
{{/installed_apps}}
|
||||
|
||||
{{^installed_apps}}
|
||||
<div class="btn-breadcrumb">
|
||||
<a href="#/" ><i class="fa-home"></i><span class="sr-only">{{t 'home'}}</span></a>
|
||||
<a href="#/apps">{{t 'applications'}}</a>
|
||||
<a href="#/apps/install">{{t 'install'}}</a>
|
||||
</div>
|
||||
|
||||
<div class="actions-group">
|
||||
<a href="#/apps/refresh" class="btn btn-info">
|
||||
<span class="fa-refresh"></span> {{t 'refresh_app_list'}}
|
||||
</a>
|
||||
</div>
|
||||
{{/installed_apps}}
|
||||
|
||||
<div class="separator"></div>
|
||||
|
||||
<div class="list-group">
|
||||
{{#apps}}
|
||||
<a href="#/apps/{{#install_link}}install/{{/install_link}}{{id}}" class="list-group-item slide">
|
||||
<a href="#/apps/{{id}}" class="list-group-item slide" title="{{t 'infos'}}">
|
||||
<span class="fa-chevron-right pull-right"></span>
|
||||
<h2 class="list-group-item-heading">{{name}} <small>{{id}}</small></h2>
|
||||
<h2 class="list-group-item-heading">
|
||||
{{label}} <small>{{name}}</small>
|
||||
</h2>
|
||||
<p class="list-group-item-text">{{description}}</p>
|
||||
</a>
|
||||
{{/apps}}
|
||||
|
@ -44,30 +30,3 @@
|
|||
{{/apps}}
|
||||
|
||||
</div>
|
||||
|
||||
{{^installed_apps}}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h2 class="panel-title"><span class="fa-fw fa-download"></span> {{t 'custom_app_install'}}</h2>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<form action="#/apps/install/custom" method="POST" class="form-horizontal">
|
||||
<div class="form-group has-feedback">
|
||||
<label for="label" class="col-sm-12">{{t 'url'}}</label>
|
||||
<div class="col-sm-12">
|
||||
<input type="url" id="url" name="url" class="form-control" value="" placeholder="https://github.com/USER/REPOSITORY" required pattern="^https://github.com/[a-zA-Z0-9-_.]+/[a-zA-Z0-9-_.]+[/]?$">
|
||||
<p class="text-warning">
|
||||
<span class="fa-github"></span> {{t 'custom_app_url_only_github'}}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="text-center">
|
||||
<input type="submit" class="btn btn-success slide" value="{{t 'install'}}">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{/installed_apps}}
|
||||
|
|
61
src/views/app/app_list_install.ms
Normal file
61
src/views/app/app_list_install.ms
Normal file
|
@ -0,0 +1,61 @@
|
|||
<div class="btn-breadcrumb">
|
||||
<a href="#/" ><i class="fa-home"></i><span class="sr-only">{{t 'home'}}</span></a>
|
||||
<a href="#/apps">{{t 'applications'}}</a>
|
||||
<a href="#/apps/install">{{t 'install'}}</a>
|
||||
</div>
|
||||
|
||||
<div class="actions-group">
|
||||
<a href="#/apps/refresh" class="btn btn-info">
|
||||
<span class="fa-refresh"></span> {{t 'refresh_app_list'}}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="separator"></div>
|
||||
|
||||
<div class="list-group">
|
||||
{{#apps}}
|
||||
<a href="#/apps/install/{{id}}" class="list-group-item slide" title="{{t 'install'}}">
|
||||
<span class="fa-chevron-right pull-right"></span>
|
||||
<h2 class="list-group-item-heading">
|
||||
{{name}} <small>{{id}}</small>
|
||||
{{#installed}}<span class="badge badge-success">{{t 'installed'}}</span>{{/installed}}
|
||||
</h2>
|
||||
<p class="list-group-item-text">{{description}}</p>
|
||||
</a>
|
||||
{{/apps}}
|
||||
|
||||
{{^apps}}
|
||||
<div class="alert alert-warning">
|
||||
<span class="fa-exclamation-triangle"></span>
|
||||
{{t 'no_installed_apps'}}
|
||||
</div>
|
||||
{{/apps}}
|
||||
|
||||
</div>
|
||||
|
||||
{{^installed_apps}}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h2 class="panel-title"><span class="fa-fw fa-download"></span> {{t 'custom_app_install'}}</h2>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<form action="#/apps/install/custom" method="POST" class="form-horizontal">
|
||||
<div class="form-group has-feedback">
|
||||
<label for="label" class="col-sm-12">{{t 'url'}}</label>
|
||||
<div class="col-sm-12">
|
||||
<input type="url" id="url" name="url" class="form-control" value="" placeholder="https://github.com/USER/REPOSITORY" required pattern="^https://github.com/[a-zA-Z0-9-_.]+/[a-zA-Z0-9-_.]+[/]?$">
|
||||
<p class="text-warning">
|
||||
<span class="fa-github"></span> {{t 'custom_app_url_only_github'}}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="text-center">
|
||||
<input type="submit" class="btn btn-success slide" value="{{t 'install'}}">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{/installed_apps}}
|
Loading…
Reference in a new issue