Refactor macros and font family

This commit is contained in:
2023-05-31 14:29:25 +02:00
parent d8285eb2bb
commit 04ea568c71
12 changed files with 212 additions and 121 deletions

View File

@@ -1,67 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>{{ title }}</title>
{% if framework == "bootstrap" %}
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ"
crossorigin="anonymous"
/>
<style>
body {
font-family: Courier;
}
#file-table tbody tr.selected td {
background-color: #0dcaf0;
color: white;
}
#report-table tbody tr.selected td {
background-color: #0dcaf0;
color: white;
}
.btn-small {
padding: 0.25rem 0.5rem;
font-size: 0.75rem;
}
.ajaxLoading {
cursor: progress !important;
}
</style>
{% else %}
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.9.3/css/bulma.min.css"
/>
<style>
body {
font-family: Courier;
}
.tag {
cursor: pointer;
}
.ajaxLoading {
cursor: progress !important;
}
</style>
{% endif %}
<link
rel="stylesheet"
href="https://cdn.datatables.net/1.10.25/css/jquery.dataTables.min.css"
/>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/MaterialDesign-Webfont/7.1.96/css/materialdesignicons.css"
integrity="sha512-lD1LHcZ8tFHvMFNeo6qOLY/HjzSPCasPJOAoir22byDxlZI1R71S5lZel8zRL2TZ+Dut1wOHfYgSU2lHXuL00w=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
/>
</head>
<body>
{% block content %} {% endblock %}
</body>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
{% block jscript %} {% endblock %}
</html>

View File

@@ -0,0 +1,55 @@
<!DOCTYPE html>
<html>
<head>
<title>{{ title }}</title>
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ"
crossorigin="anonymous"
/>
<link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,500,600" rel="stylesheet">
<style>
.alternate-font {
font-family: Arial;
}
tbody {
font-family: Courier;
}
#file-table tbody tr.selected td {
background-color: #0dcaf0;
color: white;
}
#report-table tbody tr.selected td {
background-color: #0dcaf0;
color: white;
}
.btn-small {
padding: 0.25rem 0.5rem;
font-size: 0.75rem;
}
.ajaxLoading {
cursor: progress !important;
}
</style>
<link
rel="stylesheet"
href="https://cdn.datatables.net/1.10.25/css/jquery.dataTables.min.css"
/>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/MaterialDesign-Webfont/7.1.96/css/materialdesignicons.css"
integrity="sha512-lD1LHcZ8tFHvMFNeo6qOLY/HjzSPCasPJOAoir22byDxlZI1R71S5lZel8zRL2TZ+Dut1wOHfYgSU2lHXuL00w=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
/>
</head>
<body>
{% block content %} {% endblock %}
</body>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
{% block jscript %} {% endblock %}
</html>

View File

@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html>
<head>
<title>{{ title }}</title>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.9.3/css/bulma.min.css"
/>
<style>
.alternate-font{
font-family: Arial;
}
tbody {
font-family: Courier;
}
.tag {
cursor: pointer;
}
.ajaxLoading {
cursor: progress !important;
}
</style>
<link
rel="stylesheet"
href="https://cdn.datatables.net/1.10.25/css/jquery.dataTables.min.css"
/>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/MaterialDesign-Webfont/7.1.96/css/materialdesignicons.css"
integrity="sha512-lD1LHcZ8tFHvMFNeo6qOLY/HjzSPCasPJOAoir22byDxlZI1R71S5lZel8zRL2TZ+Dut1wOHfYgSU2lHXuL00w=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
/>
</head>
<body>
{% block content %} {% endblock %}
</body>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
{% block jscript %} {% endblock %}
</html>

View File

@@ -1,4 +1,4 @@
{% extends "base.html" %}
{% extends "base_" ~ framework ~ ".html" %}
{% if framework == "bootstrap" %}
{% set close_button = '<button type="button" class="btn-close btn-small" aria-label="Close" onclick="location.href = \'/index/' ~ compare ~ '\'"></button>' %}
{% set button_class = "btn btn-primary btn-small" %}

View File

