First prototype

master
km0 2 years ago
commit 3752d4cc55

1
.gitignore vendored

@ -0,0 +1 @@
.ipynb_checkpoints

@ -0,0 +1,33 @@
# WORKINON
A small and shared archive to keep track of how ideas change during work, research and development
A call to share what we are doing with others, while we are doing it.
In a way that doesn't focus on results, but on process and sharing.
## How does it work
The core of Workinon is a small API that read and write updates to a JSON file.
The inputs can be received through a form from the application page.
## Structure of the JSON:
a list of projects, and each update has a codename and a list of steps
(since this is a first prototype this could change anytime)
(it's already changed 3 times while writing this initial documentation ah ah)
`JSON
{
"Workin title of the project or idea": [
{
"when": "13.05.2022",
"what": "First idea of the project"
},
]
}
`
To insert a new project just send in the first step and a name
to update with a new step just refer to the name you used the first time and add the new step
this structure is not super robust.
if two different project use the same codename, this could lead to interferences between the two
so one suggestion for the usage of the Workinon could be to choose a really really really personal title

@ -0,0 +1 @@
{"workinon": [{"when": "13.05.2022", "what": "First prototype for a small and shared archive to keep track of how ideas change during work, research and development"}, {"when": "13.05.2022", "what": "Little API to read and write new updates for projects"}, {"when": "13.05.2022", "what": "JSON test"}, {"when": "13.05.2022", "what": "JSON test and redirect"}], "k-pub": [{"when": "21.10.2021", "what": "Using karaoke as a form of republishing"}, {"when": "13.05.2022", "what": "test test it;'s a est"}], "mod cms": [{"when": "13.05.2022", "what": "store synth configurations to build a workbook"}]}

@ -0,0 +1,100 @@
* {
box-sizing: border-box;
max-width: 60ch;
}
html, body {
font-family: sans-serif;
font-size: 24px;
line-height: 1.5;
color: #3D9970;
max-width: 100%;
margin: 12px;
}
h1 {
margin-top: 0;
}
h2, h3 {
margin: 0;
}
form {
width: 40ch;
display: inline-block;
margin: 64px 0;
padding: 16px;
border: 1px dashed currentColor;
}
form > * + * {
margin-top: 16px;
}
input, textarea {
display: block;
border: 1px solid currentColor;
color: currentColor;
padding: 8px;
background: none;
}
input[type="submit"]{
cursor: pointer;
}
input[type="submit"]:hover{
color: white;
background-color: #3D9970;
}
textarea {
width: 100%;
min-height: 10em;
max-width: 100%;
}
dl {
max-width: 100%;
display: flex;
flex-wrap: wrap;
}
dl > * {
flex-grow: 0;
padding: 0;
margin: 0;
}
dt {
flex-basis: 30%;
}
dd {
flex-basis: 70%;
margin-bottom: 32px;
}
@media (max-width: 991.98px) {
html, body {
margin: 6px;
}
dl {
display: block;
}
dt {
margin: 6px 0;
font-style: italic;
}
}

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="{{url_for('static', filename='style.css')}}">
<title>Workinon</title>
</head>
<body>
<h1>What's new?</h1>
<form action="" method="POST">
<input type="text" name="name" placeholder="Project" />
<textarea type="text" name="update" placeholder="What's new?"></textarea>
<input type="submit" value="Archive" />
</form>
</body>
</html>

@ -0,0 +1,42 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="{{url_for('static', filename='style.css')}}">
<title>Workinon</title>
</head>
<body>
<h1>Workinon</h1>
<div>
A small and shared archive to keep track of how ideas change during work, research and development. <br/>
A call to share what we are doing with others, while we are doing it. <br/>
In a way that doesn't focus on results, but on process and sharing.
</div>
<form action="add" method="POST">
<h3>
What's new?
</h3>
<input type="text" name="name" placeholder="Project" />
<textarea name="update" placeholder="Tell us more" ></textarea>
<input type="submit" value="Archive" />
</form>
<h2>Current archive</h2>
<dl>
{% for key, value in projects | dictsort %}
<dt>{{key}}</dt>
<dd>
{%for step in value%}
{{step['when']}}, {{step['what']}} <br/>
{%endfor%}
</dd>
{% endfor %}
</dl>
</body>
</html>

@ -0,0 +1,115 @@
# WORKINON
# A small and shared archive to keep track of how ideas change during work, research and development
# A call to share what we are doing with others, while we are doing it.
# In a way that doesn't focus on results, but on process and sharing.
# How does it work
# The core of Workinon is a small API that read and write updates to a JSON file.
# The inputs can be received through a form from the application page.
# Structure of the JSON:
# a list of projects, and each update has a codename and a list of steps
# (since this is a first prototype this could change anytime)
# (it's already changed 3 times while writing this initial documentation ah ah)
# {
# 'Workin title of the project or idea': [
# {'13.05.2022', 'First idea of the project'},
# {'14.05.2022', 'Second thoughts'},
# {'15.05.2022', 'Something new and now everything makes sense'}
# ]
# }
# To insert a new project just send in the first step and a name
# to update with a new step just refer to the name you used the first time and add the new step
# this structure is not super robust.
# if two different project use the same codename, this could lead to interferences between the two
# so one suggestion for the usage of the Workinon could be to choose a really really really personal title
import os
import json
from glob import glob
from flask import Flask, render_template, request, redirect, url_for
import datetime
# prefix to add /SOUPBOAT/ATLAS-API to all the routes
# and to leave the @app.route() decorator more clean
class PrefixMiddleware(object):
def __init__(self, app, prefix=""):
self.app = app
self.prefix = prefix
def __call__(self, environ, start_response):
if environ["PATH_INFO"].startswith(self.prefix):
environ["PATH_INFO"] = environ["PATH_INFO"][len(self.prefix):]
environ["SCRIPT_NAME"] = self.prefix
return self.app(environ, start_response)
else:
start_response("404", [("Content-Type", "text/plain")])
return ["This url does not belong to the app.".encode()]
base_url = '/soupboat/workinon'
# create flask application
app = Flask(__name__)
# register the middleware to prefix all the requests with our base_url
app.wsgi_app = PrefixMiddleware(
app.wsgi_app, prefix=base_url
)
# definition of the routes
@app.route('/')
def home():
with open('archive.json', 'r') as f:
projects = json.load(f)
return render_template('home.html', projects=projects)
@app.route('/add', methods=['GET', 'POST'])
def add():
if request.method == 'POST':
name = request.form.get('name')
update = request.form.get('update')
if name != '' and update != '':
with open('archive.json', 'r') as f:
projects = json.load(f)
date = datetime.date.today().strftime('%d.%m.%Y')
step = {'when': date, 'what': update}
if name in projects:
projects[name].append(step)
else:
projects[name] = [step]
with open('archive.json', 'w') as f:
f.write(json.dumps(projects))
return redirect(url_for('home'))
return render_template('add.html')
app.run(port=3144)
Loading…
Cancel
Save