[LNT] r282743 - Move common JS operations into a static file
Chris Matthews via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 29 11:16:22 PDT 2016
Author: cmatthews
Date: Thu Sep 29 13:16:22 2016
New Revision: 282743
URL: http://llvm.org/viewvc/llvm-project?rev=282743&view=rev
Log:
Move common JS operations into a static file
Added:
lnt/trunk/lnt/server/ui/static/lnt.js
Modified:
lnt/trunk/lnt/server/ui/templates/layout.html
Added: lnt/trunk/lnt/server/ui/static/lnt.js
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/static/lnt.js?rev=282743&view=auto
==============================================================================
--- lnt/trunk/lnt/server/ui/static/lnt.js (added)
+++ lnt/trunk/lnt/server/ui/static/lnt.js Thu Sep 29 13:16:22 2016
@@ -0,0 +1,46 @@
+ $( function () {
+ // Datatables need to be setup before floating headers!
+ var dttable = $('table.datatable');
+ $.each(dttable,
+ function (k, e) {
+ $(e).DataTable({
+ "paging": false,
+ "ordering": true,
+ "info": false,
+ "filter": false,
+ });
+ }
+ );
+
+ // For each floating header table, start the floatingTHead.
+ var table = $('table.floating_header');
+ $.each(table,
+ function (k, e) {
+ $(e).floatThead({
+ position: 'absolute',
+ top: $('#header').height()-15,
+ });
+ }
+ );
+
+ // Support for long and short dates.
+ var shortDateFormat = 'MMM dd yyyy';
+ var longDateFormat = 'MMM dd yyyy HH:mm:ss';
+
+ $(".shortDateFormat").each(function (idx, elem) {
+ if ($(elem).is(":input")) {
+ $(elem).val($.format.date($(elem).val(), shortDateFormat));
+ } else {
+ $(elem).text($.format.date($(elem).text(), shortDateFormat));
+ }
+ });
+ $(".longDateFormat").each(function (idx, elem) {
+ if ($(elem).is(":input")) {
+ $(elem).val($.format.date($(elem).val(), longDateFormat));
+ } else {
+ $(elem).text($.format.date($(elem).text(), longDateFormat));
+ }
+ });
+ });
+
+
Modified: lnt/trunk/lnt/server/ui/templates/layout.html
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/templates/layout.html?rev=282743&r1=282742&r2=282743&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/templates/layout.html (original)
+++ lnt/trunk/lnt/server/ui/templates/layout.html Thu Sep 29 13:16:22 2016
@@ -29,6 +29,9 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/floatthead/1.4.2/jquery.floatThead.min.js"></script>
+ <script src="{{ url_for('.static', filename='lnt.js') }}"></script>
+
+
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
@@ -106,37 +109,6 @@
{% block javascript %}
{% endblock %}
- $( function () {
- // For each floating header table, start the floatingTHead.
- var table = $('table.floating_header');
- $.each(table,
- function (k, e) {
- $(e).floatThead({
- position: 'absolute',
- top: $('#header').height()-15,
- })
- }
- );
-
- // Support for long and short dates.
- var shortDateFormat = 'MMM dd yyyy';
- var longDateFormat = 'MMM dd yyyy HH:mm:ss';
-
- $(".shortDateFormat").each(function (idx, elem) {
- if ($(elem).is(":input")) {
- $(elem).val($.format.date($(elem).val(), shortDateFormat));
- } else {
- $(elem).text($.format.date($(elem).text(), shortDateFormat));
- }
- });
- $(".longDateFormat").each(function (idx, elem) {
- if ($(elem).is(":input")) {
- $(elem).val($.format.date($(elem).val(), longDateFormat));
- } else {
- $(elem).text($.format.date($(elem).text(), longDateFormat));
- }
- });
- });
</script>
</head>
More information about the llvm-commits
mailing list