diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dfe0770 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index ea62167..0000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1,2 +0,0 @@ -github: [dogukanurker] -custom: ["https://dogukanurker.com/donate"] diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 9b77ea7..0000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: "" -labels: "" -assignees: "" ---- - -**Describe the bug** -A clear and concise description of what the bug is. - -**To Reproduce** -Steps to reproduce the behavior: - -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error - -**Expected behavior** -A clear and concise description of what you expected to happen. - -**Screenshots** -If applicable, add screenshots to help explain your problem. - -**Desktop (please complete the following information):** - -- OS: [e.g. iOS] -- Browser [e.g. chrome, safari] -- Version [e.g. 22] - -**Smartphone (please complete the following information):** - -- Device: [e.g. iPhone6] -- OS: [e.g. iOS8.1] -- Browser [e.g. stock browser, safari] -- Version [e.g. 22] - -**Additional context** -Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 2bc5d5f..0000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: "" -labels: "" -assignees: "" ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/.gitignore b/.gitignore index fd20fdd..5577242 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,75 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class -*.pyc +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.coverage +.tox/ +.nox/ +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.venv/* +__pycache__/app.cpython-311.pyc diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..ec96ada --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,10 @@ +{ + "cSpell.words": [ + "bootswatch", + "jsonify", + "pytest", + "sqla", + "sqlalchemy", + "todos" + ] +} \ No newline at end of file diff --git a/Code-assistant-sandbox.code-workspace b/Code-assistant-sandbox.code-workspace new file mode 100644 index 0000000..50975b5 --- /dev/null +++ b/Code-assistant-sandbox.code-workspace @@ -0,0 +1,13 @@ +{ + "folders": [ + { + "path": "." + } + ], + "settings": { + "cSpell.words": [ + "sqlalchemy", + "venv" + ] + } +} \ No newline at end of file diff --git a/LICENSE b/LICENSE index 33f9218..4d55b09 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 DoฤŸukan Mete รœrker +Copyright (c) 2023 Hubert Nafalski Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index eb20172..2ab5b17 100644 --- a/README.md +++ b/README.md @@ -1,40 +1,36 @@ -# [flaskToDoโœ…](https://dogukanurker.com/flasktodo) +# How to start -Simple todo app built with Flask. -
-[Contact](mailto:dogukanurker@icloud.com)
-[Dogukan Urker](https://dogukanurker.com) -### [Demo Video ๐Ÿ“บ](https://youtu.be/GmPeXhBiihI) -| Desktop | Mobile | -| :--------------------------------: | :-------------------------------: | -| ![appDesktop](/images/desktop.png) | ![appMobile](/images/mobile.jpeg) | +## Windows -## Requirements ๐Ÿ“ฆ +```console +REM initialization +python -m venv .venv +call .venv\Scripts\activate -- Flask -- Flaskwebgui (if you run desktop.py) +pip install -r requirements.txt -## Installation โฌ‡๏ธ +REM change firewall settings to open port 5000 for incoming TCP trafic (run in powershell as Administrator): +REM netsh advfirewall firewall add rule name="Open Port 5000 for Flask web server" dir=in action=allow protocol=TCP localport=5000 -download source code from Github ๐Ÿ’พ -`git clone https://github.com/DogukanUrker/flaskToDo.git` +set FLASK_APP=app.py +set FLASK_ENV=development +REM run in debug mode (auto reload on code change) +set FLASK_DEBUG=1 +flask run --host=0.0.0.0 +``` -go to directory ๐Ÿ“ -`cd flaskToDo` +## Linux/MacOS -install requirements.txt ๐Ÿ”ฝ -`pip install -r requirements.txt` +```console +# initialization +python -m venv .venv +source .venv/bin/activate -it's ready to run ๐ŸŽ‰ -`python app.py` -or -`python desktop.py` -for run flaskToDo as a desktop app ๐Ÿ’ฏ +pip install -r requirements.txt -### Contributors ๐Ÿ’• - - - -### Support ๐Ÿ’ฐ - -Buy Me A Coffee +export FLASK_APP=app.py +export FLASK_ENV=development +# run in debug mode (auto reload on code change) +export FLASK_DEBUG=1 +flask run --host=0.0.0.0 +``` diff --git a/app.py b/app.py old mode 100644 new mode 100755 index 3e708f5..e5b55f7 --- a/app.py +++ b/app.py @@ -1,88 +1,66 @@ -import socket -import sqlite3 -import secrets -import dbChecker -from datetime import datetime -from flask import Flask, render_template, redirect +from flask import Flask, render_template, request, redirect, url_for, flash +from flask_sqlalchemy import SQLAlchemy +from flask_wtf.csrf import CSRFProtect app = Flask(__name__) -app.secret_key = secrets.token_urlsafe(32) +# /// = relative path, //// = absolute path +app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///db.sqlite' +app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False +app.config['SECRET_KEY'] = 'dev-secret-key-change-in-production' +db = SQLAlchemy(app) +csrf = CSRFProtect(app) -def currentDate(): - return datetime.now().strftime("%d.%m.%y") +class Todo(db.Model): + id = db.Column(db.Integer, primary_key=True) + title = db.Column(db.String(100)) + complete = db.Column(db.Boolean) +with app.app_context(): + db.create_all() -def currentTime(): - return datetime.now().strftime("%H:%M") - - -@app.route("/") +@app.get("/") def index(): - connection = sqlite3.connect("todos.db") - cursor = connection.cursor() - cursor.execute("select * from todos") - todos = cursor.fetchall() - return render_template("/index.html", todos=todos) - - -@app.route("/add/") -def add(todo): - connection = sqlite3.connect("todos.db") - cursor = connection.cursor() - cursor.execute( - f'insert into todos(todo,date,time) values("{todo}","{currentDate()}","{currentTime()}")' - ) - connection.commit() - return redirect("/") - - -@app.route("/check/") -def check(id): - connection = sqlite3.connect("todos.db") - cursor = connection.cursor() - cursor.execute(f'update todos set status = "True" where id = {id}') - cursor.execute(f'update todos set editDate = "{currentDate()}" where id = {id}') - cursor.execute(f'update todos set editTime = "{currentTime()}" where id = {id}') - connection.commit() - return redirect("/") - - -@app.route("/uncheck/") -def uncheck(id): - connection = sqlite3.connect("todos.db") - cursor = connection.cursor() - cursor.execute(f'update todos set status = "False" where id = {id}') - connection.commit() - return redirect("/") - - -@app.route("/edit//") -def edit(id, todo): - connection = sqlite3.connect("todos.db") - cursor = connection.cursor() - cursor.execute(f'update todos set todo = "{todo}" where id = {id}') - connection.commit() - return redirect("/") - - -@app.route("/delete/") -def delete(id): - connection = sqlite3.connect("todos.db") - cursor = connection.cursor() - cursor.execute(f"delete from todos where id = {id}") - cursor.execute(f"update sqlite_sequence set seq = seq-1") - connection.commit() - return redirect("/") - - -@app.errorhandler(404) -def page_not_found(e): - return render_template("404.html"), 404 - - -if __name__ == "__main__": - app.run( - debug=True, - host=socket.gethostbyname(socket.gethostname()), - ) + return render_template("index.html") + +@app.get("/list") +def list(): + todo_list = db.session.query(Todo).all() + return render_template("list.html", todo_list=todo_list) + +@app.get("/todo/") +def todo(todo_id): + todo = db.session.query(Todo).filter(Todo.id == todo_id).first() + if todo is None: + return f"No Todo item {todo_id} found.", 404 + return render_template("todo.html", todo=todo) + +@app.post("/add") +def add(): + title = request.form.get("title", "").strip() + if not title: + flash("Title cannot be empty.", "error") + return redirect(url_for("list")) + if len(title) > 100: + flash("Title must be 100 characters or fewer.", "error") + return redirect(url_for("list")) + new_todo = Todo(title=title, complete=False) + db.session.add(new_todo) + db.session.commit() + return redirect(url_for("list")) + + +@app.post("/update/") +def update(todo_id): + todo = db.get_or_404(Todo, todo_id) + todo.complete = not todo.complete + db.session.commit() + return redirect(url_for("list")) + + +@app.post("/delete/") +def delete(todo_id): + todo = db.get_or_404(Todo, todo_id) + db.session.delete(todo) + db.session.commit() + return redirect(url_for("list")) diff --git a/dbChecker.py b/dbChecker.py deleted file mode 100644 index ef3f700..0000000 --- a/dbChecker.py +++ /dev/null @@ -1,27 +0,0 @@ -import sqlite3 -from os.path import exists - -if exists("todos.db") == False: - open("todos.db", "x") - -connection = sqlite3.connect("todos.db") -cursor = connection.cursor() - -try: - cursor.execute("""SELECT * FROM todos; """).fetchall() - connection.close() -except: - todosTable = """ - CREATE TABLE "todos" ( - "id" INTEGER, - "todo" TEXT, - "date" TEXT, - "time" TEXT, - "status" TEXT DEFAULT 'False', - "editDate" TEXT, - "editTime" INTEGER, - PRIMARY KEY("id" AUTOINCREMENT) - );""" - cursor.execute(todosTable) - connection.commit() - connection.close() diff --git a/demo.mp4 b/demo.mp4 deleted file mode 100644 index d7e4565..0000000 Binary files a/demo.mp4 and /dev/null differ diff --git a/desktop.py b/desktop.py deleted file mode 100644 index 427597c..0000000 --- a/desktop.py +++ /dev/null @@ -1,4 +0,0 @@ -from flaskwebgui import FlaskUI -from app import app - -FlaskUI(app=app, server="flask").run() diff --git a/docs/CODE_OF_CONDUCT.md b/docs/CODE_OF_CONDUCT.md deleted file mode 100644 index 1bc0ae0..0000000 --- a/docs/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,128 +0,0 @@ -# Contributor Covenant Code of Conduct - -## Our Pledge - -We as members, contributors, and leaders pledge to make participation in our -community a harassment-free experience for everyone, regardless of age, body -size, visible or invisible disability, ethnicity, sex characteristics, gender -identity and expression, level of experience, education, socio-economic status, -nationality, personal appearance, race, religion, or sexual identity -and orientation. - -We pledge to act and interact in ways that contribute to an open, welcoming, -diverse, inclusive, and healthy community. - -## Our Standards - -Examples of behavior that contributes to a positive environment for our -community include: - -- Demonstrating empathy and kindness toward other people -- Being respectful of differing opinions, viewpoints, and experiences -- Giving and gracefully accepting constructive feedback -- Accepting responsibility and apologizing to those affected by our mistakes, - and learning from the experience -- Focusing on what is best not just for us as individuals, but for the - overall community - -Examples of unacceptable behavior include: - -- The use of sexualized language or imagery, and sexual attention or - advances of any kind -- Trolling, insulting or derogatory comments, and personal or political attacks -- Public or private harassment -- Publishing others' private information, such as a physical or email - address, without their explicit permission -- Other conduct which could reasonably be considered inappropriate in a - professional setting - -## Enforcement Responsibilities - -Community leaders are responsible for clarifying and enforcing our standards of -acceptable behavior and will take appropriate and fair corrective action in -response to any behavior that they deem inappropriate, threatening, offensive, -or harmful. - -Community leaders have the right and responsibility to remove, edit, or reject -comments, commits, code, wiki edits, issues, and other contributions that are -not aligned to this Code of Conduct, and will communicate reasons for moderation -decisions when appropriate. - -## Scope - -This Code of Conduct applies within all community spaces, and also applies when -an individual is officially representing the community in public spaces. -Examples of representing our community include using an official e-mail address, -posting via an official social media account, or acting as an appointed -representative at an online or offline event. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported to the community leaders responsible for enforcement at -dogukanurker@icloud.com. -All complaints will be reviewed and investigated promptly and fairly. - -All community leaders are obligated to respect the privacy and security of the -reporter of any incident. - -## Enforcement Guidelines - -Community leaders will follow these Community Impact Guidelines in determining -the consequences for any action they deem in violation of this Code of Conduct: - -### 1. Correction - -**Community Impact**: Use of inappropriate language or other behavior deemed -unprofessional or unwelcome in the community. - -**Consequence**: A private, written warning from community leaders, providing -clarity around the nature of the violation and an explanation of why the -behavior was inappropriate. A public apology may be requested. - -### 2. Warning - -**Community Impact**: A violation through a single incident or series -of actions. - -**Consequence**: A warning with consequences for continued behavior. No -interaction with the people involved, including unsolicited interaction with -those enforcing the Code of Conduct, for a specified period of time. This -includes avoiding interactions in community spaces as well as external channels -like social media. Violating these terms may lead to a temporary or -permanent ban. - -### 3. Temporary Ban - -**Community Impact**: A serious violation of community standards, including -sustained inappropriate behavior. - -**Consequence**: A temporary ban from any sort of interaction or public -communication with the community for a specified period of time. No public or -private interaction with the people involved, including unsolicited interaction -with those enforcing the Code of Conduct, is allowed during this period. -Violating these terms may lead to a permanent ban. - -### 4. Permanent Ban - -**Community Impact**: Demonstrating a pattern of violation of community -standards, including sustained inappropriate behavior, harassment of an -individual, or aggression toward or disparagement of classes of individuals. - -**Consequence**: A permanent ban from any sort of public interaction within -the community. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], -version 2.0, available at -https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. - -Community Impact Guidelines were inspired by [Mozilla's code of conduct -enforcement ladder](https://github.com/mozilla/diversity). - -[homepage]: https://www.contributor-covenant.org - -For answers to common questions about this code of conduct, see the FAQ at -https://www.contributor-covenant.org/faq. Translations are available at -https://www.contributor-covenant.org/translations. diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md deleted file mode 100644 index 869016c..0000000 --- a/docs/CONTRIBUTING.md +++ /dev/null @@ -1,92 +0,0 @@ -# Contributing - -When contributing to this repository, please first discuss the change you wish to make via issue, -email, or any other method with the owners of this repository before making a change. - -Please note we have a code of conduct, please follow it in all your interactions with the project. - -## Pull Request Process - -1. Ensure any install or build dependencies are removed before the end of the layer when doing a - build. -2. Update the README.md with details of changes to the interface, this includes new environment - variables, exposed ports, useful file locations and container parameters. -3. Increase the version numbers in any examples files and the README.md to the new version that this - Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/). -4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you - do not have permission to do that, you may request the second reviewer to merge it for you. - -## Code of Conduct - -### Our Pledge - -In the interest of fostering an open and welcoming environment, we as -contributors and maintainers pledge to making participation in our project and -our community a harassment-free experience for everyone, regardless of age, body -size, disability, ethnicity, gender identity and expression, level of experience, -nationality, personal appearance, race, religion, or sexual identity and -orientation. - -### Our Standards - -Examples of behavior that contributes to creating a positive environment -include: - -- Using welcoming and inclusive language -- Being respectful of differing viewpoints and experiences -- Gracefully accepting constructive criticism -- Focusing on what is best for the community -- Showing empathy towards other community members - -Examples of unacceptable behavior by participants include: - -- The use of sexualized language or imagery and unwelcome sexual attention or - advances -- Trolling, insulting/derogatory comments, and personal or political attacks -- Public or private harassment -- Publishing others' private information, such as a physical or electronic - address, without explicit permission -- Other conduct which could reasonably be considered inappropriate in a - professional setting - -### Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable -behavior and are expected to take appropriate and fair corrective action in -response to any instances of unacceptable behavior. - -Project maintainers have the right and responsibility to remove, edit, or -reject comments, commits, code, wiki edits, issues, and other contributions -that are not aligned to this Code of Conduct, or to ban temporarily or -permanently any contributor for other behaviors that they deem inappropriate, -threatening, offensive, or harmful. - -### Scope - -This Code of Conduct applies both within project spaces and in public spaces -when an individual is representing the project or its community. Examples of -representing a project or community include using an official project e-mail -address, posting via an official social media account, or acting as an appointed -representative at an online or offline event. Representation of a project may be -further defined and clarified by project maintainers. - -### Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team at dogukanurker@icloud.com. All -complaints will be reviewed and investigated and will result in a response that -is deemed necessary and appropriate to the circumstances. The project team is -obligated to maintain confidentiality with regard to the reporter of an incident. -Further details of specific enforcement policies may be posted separately. - -Project maintainers who do not follow or enforce the Code of Conduct in good -faith may face temporary or permanent repercussions as determined by other -members of the project's leadership. - -### Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, -available at [http://contributor-covenant.org/version/1/4][version] - -[homepage]: http://contributor-covenant.org -[version]: http://contributor-covenant.org/version/1/4/ diff --git a/docs/SECURITY.md b/docs/SECURITY.md deleted file mode 100644 index 32a5c89..0000000 --- a/docs/SECURITY.md +++ /dev/null @@ -1,7 +0,0 @@ -# Security Policy - -Use latest version on [dogukanurker/flaskToDo](https://github.com/DogukanUrker/flaskToDo) - -## Reporting a Vulnerability - -contact: dogukanurker@icloud.com diff --git a/docs/bug_report.md b/docs/bug_report.md deleted file mode 100644 index 9b77ea7..0000000 --- a/docs/bug_report.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: "" -labels: "" -assignees: "" ---- - -**Describe the bug** -A clear and concise description of what the bug is. - -**To Reproduce** -Steps to reproduce the behavior: - -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error - -**Expected behavior** -A clear and concise description of what you expected to happen. - -**Screenshots** -If applicable, add screenshots to help explain your problem. - -**Desktop (please complete the following information):** - -- OS: [e.g. iOS] -- Browser [e.g. chrome, safari] -- Version [e.g. 22] - -**Smartphone (please complete the following information):** - -- Device: [e.g. iPhone6] -- OS: [e.g. iOS8.1] -- Browser [e.g. stock browser, safari] -- Version [e.g. 22] - -**Additional context** -Add any other context about the problem here. diff --git a/docs/feature_request.md b/docs/feature_request.md deleted file mode 100644 index 2bc5d5f..0000000 --- a/docs/feature_request.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: "" -labels: "" -assignees: "" ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/docs/pull_request_template.md b/docs/pull_request_template.md deleted file mode 100644 index b89b6ff..0000000 --- a/docs/pull_request_template.md +++ /dev/null @@ -1,7 +0,0 @@ -Fixes # - -## Proposed Changes - -- -- -- diff --git a/images/desktop.png b/images/desktop.png deleted file mode 100644 index 18129ef..0000000 Binary files a/images/desktop.png and /dev/null differ diff --git a/images/mobile.jpeg b/images/mobile.jpeg deleted file mode 100644 index a102dc2..0000000 Binary files a/images/mobile.jpeg and /dev/null differ diff --git a/requirements.txt b/requirements.txt index 0ca185b..5794bcb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,11 @@ -Flask==2.2.2 -flaskwebgui==1.0.3 +blinker==1.9.0 +click==8.3.1 +Flask==3.1.3 +Flask-SQLAlchemy==3.1.1 +Flask-WTF==1.2.2 +itsdangerous==2.2.0 +Jinja2==3.1.6 +MarkupSafe==3.0.3 +SQLAlchemy==2.0.48 +typing_extensions==4.15.0 +Werkzeug==3.1.6 diff --git a/run.bat b/run.bat new file mode 100644 index 0000000..4b0f3c6 --- /dev/null +++ b/run.bat @@ -0,0 +1,13 @@ +@ECHO OFF +chcp 65001 +cls +REM activate virtual environment +call .venv\Scripts\activate + +ECHO Naciล›nij CTRL + C aby zatrzymaฤ‡ +ECHO. +set FLASK_APP=app.py +set FLASK_ENV=development +REM run in debug mode (auto reload on code change) +set FLASK_DEBUG=1 +flask run --host=0.0.0.0 diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..2f88c3e --- /dev/null +++ b/run.sh @@ -0,0 +1,5 @@ +export FLASK_APP=app.py +export FLASK_ENV=development +export FLASK_DEBUG=1 +flask run --host=0.0.0.0 --port=5050 + diff --git a/static/css/styles.css b/static/css/styles.css deleted file mode 100644 index 05e6037..0000000 --- a/static/css/styles.css +++ /dev/null @@ -1,166 +0,0 @@ -html { - font-size: 175%; -} - -* { - font-family: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; - color: #333745; - user-select: none; - text-align: center; - transition: 0.2s; -} - -body::-webkit-scrollbar { - width: 0.3rem; -} - -body::-webkit-scrollbar-thumb { - border-radius: 1rem; - background: #333745; -} - -body::-webkit-scrollbar-track, -body::-webkit-scrollbar-button { - background: transparent; -} - -a { - text-decoration: none; -} - -h1 { - text-align: left; -} - -h6 { - font-size: 1.25rem; - margin: 0; -} - -.container { - display: block; - margin: 2rem auto 0 auto; - width: 80%; -} - -.btnAdd { - padding: 0.3rem; - font-size: 1rem; - background-color: #C8F6EA; - border-radius: 0.25rem; - border: 0; - cursor: pointer; - margin: 1rem 0 0 1.5rem; -} - -.btnAdd:hover { - background-color: #B9F3E4; -} - -.btnAdd:focus { - box-shadow: #C8F6EA; -} - -.inputToDo { - border: 1px solid #C8F6EA; - border-radius: 0.25rem; - height: 2rem; - width: 80%; - padding: 0.25rem; - font-size: 1rem; - transition: 0s; -} - -.inputToDo:focus { - outline: 2px solid #C8F6EA; -} - -.notCompletedToDos, .completedToDos { - display: flex; - justify-content: space-between; -} - -.todoContent { - width: 60%; - user-select: text; - border: 0; - cursor: default; - background-color: transparent; -} - -.todoContent:focus { - outline: none; -} - -.todoID { - display: none; -} - -.notCompletedToDos *, .completedToDos * { - display: flex; - align-items: center; - justify-content: center; -} - -.notCompletedToDos, .completedToDos { - padding: 0.5rem; -} - -.completedToDos .todoContent { - text-decoration: line-through; - text-decoration-color: #333745; - text-decoration-thickness: 0.15rem; -} - -.completedToDos:hover, .notCompletedToDos:hover { - background-color: #F3FDFA; - border-radius: 0.5rem; -} - -.todoContent { - font-size: 1.25rem; -} - -.delete, .todoStatus { - width: 1rem; -} - -.delete a:hover, .todoStatus:hover { - font-size: 1.2rem; -} - -.btnSave { - color: #000; - border: 0; - cursor: pointer; - background-color: transparent; - transition: 0.2s; - font-size: 0; - height: fit-content; - margin: auto 0 auto 0; -} - -.todoContent:focus+.btnSave { - font-size: 0.75rem; -} - -.notFoundContainer { - position: absolute; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - margin: 0; -} - -.notFound { - font-size: 6rem; - margin: 0; -} - -.goHome { - font-size: 3rem; -} - -.goHome:hover { - font-size: 6rem; -} \ No newline at end of file diff --git a/static/js/script.js b/static/js/script.js deleted file mode 100644 index cb177ef..0000000 --- a/static/js/script.js +++ /dev/null @@ -1,15 +0,0 @@ -function todo() { - var input = document.querySelector(".inputToDo").value; - if (input === "" || input.replace(/\s/g, "") === "") { - } else { - window.location.href = `/add/${input}`; - } -} -function editToDo() { - var todo = document.querySelector(".todoContent").value; - var todoID = document.querySelector(".todoID").innerHTML; - if (todo === "" || todo.replace(/\s/g, "") === "") { - } else { - window.location.href = `/edit/${todoID}/${todo}`; - } -} diff --git a/templates/404.html b/templates/404.html deleted file mode 100644 index 8a41b66..0000000 --- a/templates/404.html +++ /dev/null @@ -1,14 +0,0 @@ -you lost - - - -

404

-
PAGE NOT FOUND
- ๐Ÿ  - diff --git a/templates/index.html b/templates/index.html index f5c5396..04ac6e5 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,53 +1,26 @@ -flaskToDo - - - -

Todos

- {% for todo in todos %}{% if todo[4] == "False" %} -

{{todo[0]}}

-
-
- ๐Ÿ”ฒ + + + + + + + Todo App + + + + + + +
+

To Do App

+

+ This is a simple todo app built with Flask and SQLAlchemy. It uses the Semantic UI framework for styling. +

+ +
+

Here you can open the list of Todos: link

+
- - -

- {{todo[3]}}
- {{todo[2]}} -

- -
- {% endif %}{% endfor %} {% for todo in todos %} {% if todo[4] == "True" %} -
-
- โœ… -
- - -

- {{todo[6]}}
- {{todo[5]}} -

- -
- {% endif %} {% endfor %} -
- - -
- + + \ No newline at end of file diff --git a/templates/list.html b/templates/list.html new file mode 100755 index 0000000..b19eca4 --- /dev/null +++ b/templates/list.html @@ -0,0 +1,65 @@ + + + + + + + Todo App + + + + + + +
+

To Do App

+ + {% with messages = get_flashed_messages(with_categories=true) %} + {% if messages %} + {% for category, message in messages %} +
+

{{ message }}

+
+ {% endfor %} + {% endif %} + {% endwith %} + +
+ +
+ +
+
+ +
+ +
+ + {% for todo in todo_list %} +
+

{{todo.id }} | {{ todo.title }}

+ + {% if todo.complete == False %} + Not Complete + {% else %} + Completed + {% endif %} + +
+ + +
+
+ + +
+
+ {% endfor %} + +
+ + back to home page +
+ + + \ No newline at end of file diff --git a/templates/todo.html b/templates/todo.html new file mode 100644 index 0000000..e89f9fb --- /dev/null +++ b/templates/todo.html @@ -0,0 +1,42 @@ + + + + + + + Todo App + + + + + + +
+

To Do App

+ +
+

{{todo.id }} | {{ todo.title }}

+ + {% if todo.complete == False %} + Not Complete + {% else %} + Completed + {% endif %} + +
+ + +
+
+ + +
+
+ +
+ + back to home page +
+ + + \ No newline at end of file diff --git a/todos.db b/todos.db deleted file mode 100644 index 12ada0d..0000000 Binary files a/todos.db and /dev/null differ diff --git a/use_cases.md b/use_cases.md new file mode 100644 index 0000000..eaad54f --- /dev/null +++ b/use_cases.md @@ -0,0 +1,72 @@ +# Use cases list + +## GitHub Copilot + +### plugins + +* [Copilot](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot) +* [Copilot Chat](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot-chat) + +### inline hints + +* sort by tile +* separate id and title +* make id bigger and blue + +### shortcuts & UI + +* `ctrl+space` - show suggestions +* `ctrl+enter` - accept suggestion +* `โŒƒ โŒ˜ I` - Opens the Chat view +* `โŒƒ L` - Clears the Chat view +* `โŒ˜ โ†“` - Moves keyboard focus to the Chat view input box + +### agents + +* `@workspace` - suggest code from your workspace +* `@vscode` - knows about commands and features in the VS Code editor itself, and can help you use them. +* `@terminal` - has context about the integrated terminal shell and its contents. + * `@terminal #terminalLastCommand` + +### slash commands + +* `/explain` - explain the code + * `app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False` +* `/fix` - fix the code + + ```bash + # remove db.session.commit() from add() + # prompt: data is not stored in db + ``` +* `/doc` - show documentation + + ```python + class Todo(db.Model): + ``` +* `/tests` - run tests + +```bash +python -m unittest ./test_app.py +# or +pytest -r test_app.py +``` + +* `/chat` - chat with copilot + +`add new route to that returns all todos as json` + +`rewrite selected function by adding type hints to all variables` + +```python +@app.get("/update/") +def update(todo_id): +``` + +### cli + + +```bash +gh copilot suggest "prompt" +``` + +