diff --git a/src/bower.json b/src/bower.json index f27d25da..98521387 100644 --- a/src/bower.json +++ b/src/bower.json @@ -6,8 +6,8 @@ "dependencies": { "bootstrap": "3.3.6", "font-awesome": "4.5.0", - "handlebars": "1.3.0", "handlebars-helper-intl": "1.1.2", + "handlebars": "4.0.11", "sammy": "0.7.6", "js-cookie": "2.1.0", "source-sans-pro": "git://github.com/adobe-fonts/source-sans-pro.git#2.020R-ro/1.075R-it", diff --git a/src/js/yunohost/controllers/apps.js b/src/js/yunohost/controllers/apps.js index 2dd11cf9..2da7f490 100644 --- a/src/js/yunohost/controllers/apps.js +++ b/src/js/yunohost/controllers/apps.js @@ -160,6 +160,34 @@ }); }); + // Get app config panel + app.get('#/apps/:app/config-panel', function (c) { + c.api('/apps/'+c.params['app']+'/config-panel', function(data) { + c.view('app/app_config-panel', data); + }); + }); + + app.post('#/apps/:app/config', function(c) { + // taken from app install + $.each(c.params, function(k, v) { + if (typeof(v) === 'object' && Array.isArray(v)) { + // And return only first value + c.params[k] = v[0]; + } + }); + + var app_id = c.params['app']; + delete c.params['app']; + + var params = { + 'args': c.serialize(c.params.toHash()) + } + + c.api('/apps/'+app_id+'/config', function() { // http://api.yunohost.org/#!/app/app_install_post_2 + c.redirect('#/apps/'+app_id+'/config-panel'); + }, 'POST', params); + }) + // Special case for custom app installation. app.get('#/apps/install/custom', function (c) { // If we try to GET /apps/install/custom, it means that installation fail. diff --git a/src/js/yunohost/controllers/domains.js b/src/js/yunohost/controllers/domains.js index 94096d4b..259b8b08 100644 --- a/src/js/yunohost/controllers/domains.js +++ b/src/js/yunohost/controllers/domains.js @@ -40,7 +40,7 @@ c.params.ddomains = data.map(function(dom){return '.'+dom;}); }) .fail(function() { - c.params.ddomains = ['.nohost.me', '.noho.st']; + c.params.ddomains = ['.nohost.me', '.noho.st', '.ynh.fr']; }) .always(function() { var data = { diff --git a/src/js/yunohost/controllers/postinstall.js b/src/js/yunohost/controllers/postinstall.js index 8f9834be..3760920c 100644 --- a/src/js/yunohost/controllers/postinstall.js +++ b/src/js/yunohost/controllers/postinstall.js @@ -28,7 +28,7 @@ c.params['ddomains'] = data.map(function(dom){return '.'+dom;}); }) .fail(function() { - c.params['ddomains'] = ['.nohost.me', '.noho.st']; + c.params['ddomains'] = ['.nohost.me', '.noho.st', '.ynh.fr']; }) .always(function() { c.view('postinstall/postinstall_2', c.params, function() { @@ -102,4 +102,4 @@ } }); -})(); \ No newline at end of file +})(); diff --git a/src/js/yunohost/main.js b/src/js/yunohost/main.js index ddc1d88a..57715fa9 100644 --- a/src/js/yunohost/main.js +++ b/src/js/yunohost/main.js @@ -60,7 +60,7 @@ + options.fn(this) + ''); }); - + // Load tooltips on the page; needed if using tooltips Handlebars.registerHelper('load_tooltips', function() { return new Handlebars.SafeString( @@ -71,6 +71,25 @@ + ''); }); + // equality stuff because mustache/Handlebars is lame + // source https://stackoverflow.com/a/31632215 + Handlebars.registerHelper('eq', function(a, b) { + return a === b; + }); + + Handlebars.registerHelper('neq', function(a, b) { + return a !== b; + }); + + Handlebars.registerHelper('in', function(a) { + // skip first one + for (var i = 1; i < arguments.length; ++i) { + if (arguments[i] == a) + return true; + } + return false; + }); + // Look for supported type of storage to use /** * http://sammyjs.org/docs/api/0.7.4/all#Sammy.Store.LocalStorage diff --git a/src/locales/en.json b/src/locales/en.json index ab46160d..f5351891 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -136,6 +136,7 @@ "error_server": "Server error", "error_server_unexpected": "Unexpected server error (%s)", "everyone_has_access": "Everyone has access.", + "experimental_warning": "Warning: this feature is experimental and not consider stable, you shouldn't be using it except if you know what you are doing.", "filesystem": "Filesystem", "firewall": "Firewall", "footer_version" : "Powered by YunoHost %s (%s).", diff --git a/src/views/app/app_config-panel.ms b/src/views/app/app_config-panel.ms new file mode 100644 index 00000000..3d00f64c --- /dev/null +++ b/src/views/app/app_config-panel.ms @@ -0,0 +1,73 @@ +
+ + + +