Add ttl_options to templates

This commit is contained in:
Robert Kerr 2018-11-28 20:09:33 +00:00
parent c456aa2e7a
commit 976742c54e
2 changed files with 3 additions and 1 deletions

View File

@ -92,6 +92,7 @@
<script> <script>
// superglobals // superglobals
window.records_allow_edit = {{ editable_records|tojson }}; window.records_allow_edit = {{ editable_records|tojson }};
window.ttl_options = {{ ttl_options|tojson }};
window.nEditing = null; window.nEditing = null;
window.nNew = false; window.nNew = false;

View File

@ -1060,6 +1060,7 @@ def edit_template(template):
t = DomainTemplate.query.filter(DomainTemplate.name == template).first() t = DomainTemplate.query.filter(DomainTemplate.name == template).first()
records_allow_to_edit = Setting().get_records_allow_to_edit() records_allow_to_edit = Setting().get_records_allow_to_edit()
quick_edit = Setting().get('record_quick_edit') quick_edit = Setting().get('record_quick_edit')
ttl_options = Setting().get_ttl_options()
if t is not None: if t is not None:
records = [] records = []
for jr in t.records: for jr in t.records:
@ -1067,7 +1068,7 @@ def edit_template(template):
record = DomainTemplateRecord(name=jr.name, type=jr.type, status='Disabled' if jr.status else 'Active', ttl=jr.ttl, data=jr.data) record = DomainTemplateRecord(name=jr.name, type=jr.type, status='Disabled' if jr.status else 'Active', ttl=jr.ttl, data=jr.data)
records.append(record) records.append(record)
return render_template('template_edit.html', template=t.name, records=records, editable_records=records_allow_to_edit, quick_edit=quick_edit) return render_template('template_edit.html', template=t.name, records=records, editable_records=records_allow_to_edit, quick_edit=quick_edit, ttl_options=ttl_options)
except Exception as e: except Exception as e:
logging.error('Cannot open domain template page. DETAIL: {0}'.format(e)) logging.error('Cannot open domain template page. DETAIL: {0}'.format(e))
logging.debug(traceback.format_exc()) logging.debug(traceback.format_exc())