diff --git a/src/js/yunohost/controllers/apps.js b/src/js/yunohost/controllers/apps.js index 3154918d..81ff5382 100644 --- a/src/js/yunohost/controllers/apps.js +++ b/src/js/yunohost/controllers/apps.js @@ -160,6 +160,25 @@ }); }); + // Get app actions list + app.get('#/apps/:app/actions', function (c) { + c.api('/apps/'+c.params['app']+'/actions', function(data) { + $.each(data.actions, function(_, action) { + formatYunoHostStyleArguments(action.arguments, c.params); + + // Multilingual description + action.description = (typeof action.description[y18n.locale] !== 'undefined') ? + action.description[y18n.locale] : + action.description['en'] + ; + + }); + + c.view('app/app_actions', data); + return; + }); + }); + // Get app config panel app.get('#/apps/:app/config-panel', function (c) { c.api('/apps/'+c.params['app']+'/config-panel', function(data) { diff --git a/src/locales/en.json b/src/locales/en.json index effae38a..56e6fc4b 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -29,6 +29,7 @@ "app_install_custom_no_manifest": "No manifest.json file", "app_list": "App list", "app_make_default": "Make default", + "app_no_actions": "This application doesn't have any actions", "app_repository": "Application origin: ", "app_state": "Application state: ", "app_state_inprogress": "In progress", diff --git a/src/views/app/app_actions.ms b/src/views/app/app_actions.ms new file mode 100644 index 00000000..43339e94 --- /dev/null +++ b/src/views/app/app_actions.ms @@ -0,0 +1,68 @@ +
+ {{t 'home'}} + {{t 'applications'}} + {{app_name}} + {{t 'app_actions'}} +
+ +
+ + + +{{#if actions}} +{{#actions}} +
+
+
+

{{name}}

+
+
+

{{description}}

+ {{#if arguments}} + {{#arguments}} +
+ + + {{#if helpText}} + {{{helpText}}} + {{/if}} + +
+ + {{#if choices}} + + {{else}} + + {{/if}} + + {{#if helpLink}} + {{{helpLink}}} + {{/if}} + + {{#if example}} + {{t 'form_input_example' example}} + {{/if}} + +
+
+ {{/arguments}} +
+ {{/if}} + +
+ +
+
+
+
+ +{{/actions}} + +{{else}} +
+ + {{t 'app_no_actions'}} +
+{{/if}}