From 67c4adc2d26714ff5c5269be220fff90cec47353 Mon Sep 17 00:00:00 2001 From: Andrew Date: Mon, 8 Jul 2019 01:26:51 +0400 Subject: =?UTF-8?q?WIP:=20=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D0=B0?= =?UTF-8?q?=20=D0=B2=D0=B5=D1=80=D1=81=D1=82=D0=BA=D0=B0=20=D1=82=D0=B0?= =?UTF-8?q?=D0=B1=D0=BB=D0=B8=D1=86=D1=8B,=20=D0=B8=D1=81=D0=BF=D1=80?= =?UTF-8?q?=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B0=20=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=B0=20=D1=84=D0=BE=D1=80=D0=BC=D1=8B=20=D0=B4=D0=BE?= =?UTF-8?q?=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BD=D0=BE?= =?UTF-8?q?=D0=B2=D0=BE=D0=B9=20=D0=B7=D0=B0=D0=BF=D0=B8=D1=81=D0=B8=20?= =?UTF-8?q?=D0=B2=20=D1=82=D0=B0=D0=B1=D0=BB=D0=B8=D1=86=D1=83.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- day9/task5/server.py | 2 +- day9/task5/static/css/ContentBoxStyle.css | 2 +- day9/task5/static/css/TableStyle.css | 11 +++++------ day9/task5/static/js/main.js | 22 +++++++++++----------- 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/day9/task5/server.py b/day9/task5/server.py index c5178bd..8ee52a2 100644 --- a/day9/task5/server.py +++ b/day9/task5/server.py @@ -43,7 +43,7 @@ class MyHTTPRequestHandler(BaseHTTPRequestHandler): 'query': {'files': files} })) - elif content_type.split(';')[0] == 'text/plain': + elif content_type.split(';')[0] in ['text/plain', 'application/x-www-form-urlencoded']: post_data = parse_qs(post_data.decode('utf-8')) for key in post_data: post_data[key] = post_data[key][0] diff --git a/day9/task5/static/css/ContentBoxStyle.css b/day9/task5/static/css/ContentBoxStyle.css index 5b7782d..abe9ee1 100644 --- a/day9/task5/static/css/ContentBoxStyle.css +++ b/day9/task5/static/css/ContentBoxStyle.css @@ -1,7 +1,7 @@ .contentBox { padding: 20px; width: 500px; - height: 700px; + height: 695px; background-color: #f0f0f0; border-radius: 10px; box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.3); diff --git a/day9/task5/static/css/TableStyle.css b/day9/task5/static/css/TableStyle.css index e4160fa..0631fbe 100644 --- a/day9/task5/static/css/TableStyle.css +++ b/day9/task5/static/css/TableStyle.css @@ -7,17 +7,16 @@ table { thead > tr > th { padding: 6px; font-size: 24px; - background-color: #6f6f6f; + background-color: #d5d5d5; + border: 1px black solid; } td { - padding: 3px; + padding: 8px; font-size: 21px; + border: 1px black solid; } -.odd { background-color: #dedede; } -.even { background-color: #c5c5c5; } - .editableField:hover { - background-color: rgba(0, 0, 0, 0.3); + background-color: rgba(0, 0, 0, 0.1); } diff --git a/day9/task5/static/js/main.js b/day9/task5/static/js/main.js index 39c8c9b..2ac3958 100644 --- a/day9/task5/static/js/main.js +++ b/day9/task5/static/js/main.js @@ -46,7 +46,7 @@ const defaultColumnInputs = { 'notified_about_expiration': `` }; -const baseFormFields = `
+const baseFormFields = `
service_id
@@ -123,14 +123,14 @@ const baseFormFields = ` `; const formCreateButtons = `
- - -
`; + + +
`; const formEditButtons = `
- - -
`; + + +`; const uploadFileHtml = ''; @@ -209,7 +209,6 @@ function renderTable(text) { contentRow.setAttribute('id', `row_${row[0]}`); row.forEach((column, colIndex) => { - let color = (colIndex % 2 + rowIndex % 2) % 2 === 0 ? 'odd' : 'even'; let columnNode = document.createElement('td'); if (colIndex !== 0 && colIndex < data['headers'].length) { @@ -219,7 +218,6 @@ function renderTable(text) { columnNode.setAttribute('id', fieldId); } - columnNode.classList.add(color); columnNode.innerHTML = column; contentRow.appendChild(columnNode); }); @@ -294,12 +292,14 @@ function showForm() { showEditForm = () => { let contentBox = showForm(); - contentBox.appendChild(elementFromHTML(formEditButtons)); + contentBox.firstChild.appendChild(elementFromHTML(formEditButtons)); + contentBox.firstChild.action = '/api/update'; }; showCreateForm = () => { let contentBox = showForm(); - contentBox.appendChild(elementFromHTML(formCreateButtons)); + contentBox.firstChild.appendChild(elementFromHTML(formCreateButtons)); + contentBox.firstChild.action = '/api/add'; document.getElementById('formServiceId').disabled = false; }; -- cgit v1.2.3