Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,21 @@ jobs:
black -t py312 --check .
black -t py312 --check web/**/*.py.example
djlint --check .
lint:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.12.1
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install 'djlint==1.36.3'
- name: Check formatting
run: |
djlint --profile=django --lint --ignore "H006,H013,H030,H031,D018,T003" .
unit-tests-sqlite:
runs-on: ubuntu-latest
timeout-minutes: 15
Expand Down
15 changes: 15 additions & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,21 @@ tiedostojen ehjänä pysymistä, joten muutosten tarkastaminen manuaalisesti
formatoinnin jälkeen voi olla tarpeen. Formatoinnit tarkastetaan osana
CI-putkea.

## Lintterit

Lintterit ajetaan osana CI-putkea, ja niiden löytämät ongelmat tulee
korjata ennen PR:ien mergeämistä tai avaamista katselmoitavaksi.

Django-templaattien tarkistamiseen käytetään lintteriä nimeltä djLint. Osa
säännöistä on poistettu käytöstä:

* H006: img-elementtien width- ja height-attribuutit
* H013: img-elementtien alt-attribuutti
* H030: sivujen metatiedot
* H031: sivujen avainsanat
* D018: {% url ... %} templaateissa
* T003: nimetyt endblock tagit templaateissa

## Selityksiä lähdekooditiedostoista

* `web/tupa/`
Expand Down
30 changes: 24 additions & 6 deletions web/media/kipa.css
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ h3
font-size:11px;
}

.etusivunotsikko
.etusivun-otsikko
{
font:20px Georgia,Helvetica,"Lucida Sans Unicode",Tahoma,Verdana,Arial,Helvetica,sans-serif;
letter-spacing:0;
Expand Down Expand Up @@ -148,7 +148,7 @@ h3
text-decoration:underline;
}

.etusivunotsikko img
.etusivun-otsikko img
{
padding:10px;
padding-left:40px;
Expand Down Expand Up @@ -230,7 +230,7 @@ tr .odd:hover
color:#339;
}

.tauluotsikko
.taulu-otsikko
{
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:x-small;
Expand Down Expand Up @@ -352,7 +352,7 @@ tr .odd:hover
background:url(/kipamedia/header.png) repeat-x;
}

#pagetitle {
#page-title {
text-transform:uppercase;
text-decoration:none;
color:#9fa8a9;
Expand All @@ -364,7 +364,7 @@ tr .odd:hover
line-height:normal;
}

#pagetitle a, #pagetitle a:visited {
#page-title a, #page-title a:visited {
text-decoration:none;
color:#9fa8a9;
font-family:Verdana,"Lucida Grande",Lucida,sans-serif;
Expand Down Expand Up @@ -500,4 +500,22 @@ td.th_erotin {

.oneRowInlineForm {
display: flex;
}
}

.login-form {
float:right;
margin-top:-4px;
margin-bottom:0;
padding-bottom:0;
height:18px
}

.tab-selection-box {
border:1px solid gray;
margin-bottom: 1em;
padding: 10px
}

.vapaakaava-input {
width: 100%;
}
13 changes: 13 additions & 0 deletions web/media/tulostaulukko.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.tulostaulukko-solu {
padding-right:10px;
}

.vartiosarake-solu {
min-width:100px;
}

