文件
wangchuanli bff5252ff5 feat: 初始化导航网站项目
添加 Flask 导航站应用,包含 Docker 部署配置、SQLite 数据库、静态资源及 CI/CD 流水线。
2026-08-21 16:36:08 +08:00

118 行
4.2 KiB
HTML

{% extends 'base/base.html' %}
{% block content %}
<div class="ui vertical stripe segment">
<div class="ui container">
{% block customize_header %}
{% endblock%}
<table id="model_table" class="ui stackable celled padded long table sortable small striped">
<thead>
<tr>
{% block customize_table_th %}
{% endblock%}
</tr>
</thead>
<tbody>
{% block customize_table_tr %}
{% endblock%}
</tbody>
</table>
</div>
</div>
<div class="ui modal model_form">
<div class="header">Look at the Actions</div>
<div class="content">
<form class="ui equal width form">
{% block customize_form %}
{% endblock%}
</form>
</div>
<div class="basic actions">
<div class="ui negative button btn_cancel">Cancel</div>
<div class="ui positive button btn_submit">Submit</div>
</div>
</div>
<input id="page_type" value="{{ page_type }}" hidden/>
{% endblock %}
{% block footer_script %}
<script>
$(document).ready(function () {
console.log("start")
var page_type = $("#page_type").val()
$(".url").popup();
$("#model_table").tablesort()
$('#status_switch').checkbox({
onChecked: function () {statusChange(true)},
onUnchecked: function () { statusChange(false) }
});
function statusChange(flag){
$('#status_switch').children('input').attr('checked',flag)
if(flag){
$("#status").val(1);
$('#status_switch').children('label').html('启用')
}else{
$("#status").val(0);
$('#status_switch').children('label').html('禁用')
}
}
$('.btn_add').click(function () {
console.log("add")
$('.model_form').modal('show');
})
$('.btn_submit').click(function () {
let json = $('.form').serialize();
// console.log(json)
$.ajax({
type: "POST",
url: "/customize/"+page_type,
contentType: "application/x-www-form-urlencoded",
data: json,
success: function (res) {
if (res.code === 1) {
location.reload();
}
},
error: function (err) {
console.log(err)
}
})
})
$('.btn_edit').click(function () {
$.ajax({
type: "GET",
url: "/customize/"+page_type+"?id=" + $(this).attr("data-id"),
success: function (res) {
var data = res.data
if (res.code === 1) {
$('.form').find('input').each(function (i, n) {
var obj = $(n)
obj.val(data[obj.attr("name")])
});
statusChange(data['status']==1?true:false)
$('.model_form').modal('show');
}
},
error: function (err) {
console.log(err)
}
})
})
$('.btn_delete').click(function () {
$.ajax({
type: "DELETE",
url: "/customize/"+page_type+"?id=" + $(this).attr("data-id"),
success: function (res) {
if (res.code === 1) {
location.reload();
}
},
error: function (err) {
console.log(err)
}
})
})
})
</script>
{% endblock %}