mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
Moooar buttons (domain info view)
This commit is contained in:
parent
1f4afe63e7
commit
6a4ca127a4
2 changed files with 45 additions and 52 deletions
|
@ -97,14 +97,52 @@
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
var domain = {
|
||||
name: c.params['domain'],
|
||||
main: (c.params['domain'] == dataMain.current_main_domain) ? true : false,
|
||||
url: "https://"+c.params['domain'],
|
||||
enable_cert_management: enable_cert_management_
|
||||
};
|
||||
c.view('domain/domain_info', domain);
|
||||
c.view('domain/domain_info', domain, function() {
|
||||
|
||||
// Configure "set default" button
|
||||
$('button[data-action="set_default"]').on("click", function() {
|
||||
var domain = $(this).data("domain");
|
||||
c.confirm(
|
||||
y18n.t('domains'),
|
||||
y18n.t('confirm_change_maindomain'),
|
||||
function() {
|
||||
var params = {
|
||||
new_domain: c.params['domain']
|
||||
};
|
||||
c.api('PUT', '/domains/main', params, function(data) {
|
||||
c.redirect_to('#/domains');
|
||||
});
|
||||
|
||||
// WTF ... why is this hack needed v_v
|
||||
|
||||
// Wait 15s and refresh the page
|
||||
var refreshDomain = window.setTimeout(function(){
|
||||
c.redirect_to('#/domains');
|
||||
}, 15000);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
// Configure delete button
|
||||
$('button[data-action="delete"]').on("click", function() {
|
||||
var domain = $(this).data("domain");
|
||||
c.confirm(
|
||||
y18n.t('domains'),
|
||||
y18n.t('confirm_delete', [domain]),
|
||||
function(){
|
||||
c.api('DELETE', '/domains/'+ domain, {}, function(data) {
|
||||
c.redirect_to('#/domains');
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -241,46 +279,4 @@
|
|||
});
|
||||
});
|
||||
|
||||
|
||||
// Remove existing domain
|
||||
app.get('#/domains/:domain/delete', function (c) {
|
||||
c.confirm(
|
||||
y18n.t('domains'),
|
||||
y18n.t('confirm_delete', [c.params['domain']]),
|
||||
function(){
|
||||
c.api('DELETE', '/domains/'+ c.params['domain'], {}, function(data) {
|
||||
c.redirect_to('#/domains');
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
// Set default domain
|
||||
app.post('#/domains', function (c) {
|
||||
if (c.params['domain'] === '') {
|
||||
c.flash('fail', y18n.t('error_select_domain'));
|
||||
c.redirect_to('#/domains', {slide:false});
|
||||
} else {
|
||||
c.confirm(
|
||||
y18n.t('domains'),
|
||||
y18n.t('confirm_change_maindomain'),
|
||||
function(){
|
||||
var params = {
|
||||
new_domain: c.params['domain']
|
||||
};
|
||||
c.api('PUT', '/domains/main', params, function(data) {
|
||||
c.redirect_to('#/domains');
|
||||
});
|
||||
|
||||
// WTF ... why is this hack needed v_v
|
||||
|
||||
// Wait 15s and refresh the page
|
||||
var refreshDomain = window.setTimeout(function(){
|
||||
c.redirect_to('#/domains');
|
||||
}, 15000);
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
})();
|
||||
|
|
|
@ -40,12 +40,9 @@
|
|||
<hr>
|
||||
<div class="container">
|
||||
<p>{{t 'domain_default_desc'}}</p>
|
||||
<form method="POST" action="#/domains">
|
||||
<input type="hidden" name="domain" value="{{name}}" required class="form-control">
|
||||
<button type="submit" class="btn btn-primary slide back" value="{{t 'set_default'}}">
|
||||
<button class="btn btn-primary" data-action="set_default" data-domain="{{name}}">
|
||||
{{t 'set_default'}} <span class="fa-fw fa-star"></span>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
{{/unless}}
|
||||
<hr>
|
||||
|
@ -70,9 +67,9 @@
|
|||
<hr>
|
||||
<div class="container">
|
||||
<p>{{t 'domain_delete_longdesc' name}}</p>
|
||||
<a href="#/domains/{{name}}/delete" role="button" class="btn btn-danger slide back">
|
||||
<button class="btn btn-danger" data-action="delete" data-domain="{{name}}">
|
||||
{{t 'delete'}} <span class="fa-fw fa-trash-o"></span>
|
||||
</a>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue