Download: {{ card['title'] }}
-diff --git a/app.py b/app.py index 0599d1d..aa61967 100644 --- a/app.py +++ b/app.py @@ -29,7 +29,7 @@ def create_app(test_config=None): session.rollback() return render_template('500.html'), 500 - @app.route('/deck/index', methods=["GET", "POST"]) + @app.route('/deck', methods=["GET", "POST"]) def deck(): dbsession = get_session() if not 'user_id' in session: @@ -117,7 +117,7 @@ def create_app(test_config=None): #raise Exception("Ne najdem naslednje karte") # Prikaži obrazec - return render_template("deck/index.html", username=username, card=show_card) + return render_template("deck.html", username=username, card=show_card) @app.route("/share_button", methods=["GET", "POST"]) diff --git a/auth.py b/auth.py index f8454c1..c4c4fc0 100644 --- a/auth.py +++ b/auth.py @@ -53,7 +53,7 @@ def register(): flash(error) - return render_template('auth/register.html') + return render_template('register.html') @bp.route('/login', methods=('GET', 'POST')) @@ -79,7 +79,7 @@ def login(): return redirect(url_for("menu.index")) #TODO ne dela flash(error) - return render_template('auth/login.html') + return render_template('login.html') @bp.before_app_request diff --git a/menu.py b/menu.py index a8087ca..4035bac 100644 --- a/menu.py +++ b/menu.py @@ -45,7 +45,7 @@ def index(): user_settings = get_settings(user_id) if user_settings['max_new'] == "0" and user_settings['max_due'] == "0": flash("Error: Attempted to make deck with 0 cards.") - return render_template("menu/menu.html") + return render_template("menu.html") deck = probabilistic_deck_generator(user_id, int(user_settings['max_new']), int(user_settings['max_due'])) cards_by_id = get_deck(deck) @@ -71,8 +71,8 @@ def index(): return render_template("settings.html", username=username, user_id=user_id, settings=settings) elif action == "instructions": return render_template("instructions.html", username=username, user_id=user_id) - elif action == "about": - return render_template("about.html", username=username, user_id=user_id) + # elif action == "about": + # return render_template("about.html", username=username, user_id=user_id) - return render_template("menu/menu.html", username=username, deck_status=deck_status) \ No newline at end of file + return render_template("menu.html", username=username, deck_status=deck_status) diff --git a/static/js/dropzone.js b/static/js/dropzone.js new file mode 100644 index 0000000..50b758a --- /dev/null +++ b/static/js/dropzone.js @@ -0,0 +1,50 @@ +// select all `` elements with the class `dropzone-input` and operate on each of them +document.querySelectorAll(".dropzone-input").forEach((inputEl) => { + // select the element's (closest) parent with the class name `dropzone` (the element with the actual "dropzone" functionality) + const dropZoneEl = inputEl.closest(".dropzone"); + // select the element's (closest) parent with the class name `dropzone-form` (the container of all "dropzone" functionality and the form action, in our case this is the same element) + const dropZoneFormEl = inputEl.closest(".dropzone-form"); + // select the info text element inside the container + const dropZoneTextEl = dropZoneFormEl.querySelector(".dropzone-txt") + + // add a `click` event listener on the dropzone to trigger the input's click event + dropZoneEl.addEventListener("click", (e) => { + inputEl.click(); + }); + + // add a `change` event listener + inputEl.addEventListener("change", (e) => { + e.preventDefault(); + console.log("change") + if (inputEl.files.length) { + // change info text + dropZoneTextEl.innerHTML = "Uploading file ..."; + // submit form + dropZoneFormEl.submit(); + } + }); + + // add to class list when we drag over the element + dropZoneEl.addEventListener("dragover", (e) => { + e.preventDefault(); + dropZoneEl.classList.add("dropzone--over"); + }); + + // remove from class list when we leave or stop dragging + ["dragleave", "dragend"].forEach((type) => { + dropZoneEl.addEventListener(type, (e) => { + e.preventDefault(); + dropZoneEl.classList.remove("dropzone--over"); + }); + }); + + dropZoneEl.addEventListener("drop", (e) => { + e.preventDefault(); + if (e.dataTransfer.files.length) { + inputEl.files = e.dataTransfer.files; + dropZoneTextEl.innerHTML = "Uploading file ..."; + dropZoneFormEl.submit(); + } + dropZoneEl.classList.remove("dropzone--over"); + }); +}); diff --git a/static/style.css b/static/style.css index 5a07972..189032e 100644 --- a/static/style.css +++ b/static/style.css @@ -1,173 +1,310 @@ +/* variables */ +:root { + --txt-width: 60ch; + --foreground: #333333; + --background: #eeeeee; + --dimm: 0.7; + --green: #00d090; + --orange: #f08010; + --yellow: #f0c060; + --red: #f05030; + --blue: #4080a0; +} + +/* normalize */ +* { + box-sizing: border-box; +} + +input { + background: none; + border: none; + border-bottom: solid var(--foreground) 1px; + font-size: 1rem; +} + +input:focus { + outline: none; +} + +button, +input[type^=submit] { + cursor: pointer; + border: none; + background: none; + font-size: 1rem; +} + +.yes, +.green{ + color: var(--green); +} + +.maybe, +.yellow { + color: var(--yellow); +} + +.no, +.orange { + color: var(--orange); +} + +.delete, +.red { + color: var(--red); +} + +.share, +.blue { + color: var(--blue); +} + html { - font-family: sans-serif; - background: #eee; - padding: 1rem; - } - - body { - max-width: 960px; - margin: 0 auto; - background: white; - } - - h1, h2, h3, h4, h5, h6 { - font-family: serif; - color: #000000; - margin: 1rem 0; - } - - a { - color: #377ba8; - } - - hr { - border: none; - border-top: 1px solid lightgray; - } - - nav { - background: D9D2C6; - display: flex; - align-items: center; - padding: 0 0.5rem; - } - - nav h1 { - flex: auto; - margin: 0; - } - - nav h1 a { - text-decoration: none; - padding: 0.25rem 0.5rem; - } - - nav ul { - display: flex; - list-style: none; - margin: 0; - padding: 0; - } - - nav ul li a, nav ul li span, header .action { - display: block; - padding: 0.5rem; - } - - .content { - padding: 0 1rem 1rem; - } - - .content > header { - border-bottom: 1px solid lightgray; - display: flex; - align-items: flex-end; - } - - .content > header h1 { - flex: auto; - margin: 1rem 0 0.25rem 0; - } - - .flash { - margin: 1em 0; - padding: 1em; - background: #cae6f6; - border: 1px solid #377ba8; - } - - .post > header { - display: flex; - align-items: flex-end; - font-size: 0.85em; - } - - .post > header > div:first-of-type { - flex: auto; - } - - .post > header h1 { - font-size: 1.5em; - margin-bottom: 0; - } - - .post .about { - color: slategray; - font-style: italic; - } - - .post .body { - white-space: pre-line; - } - - .content:last-child { - margin-bottom: 0; - } - - .content form { - margin: 1em 0; - display: flex; - flex-direction: column; - } - - .content label { - font-weight: bold; - margin-bottom: 0.5em; - } - - .content input, .content textarea { - margin-bottom: 1em; - } - - .content textarea { - min-height: 12em; - resize: vertical; - } - - input.danger { - color: #cc2f2e; - } - - input[type=submit] { - align-self: start; - min-width: 10em; - } + padding: 0; + margin: 0; + font-family: sans-serif; + /* font-size: clamp(16px, calc(1vw + 1vh + 0.5vmin), 22px); */ + font-size: calc(0.1rem + 1vw + 1vh + 0.5vmin); + line-height: 1.25; + color: var(--foreground); + background-color: var(--background); +} - #pdf-doc { - width: 100%; - height: calc(100vh - 332px); - } +/* layout */ +body { + margin: 0; + height: 100vh; + display: grid; + grid-template-rows: auto 1fr auto; +} - .drop-zone { - max-width: 200px; - height: 200px; - padding: 25px; - display: flex; - align-items: center; - justify-content: center; - text-align: center; - font-family: "Quicksand", sans-serif; - font-weight: 500; - font-size: 20px; - cursor: pointer; - color: #cccccc; - border: 4px dashed #009578; - border-radius: 10px; - } - - .drop-zone--over { - border-style: solid; - } - - .drop-zone__input { - display: none; - } +body>* { + padding: 0.5rem; + background-color: var(--background); +} - button { - border-radius: 0px; - width: fill-available; - width: -webkit-fill-available; - width: -moz-available; - height: 70px; - font-size: 130% - } \ No newline at end of file +/* header */ +body>header { + border-bottom: thin solid var(--foreground); + display: grid; + grid-template-columns: 1fr auto; + grid-template-areas: + "title navigation"; +} + +body>header>h1, +body>header>nav { + display: flex; + gap: 0.5rem; +} + +body>header>h1 { + grid-area: title; +} + +body>header>nav { + grid-area: navigation; +} + +body>header * { + margin: 0; + font-size: 1rem; + font-weight: normal; + text-decoration: none; + color: var(--foreground); +} + +/* main */ +body>main { + overflow: scroll; +} + +/* footer */ +body>footer { + border-top: thin solid var(--foreground); +} + +body>footer * { + margin: 0; + font-size: 0.5rem; +} + +/* deck */ +#deck article { + max-height: 100%; + display: grid; + grid-template-rows: auto 1fr auto; +} + +#deck article>main { + overflow: scroll; +} + +/* matches */ +#matches table { + width: 100%; +} + +#matches table tr { + display: grid; + grid-template-columns: 1fr 1fr auto; + border-bottom: thin solid var(--foreground); +} + +#matches table tr td:last-child { + text-align: right; +} + +/* upload */ +#upload form { + height: 100%; + display: grid; + grid-template-rows: 1fr auto; +} + +#upload input[type^=file] { + display: none; +} + +.dropzone { + cursor: pointer; +} + +/* settings */ +/* TODO: arrows */ +#settings form { + display: grid; + grid-template-columns: auto auto; + grid-gap: 0.5rem; +} + +#settings form input[type=submit] { + grid-column: 1 / -1; +} + +/* instructions */ + +#instructions article h1, +#instructions article h2, +#instructions article h3, +#instructions article h4, +#instructions article h5, +#instructions article h6 { + font-size: 1rem; + font-weight: normal; + border-bottom: thin solid var(--foreground); +} + +/* login, register */ +#login>main, +#register>main { + place-self: center; +} + +#login form { + display: grid; + grid-template-areas: + "user-label user-input" + "pass-label pass-input" + "login login"; + grid-gap: 0.5rem; + align-items: center; +} + +#register form { + display: grid; + grid-template-areas: + "user-label user-input" + "pass-label pass-input" + "mail-label mail-input" + "login login"; + grid-gap: 0.5rem; + align-items: center; +} + +#login form>input[type=text], +#login form>input[type=password], +#register form>input[type=text], +#register form>input[type=password], +#register form>input[type=email] { +} + +#login form>input:focus, +#register form>input:focus { + outline: none; +} + +#login form>input[type^="submit"], +#register form>input[type^="submit"] { + grid-area: login; + place-self: center; + align-self: center; +} + +/* menu */ +#menu form { + display: grid; + grid-template-columns: auto; + grid-gap: 0.5rem; + justify-items: start; +} + + +#content>form { + display: grid; + grid-template-rows: 1fr; +} + +/* flash */ +.flashes { + position: fixed; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + background: none; + max-width: var(--txt-width); + list-style: none; +} + +.flashes li { + animation: 3s 2s forwards fadeout; +} + +@keyframes fadeout { +from { + opacity: 1; + visibility: visible; +} + +to { + opacity: 0; + visibility: hidden; +} +} + +#buttonContainer { + display: grid; + grid-auto-flow: column; + grid-template-columns: repeat(5, 1fr); +} + +#buttonContainer>button:hover { + /* background-color: black!important; */ +} + +button[value^="Yes"] { + background-color: var(--green); +} +button[value^="No"] { + background-color: var(--orange); +} +button[value^="Maybe"] { + background-color: var(--yellow); +} +button[value^="Delete"] { + background-color: var(--red); +} +button[value^="Share"] { + background-color: var(--blue); +} diff --git a/templates/about.html b/templates/about.html deleted file mode 100644 index a3b7d32..0000000 --- a/templates/about.html +++ /dev/null @@ -1,16 +0,0 @@ -{% extends 'base.html' %} - -{% block header %} -
Contentmatcher is a General Intelligence Agency of Ljubljana prototype.
- -You can find the its code here.
- -Contentmatcher is hosted by kompot, a librehosters community from Ljubljana.
- -If you have any questions, feedback or if you would like contribute, please contact us at gia@kompot.si. - -{% endblock %} diff --git a/templates/auth/login.html b/templates/auth/login.html deleted file mode 100644 index b7dd5dc..0000000 --- a/templates/auth/login.html +++ /dev/null @@ -1,15 +0,0 @@ -{% extends 'base.html' %} - -{% block header %} -Download: {{ card['title'] }}
-No cards were found in your collection. Consider uploading some.
-{% endblock %} \ No newline at end of file diff --git a/templates/instructions.html b/templates/instructions.html index dd37d60..a084b00 100644 --- a/templates/instructions.html +++ b/templates/instructions.html @@ -1,59 +1,40 @@ -{% extends 'base.html' %} +{% extends 'partials/base.html' %} + +{% block name %}instructions{% endblock %} -{% block header %} -- Contentmatcher is a GIA prototype that tries to help you engage with your content and share it with other users. It assumes that you have a heap of content that you would like to reconsider. This heap can take many forms such vast libraries of PDFs on your computer or a long lists of bookmarks. -
-- The app will help you get through this content step by step and continue to show you your content again based on the interest you express as well present you with shared content. If you and at least one more person express a high interest in an item a match will appear on your matches page. There you can send them an email to talk about the item your interested in. -
--
Contentmatcher is a GIA prototype that tries to help you engage with your content and share it with other users. It assumes that you have a heap of content that you would like to reconsider. This heap can take many forms such vast libraries of PDFs on your computer or a long lists of bookmarks.
-- For now the only way to import content is to upload your PDFs. We're figuring out how to add different lists of links like browser bookmarks, liked tweets and "watch later" youtube videos. -
+The app will help you get through this content step by step and continue to show you your content again based on the interest you express as well present you with shared content. If you and at least one more person express a high interest in an item a match will appear on your matches page. There you can send them an email to talk about the item your interested in.
-- Going through sessions is the main activity in using Contentmatcher. - - A session consists of rating and potentially shareing items in a deck. You can adjust the size of your deck in the settings. +
- There is also the share button. This will create a new item with this content for all other users, so it will appear in their decks from now on as well. -
+- If you and at least one other user rate an item with a yes then a match will appear on your matches page. There you can send a email to talk. -
+- If you have any questions, feedback, ideas or if you would like contribute, please contact us at gia@kompot.si. -
+For now the only way to import content is to upload your PDFs. We're figuring out how to add different lists of links like browser bookmarks, liked tweets and "watch later" youtube videos.
+Going through sessions is the main activity in using Contentmatcher. A session consists of rating and potentially shareing items in a deck. You can adjust the size of your deck in the settings. In sessions you rate items with yes, maybe, no and delete buttons. It's weird because there is no question, maybe think of a question like: "Are you really interested in this item?"
+ +There is also the share button. This will create a new item with this content for all other users, so it will appear in their decks from now on as well.
+ +If you and at least one other user rate an item with a yes then a match will appear on your matches page. There you can send an email to talk.
+ +If you have any questions, feedback, ideas or if you would like contribute, please contact us at gia@kompot.si.
+Title | -Users | -Action | -
---|---|---|
- {{ match[0]['title'] }} - | -- {% for card in match %} - {{ names_by_ids[card['owner_id']] }} - {% endfor %} - | -- send email - | -
+ {{ match[0]['title'] }} + | ++ {% for card in match %} + {{ names_by_ids[card['owner_id']] }} + {% endfor %} + | ++ send email + | +
You have no matches at the moment
+You have no matches at the moment.
{% endif %} -{% endblock %} \ No newline at end of file +