.tulostaulukko-otsikko {
margin:0;
padding:0;
line-height:normal;
}
9 changes: 6 additions & 3 deletions web/templates/404.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<html>
<head></head>
<!DOCTYPE html>
<html lang="fi">
<head>
<title>Sivua ei löydy</title>
</head>
<body>
<h1>404 Sivua ei löydy</h1>
<a href='/kipa/'>alkuun</a>
<a href="/kipa/">alkuun</a>
</body>
</html>
9 changes: 6 additions & 3 deletions web/templates/500.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<html>
<head></head>
<!DOCTYPE html>
<html lang="fi">
<head>
<title>Ohjelmistovirhe</title>
</head>
<body bgcolor="black">
<p>
<br>
<br>
<font color=red size=5>
<b>
<h1>ERROR 500</h1>
Ohjelmistovirhe . Paina <a href='/kipa/'>alkuun</a> jatkaaksesi.
Ohjelmistovirhe . Paina <a href="/kipa/">alkuun</a> jatkaaksesi.
<br>
<br>
Kyborgin kahvimuki : {{ error }}
Expand Down
4 changes: 2 additions & 2 deletions web/templates/admin/base_site.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{% extends "admin/base.html" %}
{% load i18n %}
{% block title %}
{{ title }} | {% trans 'Django site admin' %}
{{ title }} | {% trans "Django site admin" %}
{% endblock %}
{% block branding %}
<h1 id="site-name">{% trans 'Django administration' %}</h1>
<h1 id="site-name">{% trans "Django administration" %}</h1>
{% endblock %}
{% block nav-global %}{% endblock %}
17 changes: 6 additions & 11 deletions web/templates/tupa/base.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<!DOCTYPE html>
<html lang="fi">
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=utf-8"
HTTP-EQUIV="PRAGMA"
CONTENT="NO-CACHE" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="PRAGMA" content="NO-CACHE" />
<title>Kipa -
{% block title %}{% endblock %}
</title>
Expand Down Expand Up @@ -49,14 +48,10 @@
{% include "tupa/vaara_tietokanta.html" %}
<div id="wrap">
<div id="header">
<div id="pageTitle" class="capitalize">
<div id="page-title" class="capitalize">
<a href="/kipa/{{ kisa_nimi }}/">{{ kisa_nimi|alaviiva_pois }}</a>
</div>
<div style="float:right;
margin-top:-4px;
margin-bottom:0;
padding-bottom:0;
height:18px">{% include "tupa/login.html" %}</div>
<div class="login-form">{% include "tupa/login.html" %}</div>
</div>
<div id="breadcrumbs">
{% if tarkistus %}
Expand Down
11 changes: 4 additions & 7 deletions web/templates/tupa/base_riisuttu.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<!DOCTYPE html>
<html lang="fi">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Kipa -
Expand Down Expand Up @@ -37,12 +38,8 @@
<body>
<div id="wrap">
<div id="header">
<div id="pageTitle">Uusi kisa</div>
<div style="float:right;
margin-top:-4px;
margin-bottom:0;
padding-bottom:0;
height:18px">{% include "tupa/login.html" %}</div>
<div id="page-title">Uusi kisa</div>
<div class="login-form">{% include "tupa/login.html" %}</div>
</div>
<div id="breadcrumbs">
<a href="/kipa/">&lt;- Takaisin etusivulle</a>
Expand Down
4 changes: 0 additions & 4 deletions web/templates/tupa/forms/maksimi_suoritus.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
<table>
<tr>
<td width=400>
<font color=red>
<b></b>
</font>
Parhaat pisteet saa:
<br>
<input type="radio"
Expand Down Expand Up @@ -50,7 +47,6 @@
value="{{ kiintea.value }}"
{% if vapaa %}size=80{% endif %} />
<br>
<font color=red><b> </b></font>
Montako kisapistettä jaetaan:
<font color=red>
<b>{{ jaettavat.errors }}</b>
Expand Down
9 changes: 0 additions & 9 deletions web/templates/tupa/forms/nolla_suoritus.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@
Tämä voi olla jokin kiinteä suoritus tai interpoloinnissa keskimmäisestä tuloksesta laskettu.
</p>
<tr valign="top">
<td>
<font color=red>
<b></b>
</font>
</td>
<td></td>
<td>
<fieldset>
<legend>
Expand Down Expand Up @@ -55,9 +49,6 @@
<fieldset>
<legend>Kerroin keskimmäisestä tuloksesta</legend>
<p>
<font color=red>
<b></b>
</font>
<input type="radio"
id="{{ nollan_kerroin.id }}"
value="1.5"
Expand Down
4 changes: 2 additions & 2 deletions web/templates/tupa/forms/osa_tehtava.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ <h1>{{ heading }}</h1>
name="{{ osatehtava.id }}"
value="{{ sarake.tyyppi }}"
onclick=" {% for sa in taulukko %} {% if sa.tyyppi == sarake.tyyppi %} setVisibility('{{ sa.id }}','inline'); {% else %} setVisibility('{{ sa.id }}','none'); {% endif %} {% endfor %} "
{% if sarake.tyyppi == tyyppi %}checked='checked'{% endif %} />
{% if sarake.tyyppi == tyyppi %}checked="checked"{% endif %} />
{{ sarake.otsikko }} &nbsp; &nbsp;
{% endfor %}
{% for sarake in taulukko %}
<div id="{{ sarake.id }}" class='hidden'>
<div id="{{ sarake.id }}" class="hidden">
<table border="0">
<td>{{ sarake.form }}</td>
</table>
Expand Down
2 changes: 1 addition & 1 deletion web/templates/tupa/forms/puhdas_kaava.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<button name="lisaa_maaritteita"
type="submit"
class="small blue awesome"
value='{{ maaritteita.name }}'
value="{{ maaritteita.name }}"
title="Lisää 5 tyhjää kenttää">Lisää 5 kenttää</button>
<br>
<br>
Expand Down
4 changes: 2 additions & 2 deletions web/templates/tupa/forms/vapaa_kaava.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<button name="lisaa_maaritteita"
type="submit"
class="small blue awesome"
value='{{ maaritteita.name }}'
value="{{ maaritteita.name }}"
title="Lisää 5 tyhjää kenttää">Lisää 5 kenttää</button>
<br>
<br>
Expand All @@ -40,7 +40,7 @@
name="{{ kaava.name }}"
id="{{ kaava.id }}"
value="{{ kaava.value }}"
style="width:100%" />
class="vapaakaava-input" />
<br />
<br>
<br>
Expand Down
Loading
Loading