From e4e60596e82c5ac1ab721d148b1ce1e32b6a89e3 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sat, 13 Jan 2018 15:46:03 +0100 Subject: [PATCH] Add change label option in app info page --- src/js/yunohost/controllers/apps.js | 20 +++++++++++++++++++ src/locales/en.json | 2 ++ src/views/app/app_changelabel.ms | 30 +++++++++++++++++++++++++++++ src/views/app/app_info.ms | 9 +++++++++ 4 files changed, 61 insertions(+) create mode 100644 src/views/app/app_changelabel.ms diff --git a/src/js/yunohost/controllers/apps.js b/src/js/yunohost/controllers/apps.js index 717ea785..ee62d4aa 100644 --- a/src/js/yunohost/controllers/apps.js +++ b/src/js/yunohost/controllers/apps.js @@ -572,4 +572,24 @@ ); }); + // 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); + }); + })(); diff --git a/src/locales/en.json b/src/locales/en.json index 44786813..5a8aaeff 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -13,9 +13,11 @@ "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_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_uninstall_desc": "Remove this application.", diff --git a/src/views/app/app_changelabel.ms b/src/views/app/app_changelabel.ms new file mode 100644 index 00000000..879118ff --- /dev/null +++ b/src/views/app/app_changelabel.ms @@ -0,0 +1,30 @@ +
+ {{t 'home'}} + + + {{label}} + {{t 'app_change_label'}} +
+ +
+ +
+
+
+

{{t 'app_change_label'}}

+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
diff --git a/src/views/app/app_info.ms b/src/views/app/app_info.ms index 32d88ae6..0ae55123 100644 --- a/src/views/app/app_info.ms +++ b/src/views/app/app_info.ms @@ -15,6 +15,8 @@
{{t 'id'}}
{{settings.id}}
+
{{t 'label'}}
+
{{settings.label}}
{{t 'description'}}
{{description}}
{{t 'multi_instance'}}
@@ -34,6 +36,13 @@
+
+

{{t 'app_info_changelabel_desc' settings.label}}

+ + {{t 'app_change_label'}} + +
+

{{t 'app_info_access_desc' settings.allowed_users}}