mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
[enh] Allow only 1 DynDns domain (so don't show a useless form).
This commit is contained in:
parent
8c0b211851
commit
d0c4230e24
2 changed files with 25 additions and 2 deletions
23
js/app.js
23
js/app.js
|
@ -348,6 +348,13 @@ app = Sammy('#main', function (sam) {
|
|||
* Filters
|
||||
*
|
||||
*/
|
||||
sam.before(/domains\/add/, function (req){
|
||||
// Preload domains list.
|
||||
req.params.domains = [];
|
||||
req.api('/domains', function(data) {
|
||||
req.params.domains = data.domains;
|
||||
});
|
||||
});
|
||||
sam.before(/apps\/install\//, function (req){
|
||||
// Preload domains list.
|
||||
req.params.domains = [];
|
||||
|
@ -857,7 +864,21 @@ app = Sammy('#main', function (sam) {
|
|||
c.params.ddomains = ['.nohost.me', '.noho.st'];
|
||||
})
|
||||
.always(function() {
|
||||
c.view('domain/domain_add', c.params);
|
||||
data = {
|
||||
ddomains : c.params.ddomains,
|
||||
domains : c.params.domains,
|
||||
allowDyndnsDomain : true
|
||||
}
|
||||
|
||||
// Allow only 1 DynDns domain.
|
||||
var regex = data.ddomains.join('|')
|
||||
$.each(data.domains, function(k, domain) {
|
||||
if ( domain.search(regex) > 0 ) {
|
||||
data.allowDyndnsDomain = false;
|
||||
}
|
||||
});
|
||||
|
||||
c.view('domain/domain_add', data);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
</a>
|
||||
</h4>
|
||||
</div>
|
||||
<div id="collapseOne" class="panel-collapse collapse">
|
||||
<div id="collapseOne" class="panel-collapse {{#if allowDyndnsDomain }}collapse{{/if}}">
|
||||
<div class="panel-body">
|
||||
<small>{{t 'domain_add_dns_doc'}}</small>
|
||||
<hr>
|
||||
|
@ -30,6 +30,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{#if allowDyndnsDomain }}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title">
|
||||
|
@ -59,6 +60,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
<div class="br"></div>
|
||||
|
|
Loading…
Add table
Reference in a new issue