@@ -0,0 +1,47 @@
{%- macro header(title) -%}
<div class="p-4 bg-primary text-white">
<h1 class="alternate-font">{{ title }}</h1>
</div>
{%- endmacro -%}
{%- macro get_table_class() -%}
table table-striped table-hover table-bordered
{%- endmacro -%}
{%- macro icon(icon) -%}
<i class="mdi mdi-{{icon}}"></i>
{%- endmacro -%}
{%- macro get_button(text, action) -%}
<button class="btn btn-primary btn-small" onclick="{{ action }}">{{ text|safe }}</button>
{%- endmacro -%}
{%- macro get_button_class() -%}
button btn-primary btn-small
{%- endmacro %}
{%- macro get_button_view(file) -%}
<button class="btn btn-primary btn-small" onclick="showFile('{{ file }}')"><i class="mdi mdi-eye"></i></button>
{%- endmacro -%}
{%- macro get_button_reset() -%}
<button class="btn btn-primary btn-small btn-danger" onclick="setCheckBoxes(false)"><i class="mdi mdi-checkbox-multiple-blank"></i></button>
{%- endmacro -%}
{%- macro get_button_all() -%}
<button class="btn btn-primary btn-small btn-success" onclick="setCheckBoxes(true)"><i class="mdi mdi-checkbox-multiple-marked"></i></button>
{%- endmacro -%}
{%- macro get_tag_class() -%}
badge bg-info bg-small
{%- endmacro -%}
{%- macro get_container_class() -%}
container-fluid
{%- endmacro -%}
{%- macro selected() -%}
selected
{%- endmacro -%}
{%- macro get_level_class() -%}
navbar
{%- endmacro -%}
{%- macro get_align_right() -%}
text-end
{%- endmacro -%}
{%- macro get_left_position() -%}
float-left
{%- endmacro -%}
{%- macro get_right_position() -%}
float-right
{%- endmacro -%}

View File

@@ -0,0 +1,46 @@
{%- macro header(title) -%}
<div class="hero is-info is-bold">
<div class="hero-body">
<h1 class="is-size-3 alternate-font">{{ title }}</h1>
</div>
</div>
{%- endmacro -%}
{%- macro get_table_class() -%}
table is-striped is-hoverable cell-border is-bordered
{%- endmacro -%}
{%- macro icon(icon) -%}
<i class="mdi mdi-{{icon}}"></i>
{%- endmacro -%}
{%- macro get_button(text, action) -%}
<button class="button is-primary is-small" onclick="{{ action }}">{{ text|safe }}</button>
{%- endmacro -%}
{%- macro get_button_view(file) -%}
<span class="tag is-link is-normal" type="button" onclick="showFile('{{ file }}')"><i class="mdi mdi-eye"></i></span>
{%- endmacro -%}
{%- macro get_button_reset() -%}
<span class="tag is-link is-danger" type="button" onclick="setCheckBoxes(false)"><i class="mdi mdi-checkbox-multiple-blank"></i></span>
{%- endmacro -%}
{%- macro get_button_all() -%}
<span class="tag is-link is-success" type="button" onclick="setCheckBoxes(true)"><i class="mdi mdi-checkbox-multiple-marked"></i></span>
{%- endmacro -%}
{%- macro get_tag_class() -%}
tag is-info is-small
{%- endmacro -%}
{%- macro get_container_class() -%}
container is-fluid
{%- endmacro -%}
{%- macro selected() -%}
is-selected
{%- endmacro -%}
{%- macro get_level_class() -%}
level
{%- endmacro -%}
{%- macro get_align_right() -%}
has-text-right
{%- endmacro -%}
{%- macro get_left_position() -%}
float-left
{%- endmacro -%}
{%- macro get_right_position() -%}
float-right
{%- endmacro -%}

View File

@@ -1,4 +1,4 @@
{% extends "base.html" %}
{% extends "base_" ~ framework ~ ".html" %}
{% block content %}
<table id="file-table" class="{{ table_class }}">
<thead>

View File

