Merge pull request #182 from YunoHost/enh_change_label

[enh] Add change label option in app info page
This commit is contained in:
Laurent Peuch 2018-01-14 00:49:46 +01:00 committed by GitHub
commit 731c6fcd28
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 61 additions and 0 deletions

View file

@ -592,6 +592,26 @@
);
});
// Get app change label page
app.get('#/apps/:app/changelabel', function (c) {
c.api('/apps/'+c.params['app']+'?raw', function(app_data) {
data = {
id: c.params['app'],
label: app_data.settings.label,
};
c.view('app/app_changelabel', data);
});
});
// Change app label
app.post('#/apps/:app/changelabel', function (c) {
params = {'new_label': c.params['label']};
c.api('/apps/' + c.params['app'] + '/label', function(data) { // Call changelabel API
store.clear('slide');
c.redirect('#/apps/'+ c.params['app']);
}, 'PUT', params);
});
// Get app change URL page
app.get('#/apps/:app/changeurl', function (c) {
c.api('/apps/'+c.params['app']+'?raw', function(app_data) {

View file

@ -13,10 +13,12 @@
"app_access_removeall_btn": "Remove all access",
"app_access_removeall_desc": "No users will have access to %s.",
"app_access_title": "%s access",
"app_change_label": "Change Label",
"app_change_url": "Change URL",
"app_debug_no_logs": "Application's logs are not available",
"app_debug_tab": "Display debug information",
"app_info_access_desc": "Manage user access. Allowed users: %s",
"app_info_changelabel_desc": "Change app label in the portal.",
"app_info_debug_desc": "Display debugging information for this application.",
"app_info_default_desc": "Redirect domain root to this application (%s).",
"app_info_changeurl_desc": "Change the access URL of this application (domain and/or path).",

View file

@ -0,0 +1,30 @@
<div class="btn-breadcrumb">
<a href="#/" ><i class="fa-home"></i><span class="sr-only">{{t 'home'}}</span></a>
<a href="#/apps" class="hidden-xs">{{t 'applications'}}</a>
<a href="#/apps" class="visible-xs">&hellip;</a>
<a href="#/apps/{{id}}">{{label}}</a>
<a href="#/apps/{{id}}/changelabel">{{t 'app_change_label'}}</a>
</div>
<div class="separator"></div>
<form action="#/apps/{{id}}/changelabel" method="POST" class="form-horizontal form-app-install">
<div class="panel panel-default">
<div class="panel-heading">
<h2 class="panel-title"><span class="fa-fw fa-tag"></span> {{t 'app_change_label'}}</h2>
</div>
<div class="panel-body">
<div class="form-group">
<label for="label" class="col-sm-12">{{t 'label'}}</label>
<div class="col-sm-12">
<input class="col-sm-12" type="text" id="label" name="label" class="form-control" value="{{label}}" required="required">
</div>
</div>
<hr>
<input type="hidden" name="app" value="{{id}}">
<div class="text-center">
<input type="submit" class="btn btn-success slide back" value="{{t 'app_change_label'}}">
</div>
</div>
</div>
</form>

View file

@ -15,6 +15,8 @@
<dl class="dl-horizontal">
<dt>{{t 'id'}}</dt>
<dd>{{settings.id}}</dd>
<dt>{{t 'label'}}</dt>
<dd>{{settings.label}}</dd>
<dt>{{t 'description'}}</dt>
<dd>{{description}}</dd>
<dt>{{t 'multi_instance'}}</dt>
@ -34,6 +36,13 @@
</h2>
</div>
<div class="panel-body">
<div class="container">
<p>{{t 'app_info_changelabel_desc' settings.label}}</p>
<a href="#/apps/{{settings.id}}/changelabel" class="btn btn-info slide">
<span class="fa-tag"></span> {{t 'app_change_label'}}
</a>
</div>
<hr>
<div class="container">
<p>{{t 'app_info_access_desc' settings.allowed_users}}</p>
<a href="#/apps/{{settings.id}}/access" class="btn btn-info slide">