Add unmaintained states

This commit is contained in:
Maniack Crudelis 2019-02-20 22:52:16 +01:00
parent cfebfc5d72
commit 289e239ad3
3 changed files with 38 additions and 2 deletions

View file

@ -40,6 +40,21 @@
}
}
function stateToMaintained(state) {
if ( state === "request_help" ) {
return 'info';
}
else if ( state === "request_adoption" ) {
return 'warning';
}
else if ( state === "orphaned" ) {
return 'danger';
}
else {
return 'default';
}
}
function combineColors(stateColor, levelColor, installable) {
if (stateColor === "danger" || levelColor === "danger") {
return 'danger';
@ -74,6 +89,24 @@
var isFeatured = ( dataraw[v['id']]['featured'] && dataraw[v['id']]['high_quality']);
// Update the status featured with the previous condition
dataraw[v['id']]['featured'] = isFeatured;
if ( dataraw[v['id']]['maintained'] !== true )
{
// Set the maintained status at Orphaned if the value of 'maintained' is 'false'
if ( dataraw[v['id']]['maintained'] === false )
{
dataraw[v['id']]['MaintainedStatus'] = "orphaned";
}
// Otherwise, set 'MaintainedStatus' at the value of 'maintained' and set 'maintained' as 'false'
else
{
dataraw[v['id']]['MaintainedStatus'] = dataraw[v['id']]['maintained'];
dataraw[v['id']]['maintained'] = false;
}
// Set the color for the label
dataraw[v['id']]['MaintainedColor'] = stateToMaintained(dataraw[v['id']]['MaintainedStatus']);
}
// 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')) {

View file

@ -233,6 +233,7 @@
"only_working_apps": "Only working apps",
"open": "Open",
"operations": "Operations",
"orphaned": "Orphaned",
"os": "OS",
"password": "Password",
"password_confirmation": "Password confirmation",
@ -282,6 +283,8 @@
"reception": "Reception",
"refresh_app_list": "Refresh list",
"remove_access": "Remove access",
"request_adoption": "Request for adoption",
"request_help": "Request for help",
"restore": "Restore",
"run": "Run",
"running": "Running",

View file

@ -51,8 +51,8 @@
</div>
<div class="app-card-date-maintainer">
<i class="fas fa-sync"></i>{{formatDate updateDate day="numeric" month="long" year="numeric"}} -
{{#maintained}}<span title="{{t 'current_maintainer_title'}}" class="maintained"></span><i class="fa-user"></i> {{manifest.maintainer.name}}</span>{{/maintained}}
{{^maintained}}<i class="fas fa-warning"></i> {{t 'unmaintained'}}{{/maintained}}
<span title="{{t 'current_maintainer_title'}}" class="maintained"></span><i class="fa-user"></i> {{manifest.maintainer.name}}</span>
{{^maintained}}<span class="label label-{{MaintainedColor}} label-as-badge MaintainedStatus" title="{{t MaintainedStatus}}"><i class="fa-warning"></i> {{t MaintainedStatus}}</span>{{/maintained}}
</div>
<div class="btn-group" role="group">
<a href="{{git.url}}" target="_BLANK" type="button" role="button" class="btn btn-default col-xs-4">