Mooooarr buttons (app info page)

This commit is contained in:
Alexandre Aubin 2019-10-18 22:12:17 +02:00
parent 4b5d64f8ef
commit 1ba6fa9b1a
2 changed files with 42 additions and 31 deletions

View file

@ -215,7 +215,36 @@
data.manifest.multi_instance = data.manifest.multi_instance ? y18n.t('yes') : y18n.t('no'); data.manifest.multi_instance = data.manifest.multi_instance ? y18n.t('yes') : y18n.t('no');
data.install_time = new Date(data.settings.install_time * 1000); data.install_time = new Date(data.settings.install_time * 1000);
c.view('app/app_info', data); c.view('app/app_info', data, function() {
// Button to set the app as default
$('button[data-action="set-as-default"]').on("click", function() {
var app = $(this).data("app");
c.confirm(
y18n.t('applications'),
y18n.t('confirm_app_default'),
function() {
c.api('PUT', '/apps/'+app+'/default', {}, function() {
c.redirect_to('#/apps/'+ app, {slide:false});
});
}
);
});
// Button to uninstall the app
$('button[data-action="uninstall"]').on("click", function() {
var app = $(this).data("app");
c.confirm(
y18n.t('applications'),
y18n.t('confirm_uninstall', [app]),
function() {
c.api('DELETE', '/apps/'+ app, {}, function() {
c.redirect_to('#/apps');
});
}
);
});
});
}); });
}); });
@ -226,6 +255,10 @@
}); });
}); });
//
// App actions
//
// Get app actions list // Get app actions list
app.get('#/apps/:app/actions', function (c) { app.get('#/apps/:app/actions', function (c) {
c.api('GET', '/apps/'+c.params['app']+'/actions', {}, function(data) { c.api('GET', '/apps/'+c.params['app']+'/actions', {}, function(data) {
@ -269,6 +302,10 @@
}); });
}); });
//
// App config panel
//
// Get app config panel // Get app config panel
app.get('#/apps/:app/config-panel', function (c) { app.get('#/apps/:app/config-panel', function (c) {
c.api('GET', '/apps/'+c.params['app']+'/config-panel', {}, function(data) { c.api('GET', '/apps/'+c.params['app']+'/config-panel', {}, function(data) {
@ -593,19 +630,6 @@
); );
}); });
// Remove installed app
app.get('#/apps/:app/uninstall', function (c) {
c.confirm(
y18n.t('applications'),
y18n.t('confirm_uninstall', [c.params['app']]),
function() {
c.api('DELETE', '/apps/'+ c.params['app'], {}, function() {
c.redirect_to('#/apps');
});
}
);
});
// Manage app access // Manage app access
app.get('#/apps/:app/access', function (c) { app.get('#/apps/:app/access', function (c) {
c.api('GET', '/apps/'+c.params['app']+'?raw', {}, function(data) { c.api('GET', '/apps/'+c.params['app']+'?raw', {}, function(data) {
@ -729,19 +753,6 @@
); );
}); });
// Make app default
app.get('#/apps/:app/default', function (c) {
c.confirm(
y18n.t('applications'),
y18n.t('confirm_app_default'),
function() {
c.api('PUT', '/apps/'+c.params['app']+'/default', {}, function() {
c.redirect_to('#/apps/'+ c.params['app'], {slide:false});
});
}
);
});
// Get app change label page // Get app change label page
app.get('#/apps/:app/changelabel', function (c) { app.get('#/apps/:app/changelabel', function (c) {
c.api('GET', '/apps/'+c.params['app']+'?raw', {}, function(app_data) { c.api('GET', '/apps/'+c.params['app']+'?raw', {}, function(app_data) {

View file

@ -56,9 +56,9 @@
<hr> <hr>
<div class="container"> <div class="container">
<p>{{t 'app_info_default_desc' settings.domain}}</p> <p>{{t 'app_info_default_desc' settings.domain}}</p>
<a role="button" href="#/apps/{{settings.id}}/default" class="btn btn-success slide"> <button class="btn btn-success" data-action="set-as-default" data-app="{{settings.id}}">
<span class="fa-star"></span> {{t 'app_make_default'}} <span class="fa-star"></span> {{t 'app_make_default'}}
</a> </button>
</div> </div>
<hr> <hr>
<div class="container"> <div class="container">
@ -78,9 +78,9 @@
<hr> <hr>
<div class="container"> <div class="container">
<p>{{t 'app_info_uninstall_desc'}}</p> <p>{{t 'app_info_uninstall_desc'}}</p>
<a href="#/apps/{{settings.id}}/uninstall" role="button" class="btn btn-danger slide back"> <button class="btn btn-danger slide back" data-action="uninstall" data-app="{{settings.id}}">
<span class="fa-trash-o"></span> {{t 'uninstall'}} <span class="fa-trash-o"></span> {{t 'uninstall'}}
</a> </button>
</div> </div>
<hr> <hr>
<div class="container"> <div class="container">