diff --git a/app.py b/app.py index ed19235..9d32982 100644 --- a/app.py +++ b/app.py @@ -13,26 +13,13 @@ r = RethinkDB() conn = r.connect(rethinkUrl, rethinkPort, db='finfree') create_conditions_routes(app, r, conn) -conditionModel = { - "id": { - "type": "readonly", - "name": "ID" - }, - "itemDescription": { - "type": "string", - "name": "Beschreibung" - }, - "itemName": { - "type": "string", - "name": "Name" - } -} + @app.route('/') def index(): cursor = r.table("conditions").run(conn) conditions = list(cursor) - return render_template('index.html', data={"conditions": { "data": conditions, "model": conditionModel }}) + return render_template('index.html', data={"conditions": conditions }) if __name__ == '__main__': app.run(host='0.0.0.0', port=8080, debug=True) diff --git a/static/css/styles.css b/static/css/styles.css index 720eca8..ae4b5c5 100644 --- a/static/css/styles.css +++ b/static/css/styles.css @@ -38,10 +38,32 @@ td { text-align: left; } +td div { + max-width: 6ch; + white-space: nowrap; + overflow: hidden; + display: block; +} + +thead td:first-child { + border: none; +} + +th.nodata { + text-align: center; +} + tfoot td { border: none; } +tbody td:first-child { + max-width: 1ch; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + button { background-color: #4CAF50; color: white; @@ -67,13 +89,20 @@ fieldset { /* Dialog box */ dialog { width: 400px; - height: 420px; padding: 20px; border: 1px solid #ccc; border-radius: 5px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); overflow: hidden; } + +dialog.create { + height: 320px; +} + +dialog.update { + height: 500px; +} /* Labels */ label { @@ -84,7 +113,7 @@ label { } /* Text inputs */ -input, form div { +input, select, form div { padding: 8px; margin-bottom: 10px; border: 1px solid #ccc; @@ -93,7 +122,7 @@ input, form div { font-size: 16; } -input { +input, select { width: 100%; } diff --git a/static/js/main.js b/static/js/main.js index cb61b64..291d0f2 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -13,7 +13,14 @@ function documentReady() { openDialog.close(); window.location.reload(); } else { - document.querySelector("dialog").showModal() + const dialog = document.querySelector("dialog") + if (iframe.contentWindow.location.href.split("/").pop() === "create") { + dialog.className = 'create'; + } else { + dialog.className = 'update'; + } + dialog.showModal() + } } } \ No newline at end of file diff --git a/templates/conditions/create.html b/templates/conditions/create.html index 9884834..82425ef 100644 --- a/templates/conditions/create.html +++ b/templates/conditions/create.html @@ -14,12 +14,19 @@