Add support for featured community apps

This commit is contained in:
Maniack Crudelis 2019-02-01 13:45:53 +01:00
parent 66d5e9e3b3
commit 116c9c305a
3 changed files with 7 additions and 1 deletions

View file

@ -66,6 +66,7 @@
var state = dataraw[v['id']]['state'];
var levelFormatted = parseInt(dataraw[v['id']]['level']);
var isWorking = (state === 'working' || state === 'official') && levelFormatted > 0;
var isFeatured = (state === 'official' || dataraw[v['id']]['featured']);
// Keep only the first instance of each app and remove community not working apps
if (!v['id'].match(/__[0-9]{1,5}$/) && (dataraw[v['id']]['repository'] === 'yunohost' || state !== 'notworking')) {
@ -80,6 +81,7 @@
dataraw[v['id']]['updateDate'] = dataraw[v['id']]['lastUpdate'] * 1000 || 0;
dataraw[v['id']]['isSafe'] = (dataraw[v['id']]['installColor'] !== 'danger');
dataraw[v['id']]['isWorking'] = isWorking ? "isworking" : "notFullyWorking";
dataraw[v['id']]['isFeatured'] = isFeatured;
jQuery.extend(dataraw[v['id']], v);
apps.push(dataraw[v['id']]);

View file

@ -145,6 +145,8 @@
"error_connection_interrupted": "The server closed the connection instead of answering it, has nginx been restarted by error? (Error code/message: %s)",
"everyone_has_access": "Everyone has access.",
"experimental_warning": "Warning: this feature is experimental and not consider stable, you shouldn't be using it except if you know what you are doing.",
"featured": "Featured",
"featured_and_official_apps": "Featured and official apps",
"filesystem": "Filesystem",
"firewall": "Firewall",
"footer_version": "Powered by <a href='https://yunohost.org'>YunoHost</a> %s (%s).",

View file

@ -25,6 +25,7 @@
<ul id="dropdownFilter" class="dropdown-menu" data-filter="isworking" role="menu">
<li role="presentation" class="button dropdownFilter" data-filter="isworking"><a class="menu-item" role="menu-item" tabindex="-1">{{t 'only_working_apps'}}</a></li>
<li role="presentation" class="button dropdownFilter" data-filter="official"><a class="menu-item" role="menu-item" tabindex="-1">{{t 'only_official_apps'}}</a></li>
<li role="presentation" class="button dropdownFilter" data-filter="isFeatured"><a class="menu-item" role="menu-item" tabindex="-1">{{t 'featured_and_official_apps'}}</a></li>
<li role="presentation" class="button dropdownFilter" data-filter="*"><a class="menu-item" role="menu-item" tabindex="-1">{{t 'all_apps'}}</a></li>
</ul>
</div>
@ -34,7 +35,7 @@
<div class="list-group grid">
{{#apps}}
<div class="app-card panel panel-default {{status}} {{state}} {{isWorking}} {{level}}-level">
<div class="app-card panel panel-default {{status}} {{state}} {{isWorking}} {{level}}-level {{isFeatured}}">
<div class="panel-body">
<h2 class="app-title">{{name}}</h2>
<div class="category">
@ -42,6 +43,7 @@
<span class="label label-{{stateColor}} label-as-badge app-state">{{t state}}</span>
<a target="_BLANK" href="https://yunohost.org/#/packaging_apps_levels"><span class="label label-{{levelColor}} label-as-badge app-level" title="{{t 'app_level'}}">{{t 'level'}} {{levelFormatted}}</span></a>
{{#displayLicense}}<span class="label label-default app-license" title="{{t 'app_license'}}">{{license}}</span>{{/displayLicense}}
{{#featured}}<i class="fas fa-star"></i> {{t 'featured'}}{{/featured}}
</div>
<div class="app-card-desc">{{description}}</div>
</div>