mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-08 22:50:26 +00:00
Add setting to allow/disallow quick editing of records
Adds an `allow_quick_edit` setting, using the improved setting handling logic from PR #287 to toggle whether records are editable by simply clicking the row or not. Aims to fix #288
This commit is contained in:
parent
1bccc34c16
commit
31305a3048
@ -1717,7 +1717,8 @@ class Setting(db.Model):
|
|||||||
'login_ldap_first': 'True',
|
'login_ldap_first': 'True',
|
||||||
'default_record_table_size': 15,
|
'default_record_table_size': 15,
|
||||||
'default_domain_table_size': 10,
|
'default_domain_table_size': 10,
|
||||||
'auto_ptr': 'False'
|
'auto_ptr': 'False',
|
||||||
|
'allow_quick_edit': 'True'
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, id=None, name=None, value=None):
|
def __init__(self, id=None, name=None, value=None):
|
||||||
|
@ -161,8 +161,8 @@
|
|||||||
modal.modal('show');
|
modal.modal('show');
|
||||||
|
|
||||||
});
|
});
|
||||||
// handle edit button
|
// handle edit button and record click
|
||||||
$(document.body).on("click", ".button_edit, .row_record", function(e) {
|
$(document.body).on("click", ".button_edit{% if quick_edit %}, .row_record{% endif %}", function(e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
if ($(this).is('tr')) {
|
if ($(this).is('tr')) {
|
||||||
var nRow = $(this)[0];
|
var nRow = $(this)[0];
|
||||||
|
@ -576,6 +576,8 @@ def domain(domain_name):
|
|||||||
# can not get any record, API server might be down
|
# can not get any record, API server might be down
|
||||||
return redirect(url_for('error', code=500))
|
return redirect(url_for('error', code=500))
|
||||||
|
|
||||||
|
quick_edit = strtobool(Setting().get('allow_quick_edit'))
|
||||||
|
|
||||||
records = []
|
records = []
|
||||||
#TODO: This should be done in the "model" instead of "view"
|
#TODO: This should be done in the "model" instead of "view"
|
||||||
if NEW_SCHEMA:
|
if NEW_SCHEMA:
|
||||||
@ -588,7 +590,7 @@ def domain(domain_name):
|
|||||||
editable_records = app.config['RECORDS_ALLOW_EDIT']
|
editable_records = app.config['RECORDS_ALLOW_EDIT']
|
||||||
else:
|
else:
|
||||||
editable_records = app.config['REVERSE_RECORDS_ALLOW_EDIT']
|
editable_records = app.config['REVERSE_RECORDS_ALLOW_EDIT']
|
||||||
return render_template('domain.html', domain=domain, records=records, editable_records=editable_records)
|
return render_template('domain.html', domain=domain, records=records, editable_records=editable_records, quick_edit=quick_edit)
|
||||||
else:
|
else:
|
||||||
for jr in jrecords:
|
for jr in jrecords:
|
||||||
if jr['type'] in app.config['RECORDS_ALLOW_EDIT']:
|
if jr['type'] in app.config['RECORDS_ALLOW_EDIT']:
|
||||||
@ -598,7 +600,7 @@ def domain(domain_name):
|
|||||||
editable_records = app.config['FORWARD_RECORDS_ALLOW_EDIT']
|
editable_records = app.config['FORWARD_RECORDS_ALLOW_EDIT']
|
||||||
else:
|
else:
|
||||||
editable_records = app.config['REVERSE_RECORDS_ALLOW_EDIT']
|
editable_records = app.config['REVERSE_RECORDS_ALLOW_EDIT']
|
||||||
return render_template('domain.html', domain=domain, records=records, editable_records=editable_records, pdns_version=app.config['PDNS_VERSION'])
|
return render_template('domain.html', domain=domain, records=records, editable_records=editable_records, quick_edit=quick_edit, pdns_version=app.config['PDNS_VERSION'])
|
||||||
|
|
||||||
|
|
||||||
@app.route('/admin/domain/add', methods=['GET', 'POST'])
|
@app.route('/admin/domain/add', methods=['GET', 'POST'])
|
||||||
|
Loading…
Reference in New Issue
Block a user