2018-08-18 11:41:59 +00:00
|
|
|
{% extends "base.html" %}
|
|
|
|
{% set active_page = "admin_settings" %}
|
2023-02-20 15:08:09 +00:00
|
|
|
{% block title %}<title>Basic Settings - {{ SITE_NAME }}</title>{% endblock %}
|
2023-02-18 16:04:14 +00:00
|
|
|
|
|
|
|
{% block dashboard_stat %}
|
2023-02-20 15:08:09 +00:00
|
|
|
<div class="content-header">
|
|
|
|
<div class="container-fluid">
|
|
|
|
<div class="row mb-2">
|
|
|
|
<div class="col-sm-6">
|
|
|
|
<h1 class="m-0 text-dark">Basic Settings</h1>
|
|
|
|
</div>
|
|
|
|
<div class="col-sm-6">
|
|
|
|
<ol class="breadcrumb float-sm-right">
|
|
|
|
<li class="breadcrumb-item"><a href="{{ url_for('dashboard.dashboard') }}">Dashboard</a></li>
|
|
|
|
<li class="breadcrumb-item active">Basic Settings</li>
|
|
|
|
</ol>
|
|
|
|
</div>
|
|
|
|
</div>
|
2023-02-18 16:04:14 +00:00
|
|
|
</div>
|
2016-06-18 04:41:01 +00:00
|
|
|
</div>
|
2023-02-18 16:04:14 +00:00
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block content %}
|
2023-02-20 15:08:09 +00:00
|
|
|
<section class="content">
|
|
|
|
<div class="container-fluid">
|
|
|
|
<div class="card card-outline card-primary shadow">
|
|
|
|
<div class="card-header with-border">
|
|
|
|
<h3 class="card-title">Settings Editor</h3>
|
|
|
|
</div>
|
|
|
|
<!-- /.card-header -->
|
|
|
|
<div class="card-body table-responsive">
|
|
|
|
<table id="tbl_settings" class="table table-bordered table-striped table-hover table-sm">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Setting Name</th>
|
|
|
|
<th>Current Value</th>
|
|
|
|
<th>Action</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
{% for setting in settings %}
|
|
|
|
<tr class="odd">
|
|
|
|
<td>
|
|
|
|
<label for="value{{ loop.index }}">{{ setting }}</label>
|
|
|
|
</td>
|
|
|
|
{% if SETTING.get(setting) in [False] %}
|
|
|
|
<td><i class="fas fa-toggle-off"></i> Off</td>
|
|
|
|
<td>
|
|
|
|
<button type="button" class="btn btn-success setting-toggle-button"
|
|
|
|
id="{{ setting }}">
|
|
|
|
<i class="fa-solid fa-toggle-on"></i> Turn On
|
|
|
|
</button>
|
|
|
|
</td>
|
|
|
|
{% elif SETTING.get(setting) in [True] %}
|
|
|
|
<td><i class="fas fa-toggle-on"></i> On</td>
|
|
|
|
<td>
|
|
|
|
<button type="button" class="btn btn-danger setting-toggle-button"
|
|
|
|
id="{{ setting }}">
|
|
|
|
<i class="fa-solid fa-toggle-off"></i> Turn Off
|
|
|
|
</button>
|
|
|
|
</td>
|
|
|
|
{% else %}
|
|
|
|
<td>
|
|
|
|
<input name="value" id="value{{ loop.index }}" value="{{ SETTING.get(setting) }}">
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<button type="button" class="btn btn-primary setting-save-button"
|
2023-02-21 12:57:59 +00:00
|
|
|
id="{{ setting }}" data-target="value{{ loop.index }}">
|
2023-02-20 15:08:09 +00:00
|
|
|
<i class="fa-solid fa-save"></i> Save
|
|
|
|
</button>
|
|
|
|
</td>
|
|
|
|
{% endif %}
|
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
<!-- /.card-body -->
|
|
|
|
</div>
|
|
|
|
<!-- /.card -->
|
|
|
|
</div>
|
|
|
|
<!-- /.container-fluid -->
|
|
|
|
</section>
|
2018-11-21 03:24:33 +00:00
|
|
|
{% endblock %}
|
2023-02-18 16:04:14 +00:00
|
|
|
|
2016-04-29 21:36:37 +00:00
|
|
|
{% block extrascripts %}
|
2023-02-20 15:08:09 +00:00
|
|
|
<script>
|
|
|
|
// set up settings table
|
|
|
|
$("#tbl_settings").DataTable({
|
|
|
|
"paging": false,
|
|
|
|
"lengthChange": false,
|
|
|
|
"searching": true,
|
|
|
|
"ordering": true,
|
|
|
|
"info": true,
|
|
|
|
"autoWidth": false
|
|
|
|
});
|
|
|
|
$(document.body).on('click', '.setting-toggle-button', function () {
|
|
|
|
var setting = $(this).prop('id');
|
|
|
|
applyChanges({
|
|
|
|
'_csrf_token': '{{ csrf_token() }}'
|
|
|
|
}, $SCRIPT_ROOT + '/admin/setting/basic/' + setting + '/toggle', false, true)
|
|
|
|
});
|
2018-11-21 03:24:33 +00:00
|
|
|
|
2023-02-20 15:08:09 +00:00
|
|
|
$(document.body).on('click', '.setting-save-button', function () {
|
|
|
|
var setting = $(this).prop('id');
|
2023-02-21 12:57:59 +00:00
|
|
|
var target = $(this).data('target');
|
|
|
|
var value = $('#' + target).val();
|
2023-02-20 15:08:09 +00:00
|
|
|
var postdata = {
|
|
|
|
'value': value,
|
|
|
|
'_csrf_token': '{{ csrf_token() }}'
|
|
|
|
};
|
|
|
|
applyChanges(postdata, $SCRIPT_ROOT + '/admin/setting/basic/' + setting + '/edit', false, true)
|
|
|
|
});
|
|
|
|
</script>
|
2023-02-18 16:04:14 +00:00
|
|
|
{% endblock %}
|