@@ -16,11 +16,11 @@ $(document).ready(function () {
});
// Check if row is selected
$('#file-table tbody').on('click', 'tr', function () {
if ($(this).hasClass('{{ selected }}')) {
$(this).removeClass('{{ selected }}');
if ($(this).hasClass('{{ select.selected() }}')) {
$(this).removeClass('{{ select.selected() }}');
} else {
table.$('tr.{{ selected }}').removeClass('{{ selected }}');
$(this).addClass('{{ selected }}');
table.$('tr.{{ select.selected() }}').removeClass('{{ select.selected() }}');
$(this).addClass('{{ select.selected() }}');
}
});
// Show file with doubleclick

View File

@@ -1,4 +1,4 @@
<table id="file-table" class="{{ table_class }}">
<table id="file-table" class="{{ select.get_table_class() }}">
<thead>
<tr>
<th>Model</th>
@@ -9,7 +9,7 @@
<th>Stratified</th>
<th>Title</th>
<th>Score</th>
<th>{{ button_reset|safe }} {{ button_all|safe }}</th>
<th>{{ select.get_button_reset()|safe }} {{ select.get_button_all()|safe }}</th>
</tr>
</thead>
<tbody>
@@ -24,12 +24,11 @@
<td>{{ parts[5] }}</td>
<td>{{ 'True' if stratified =='1' else 'False' }}</td>
<td>{{ "%s" % data["title"] }}</td>
<td class="{{ align_right }}">{{ "%.6f" % data["score"] }}</td>
<td class="{{ select.get_align_right() }}">{{ "%.6f" % data["score"] }}</td>
<td>
{{ button_pre | safe }}{{ file }}{{ button_post | safe }}
{{ select.get_button_view(file) | safe }}
<input
type="checkbox"
class="{{ checkbox_class }}"
name="selected_files"
value="{{ file }}"
/>

View File

@@ -1,15 +1,14 @@
<div class="{{ container }}">
<h1 class="{{ h1_class }}"><b>Benchmark Results</b></h1>
<div class="{{ level }}">
<div class="{{ frbutton_position }}">
<button class="{{ button_class }}" onclick="redirectIndex('{{candidate}}')">Use {{ candidate
}}</button>
<button class="{{ button_class }}" onclick="excel()"><i class="mdi mdi-file-excel"></i> Excel</button>
<button class="{{ button_class }}" onclick="redirectDatasets()"><i class="mdi mdi-database-eye"></i> Datasets</button>
<div class="{{ select.get_container_class() }}">
{{ select.header("Benchmark Results") }}
<div class="{{ select.get_level_class() }}">
<div class="{{ select.get_left_position() }}">
{{ select.get_button("Use " ~ candidate, "redirectIndex('" ~ candidate ~ "')")|safe }}
{{ select.get_button(select.icon("excel") ~ " Excel", "excel()")|safe }}
{{ select.get_button(select.icon("database-eye") ~ " Datasets", "redirectDatasets()")|safe }}
</div>
<div class={{ frtag_position }}>
<div class={{ select.get_right_position }}>
<input type="checkbox" id="compare" name="compare" {% if compare %} {{ "checked" }} {% endif %}>
<span class="{{ tag_class }}">Comparing with best results</span>
<span class="{{ select.get_tag_class() }}">Comparing with best results</span>
</div>
</div>
{% include "partials/table_select.html" %}

View File

@@ -1,5 +1,5 @@
{% set title = "Report Viewer" %}
{% extends "base.html" %}
{% extends "base_" ~ framework ~ ".html" %}
{% block content%}
{% if framework == "bootstrap" %}
{% set center = "text-center" %}

View File

@@ -1,36 +1,6 @@
{% set title = "Benchmark Results" %}
{% extends "base.html" %}
{% if framework == "bootstrap" %}
{% set button_class = "btn btn-primary btn-small" %}
{% set h1_class = "text-center" %}
{% set table_class = "table table-striped table-hover table-bordered" %}
{% set button_pre = '<button class="btn btn-primary btn-small"
onclick="showFile(\''%}
{% set button_post = '\')"><i class="mdi mdi-eye"></i></button>' %}
{% set selected = "selected" %}
{% set tag_class = "badge bg-info bg-small" %}
{% set frbutton_position = "float-left" %}
{% set frtag_position = "float-right" %}
{% set level = "navbar" %}
{% set align_right = "text-end" %}
{% set container = "container-fluid" %}
{% set button_reset = '<button class="btn btn-primary btn-small btn-danger" onclick="setCheckBoxes(false)"><i class="mdi mdi-checkbox-multiple-blank"></i></button>' %}
{% set button_all = '<button class="btn btn-primary btn-small btn-success" onclick="setCheckBoxes(true)"><i class="mdi mdi-checkbox-multiple-marked"></i></button>' %}
{% else %}
{% set button_class = "button is-primary is-small" %}
{% set h1_class = "title is-1 has-text-centered" %}
{% set table_class = "table is-striped is-hoverable cell-border is-bordered" %}
{% set button_pre = '<span class="tag is-link is-normal" type="button" onclick="showFile(\'' %}
{% set button_post = '\')"><i class="mdi mdi-eye"></i></span>' %}
{% set selected = "is-selected" %}
{% set align_right = "has-text-right" %}
{% set level = "level" %}
{% set tag_class = "tag is-info is-small" %}
{% set container = "container is-fluid" %}
{% set button_reset = '<span class="tag is-link is-danger" type="button" onclick="setCheckBoxes(false)"><i class="mdi mdi-checkbox-multiple-blank"></i></span>' %}
{% set button_all = '<span class="tag is-link is-success" type="button" onclick="setCheckBoxes(true)"><i class="mdi mdi-checkbox-multiple-marked"></i></span>' %}
{% endif %}
{% extends "base_" ~ framework ~ ".html" %}
{% import "partials/cfg_select_" ~ framework ~ ".jinja" as select %}
{% block content %}
{% include "partials/table_select_design.html" %}
{% endblock %}