From 29f6186e8cd99d5547c841908e729bdf6bfb1d6e Mon Sep 17 00:00:00 2001 From: Pc Date: Tue, 8 Apr 2025 22:51:31 +0200 Subject: [PATCH] TestV2 --- FlaskWebProject/FlaskWebProject.pyproj | 9 +- FlaskWebProject/FlaskWebProject/__init__.py | 41 +++++- .../FlaskWebProject/static/style.css | 100 +++++++++++++-- .../FlaskWebProject/templates/about.html | 10 -- .../FlaskWebProject/templates/contact.html | 20 --- .../FlaskWebProject/templates/index.html | 39 ++---- .../FlaskWebProject/templates/layout.html | 118 ------------------ .../FlaskWebProject/templates/matches.html | 6 +- .../FlaskWebProject/templates/stats.html | 12 +- FlaskWebProject/FlaskWebProject/views.py | 37 ------ 10 files changed, 150 insertions(+), 242 deletions(-) delete mode 100644 FlaskWebProject/FlaskWebProject/templates/about.html delete mode 100644 FlaskWebProject/FlaskWebProject/templates/contact.html delete mode 100644 FlaskWebProject/FlaskWebProject/templates/layout.html delete mode 100644 FlaskWebProject/FlaskWebProject/views.py diff --git a/FlaskWebProject/FlaskWebProject.pyproj b/FlaskWebProject/FlaskWebProject.pyproj index 23f36cb..4a37401 100644 --- a/FlaskWebProject/FlaskWebProject.pyproj +++ b/FlaskWebProject/FlaskWebProject.pyproj @@ -30,7 +30,6 @@ - @@ -41,6 +40,11 @@ + + + + + @@ -64,10 +68,7 @@ - - - diff --git a/FlaskWebProject/FlaskWebProject/__init__.py b/FlaskWebProject/FlaskWebProject/__init__.py index e05ad9b..a67f3f8 100644 --- a/FlaskWebProject/FlaskWebProject/__init__.py +++ b/FlaskWebProject/FlaskWebProject/__init__.py @@ -1,8 +1,39 @@ -""" -The flask application package. -""" +from flask import Flask, render_template -from flask import Flask app = Flask(__name__) -import FlaskWebProject.views +@app.route('/') +def index(): + stats = { + 'goals': 38, + 'assists': 12, + 'matches': 45, + 'matches_list': [ + {'date': '2024-10-12', 'opponent': 'Real Madrid', 'goals': 2, 'assists': 1, 'minutes': 90}, + {'date': '2024-10-19', 'opponent': 'Valencia', 'goals': 1, 'assists': 0, 'minutes': 85}, + # Mo¿esz dodaæ wiêcej meczów... + ] + } + return render_template('index.html', goals=stats['goals'], assists=stats['assists'], + matches=stats['matches'], matches_list=stats['matches_list']) + +@app.route('/mecze') +def mecze(): + # Mo¿esz dostarczyæ szczegó³y dotycz¹ce meczów + matches = [ + {'date': '2024-10-12', 'opponent': 'Real Madrid', 'goals': 2, 'assists': 1, 'minutes': 90}, + {'date': '2024-10-19', 'opponent': 'Valencia', 'goals': 1, 'assists': 0, 'minutes': 85}, + ] + return render_template('matches.html', matches=matches) + +@app.route('/statystyki') +def statystyki(): + stats = { + 'goals': 38, + 'assists': 12, + 'matches': 45, + } + return render_template('stats.html', stats=stats) + +if __name__ == '__main__': + app.run(debug=True) diff --git a/FlaskWebProject/FlaskWebProject/static/style.css b/FlaskWebProject/FlaskWebProject/static/style.css index 3d57bb5..1ec9baa 100644 --- a/FlaskWebProject/FlaskWebProject/static/style.css +++ b/FlaskWebProject/FlaskWebProject/static/style.css @@ -1,4 +1,5 @@ -body { +/* Podstawowy styl */ +body { font-family: 'Arial', sans-serif; margin: 0; padding: 0; @@ -47,16 +48,93 @@ th, td { margin: 20px auto; } -/* Dark Mode */ +/* Styl dla trybu ciemnego */ body.dark-mode { - background-color: #121212; - color: white; -} - -body.dark-mode nav { - background: #333; -} - -body.dark-mode table { + background: #121212; color: #e0e0e0; } + + body.dark-mode nav { + background: #333; + } + + body.dark-mode table { + color: #e0e0e0; + } + + body.dark-mode h1 { + color: #eaeaea; + } + + body.dark-mode header button { + background-color: #444; + color: #eaeaea; + } + + body.dark-mode header button:hover { + background-color: #666; + } + + body.dark-mode ul li { + background-color: #333; + } + + body.dark-mode ul li:hover { + background-color: #444; + } + + /* Dodatkowe style */ + body.dark-mode h1 { + color: #eaeaea; + } + + body.dark-mode header button { + background-color: #444; + color: #eaeaea; + } + + body.dark-mode header button:hover { + background-color: #666; + } + + body.dark-mode ul li { + background-color: #333; + } + + body.dark-mode ul li:hover { + background-color: #444; + } + +/* Przyciski i elementy */ +header button { + padding: 10px 15px; + border: none; + background-color: #007bff; + color: white; + font-size: 16px; + cursor: pointer; + border-radius: 5px; + transition: background-color 0.3s; +} + + header button:hover { + background-color: #0056b3; + } + +/* Style dla listy meczów */ +ul { + list-style: none; + padding: 0; +} + + ul li { + background-color: #eaeaea; + margin-bottom: 10px; + padding: 10px; + border-radius: 5px; + transition: background-color 0.3s; + } + + ul li:hover { + background-color: #d1d1d1; + } diff --git a/FlaskWebProject/FlaskWebProject/templates/about.html b/FlaskWebProject/FlaskWebProject/templates/about.html deleted file mode 100644 index 13d4c7c..0000000 --- a/FlaskWebProject/FlaskWebProject/templates/about.html +++ /dev/null @@ -1,10 +0,0 @@ -{% extends "layout.html" %} - -{% block content %} - -

{{ title }}.

-

{{ message }}

- -

Use this area to provide additional information.

- -{% endblock %} diff --git a/FlaskWebProject/FlaskWebProject/templates/contact.html b/FlaskWebProject/FlaskWebProject/templates/contact.html deleted file mode 100644 index 9bd57e5..0000000 --- a/FlaskWebProject/FlaskWebProject/templates/contact.html +++ /dev/null @@ -1,20 +0,0 @@ -{% extends "layout.html" %} - -{% block content %} - -

{{ title }}.

-

{{ message }}

- -
- One Microsoft Way
- Redmond, WA 98052-6399
- P: - 425.555.0100 -
- -
- Support: Support@example.com
- Marketing: Marketing@example.com -
- -{% endblock %} diff --git a/FlaskWebProject/FlaskWebProject/templates/index.html b/FlaskWebProject/FlaskWebProject/templates/index.html index 78859e3..3fcd49b 100644 --- a/FlaskWebProject/FlaskWebProject/templates/index.html +++ b/FlaskWebProject/FlaskWebProject/templates/index.html @@ -1,33 +1,14 @@ -{% extends "layout.html" %} +{% extends "base.html" %} + +{% block title %}Strona Główna{% endblock %} {% block content %} - -
-

Flask

-

Flask is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.

-

Learn more »

+

Witaj na stronie poświęconej statystykom Roberta Lewandowskiego!

+

Tu znajdziesz najnowsze informacje o meczach, golach, asystach i innych statystykach.

+
+

Ogólne statystyki:

+

Gole: {{ goals }}

+

Asysty: {{ assists }}

+

Liczba meczów: {{ matches }}

- -
-
-

Getting started

-

- Flask gives you a powerful, patterns-based way to build dynamic websites that - enables a clean separation of concerns and gives you full control over markup - for enjoyable, agile development. -

-

Learn more »

-
-
-

Get more libraries

-

The Python Package Index is a repository of software for the Python programming language.

-

Learn more »

-
-
-

Microsoft Azure

-

You can easily publish to Microsoft Azure using Visual Studio. Find out how you can host your application using a free trial today.

-

Learn more »

-
-
- {% endblock %} diff --git a/FlaskWebProject/FlaskWebProject/templates/layout.html b/FlaskWebProject/FlaskWebProject/templates/layout.html deleted file mode 100644 index bf067a7..0000000 --- a/FlaskWebProject/FlaskWebProject/templates/layout.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - - Statystyki Roberta Lewandowskiego - - - - -
-

Statystyki Roberta Lewandowskiego

- -
- Robert Lewandowski -

Napastnik - FC Barcelona / Polska Reprezentacja

-
- -
-
-

{{ goals }}

-

Gole

-
-
-

{{ assists }}

-

Asysty

-
-
-

{{ matches }}

-

Mecze

-
-
- -

Szczegóły Meczy

- - - - - - - - - {% for match in matches %} - - - - - - - - {% endfor %} -
DataPrzeciwnikGoleAsystyMinuty
{{ match.date }}{{ match.opponent }}{{ match.goals }}{{ match.assists }}{{ match.minutes }}
-
- - diff --git a/FlaskWebProject/FlaskWebProject/templates/matches.html b/FlaskWebProject/FlaskWebProject/templates/matches.html index 0574fe8..f6ef2a6 100644 --- a/FlaskWebProject/FlaskWebProject/templates/matches.html +++ b/FlaskWebProject/FlaskWebProject/templates/matches.html @@ -1,7 +1,9 @@ {% extends 'base.html' %} -{% block title %}Historia meczów{% endblock %} + +{% block title %}Lista meczów{% endblock %} + {% block content %} -

Historia ostatnich meczów

+

📅 Mecze Roberta

diff --git a/FlaskWebProject/FlaskWebProject/templates/stats.html b/FlaskWebProject/FlaskWebProject/templates/stats.html index d846fc3..e0c56e1 100644 --- a/FlaskWebProject/FlaskWebProject/templates/stats.html +++ b/FlaskWebProject/FlaskWebProject/templates/stats.html @@ -3,10 +3,10 @@ {% block title %}Statystyki{% endblock %} {% block content %} -

Statystyki Roberta Lewandowskiego

-
    -
  • Gole: {{ stats.goals }}
  • -
  • Asysty: {{ stats.assists }}
  • -
  • Mecze: {{ stats.matches }}
  • -
+

Statystyki Roberta Lewandowskiego

+
    +
  • Gole: {{ stats.goals }}
  • +
  • Asysty: {{ stats.assists }}
  • +
  • Mecze: {{ stats.matches }}
  • +
{% endblock %} diff --git a/FlaskWebProject/FlaskWebProject/views.py b/FlaskWebProject/FlaskWebProject/views.py deleted file mode 100644 index 31bb47d..0000000 --- a/FlaskWebProject/FlaskWebProject/views.py +++ /dev/null @@ -1,37 +0,0 @@ -""" -Routes and views for the flask application. -""" - -from datetime import datetime -from flask import render_template -from FlaskWebProject import app - -@app.route('/') -@app.route('/home') -def home(): - """Renders the home page.""" - return render_template( - 'index.html', - title='Home Page', - year=datetime.now().year, - ) - -@app.route('/contact') -def contact(): - """Renders the contact page.""" - return render_template( - 'contact.html', - title='Contact', - year=datetime.now().year, - message='Your contact page.' - ) - -@app.route('/about') -def about(): - """Renders the about page.""" - return render_template( - 'about.html', - title='About', - year=datetime.now().year, - message='Your application description page.' - )
Data