From d6e68717fdce8c251d899da1cc3bc8803cfc3971 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Fri, 7 Aug 2020 21:35:03 +0800 Subject: [PATCH] Moved the JavaScript on the account list template to a separated JavaScript file in the accounting application. --- .../static/accounting/js/account-list.js | 29 +++++++++++++++++++ .../templates/accounting/account_list.html | 9 +----- 2 files changed, 30 insertions(+), 8 deletions(-) create mode 100644 accounting/static/accounting/js/account-list.js diff --git a/accounting/static/accounting/js/account-list.js b/accounting/static/accounting/js/account-list.js new file mode 100644 index 0000000..41a52d7 --- /dev/null +++ b/accounting/static/accounting/js/account-list.js @@ -0,0 +1,29 @@ +/* The Mia Website + * account-list.js: The JavaScript for the account list + */ + +/* Copyright (c) 2019-2020 imacat. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* Author: imacat@mail.imacat.idv.tw (imacat) + * First written: 2020/8/7 + */ + +// Initializes the page JavaScript. +$(function () { + $('#accounts').DataTable({ + "ordering": false, + }); +}); diff --git a/accounting/templates/accounting/account_list.html b/accounting/templates/accounting/account_list.html index a666590..a45356c 100644 --- a/accounting/templates/accounting/account_list.html +++ b/accounting/templates/accounting/account_list.html @@ -29,6 +29,7 @@ First written: 2020/7/1 {% trans "Accounts" context "Accounting" as text %} {% setvar "title" text %} {% setvar "use_datatables" True %} + {% static "accounting/js/account-list.js" as file %}{% add_js file %} {% endblock %} {% block content %} @@ -79,12 +80,4 @@ First written: 2020/7/1

{{ _("There is currently no data.")|force_escape }}

{% endif %} - - {% endblock %}