Skip to content
Snippets Groups Projects
Commit 2dcbdb75 authored by Oliwer Mattsson's avatar Oliwer Mattsson :headphones:
Browse files

Start field och persistent checkboxes

parent 6a66f646
No related branches found
No related tags found
No related merge requests found
...@@ -16,13 +16,13 @@ ...@@ -16,13 +16,13 @@
"course_id": "TDP003", "course_id": "TDP003",
"end_date": "2009-09-06", "end_date": "2009-09-06",
"project_id": 1, "project_id": 1,
"big_image": "XXX" "big_image": "https://miro.medium.com/v2/resize:fit:1400/0*UD5SJeGeDOJDJanZ"
}, },
{ {
"start_date": "2009-09-07", "start_date": "2009-09-07",
"short_description": "Spreadsheet program for economics.", "short_description": "Spreadsheet program for economics.",
"course_name": "OK\u00c4NT", "course_name": "OK\u00c4NT",
"long_description": "This is a spreadsheet program, perfect for when you need to budget your snus!", "long_description": "This is a excel clone, perfect for when you need to budget your snus!",
"group_size": 4, "group_size": 4,
"academic_credits": "WUT?", "academic_credits": "WUT?",
"lulz_had": "few", "lulz_had": "few",
...@@ -31,13 +31,14 @@ ...@@ -31,13 +31,14 @@
"techniques_used": [ "techniques_used": [
"c++", "c++",
"csv", "csv",
"python" "python",
"pandas"
], ],
"project_name": "Spreader", "project_name": "Spreader",
"course_id": "TDP003", "course_id": "TDP003",
"end_date": "2009-09-08", "end_date": "2009-09-08",
"project_id": 2, "project_id": 2,
"big_image": "XXX" "big_image": "https://cdn.britannica.com/29/147629-050-71369707/Screenshot-Microsoft-Excel.jpg"
}, },
{ {
"start_date": "2009-09-08", "start_date": "2009-09-08",
...@@ -57,7 +58,7 @@ ...@@ -57,7 +58,7 @@
"course_id": "TDP003", "course_id": "TDP003",
"end_date": "2009-09-11", "end_date": "2009-09-11",
"project_id": 3, "project_id": 3,
"big_image": "XXX" "big_image": "https://m.media-amazon.com/images/I/81s2LsEkFnL._AC_UF1000,1000_QL80_.jpg"
}, },
{ {
"start_date": "2009-09-09", "start_date": "2009-09-09",
...@@ -79,13 +80,13 @@ ...@@ -79,13 +80,13 @@
"course_id": " \"", "course_id": " \"",
"end_date": "2009-09-10", "end_date": "2009-09-10",
"project_id": 4, "project_id": 4,
"big_image": "XXX" "big_image": "https://www.svtstatic.se/image-news/480/wide/0.5/0.5/e-15892158-1510121858000"
}, },
{ {
"start_date": "2009-09-10", "start_date": "2009-09-10",
"short_description": "Swedish neovim plugin", "short_description": "Swedish neovim plugin",
"course_name": "HOHO", "course_name": "HOHO",
"long_description": "Allows for swedish to autocompleted and spellchecked in NeoVim!", "long_description": "Allows for swedish to autocompleted and spellchecked in NeoVim! Spread the word!",
"group_size": 8, "group_size": 8,
"academic_credits": "WUT?", "academic_credits": "WUT?",
"lulz_had": "over 9000", "lulz_had": "over 9000",
...@@ -100,7 +101,7 @@ ...@@ -100,7 +101,7 @@
"course_id": " \"", "course_id": " \"",
"end_date": "2009-09-15", "end_date": "2009-09-15",
"project_id": 5, "project_id": 5,
"big_image": "XXX" "big_image": "https://external-preview.redd.it/the-complete-guide-to-ios-macos-development-in-neovim-v0-eqhjSrRyyRM0TzH_MILAzGdIt4VL9s1qDa-tekA0-iQ.jpg?width=1080&crop=smart&auto=webp&s=5ab3616d5ace8cede13e49093d5e84f4ad98f403"
}, },
{ {
"start_date": "2009-09-12", "start_date": "2009-09-12",
...@@ -120,6 +121,6 @@ ...@@ -120,6 +121,6 @@
"course_id": " \"", "course_id": " \"",
"end_date": "2009-09-18", "end_date": "2009-09-18",
"project_id": 6, "project_id": 6,
"big_image": "XXX" "big_image": "https://external-preview.redd.it/i-created-a-simple-mod-manager-that-allows-you-to-easily-v0-k6wSM98B9HfhzZ2hymBc66TPXqlDqKuAIxXmIkP25bA.png?format=pjpg&auto=webp&s=d98d33691357ad0ff77c5c69ed91cfe7dee8e5bd"
} }
] ]
...@@ -108,7 +108,7 @@ def search(data, sort_by='start_date', sort_order='desc', techniques=None, searc ...@@ -108,7 +108,7 @@ def search(data, sort_by='start_date', sort_order='desc', techniques=None, searc
search_results = [] search_results = []
for project in results: for project in results:
if search_fields is not None and search_fields != "" and search != "": if search_fields is not None and search_fields != "" and search != "" and search_fields != ['None']:
for field in search_fields: for field in search_fields:
substring = project[field] substring = project[field]
# Check type before calling lower() # Check type before calling lower()
......
...@@ -38,11 +38,13 @@ def techniques(): ...@@ -38,11 +38,13 @@ def techniques():
search_query = request.form.get('search', '') search_query = request.form.get('search', '')
sort_by = request.form.get('sort_by', 'start_date') sort_by = request.form.get('sort_by', 'start_date')
sort_order = request.form.get('sort_order', 'desc') sort_order = request.form.get('sort_order', 'desc')
search_field = request.form.getlist('search_field', None)
techniques_search = request.form.getlist('technique') techniques_search = request.form.getlist('technique')
#print(techniques_search) #print(techniques_search)
print(search_field)
filtered_projects = search(load('data.json'), sort_by=sort_by, sort_order=sort_order, techniques=techniques_search, search=search_query) filtered_projects = search(load('data.json'), sort_by=sort_by, sort_order=sort_order, techniques=techniques_search, search=search_query, search_fields=search_field)
return render_template('techniques.html', return render_template('techniques.html',
techniques = techniques, techniques = techniques,
...@@ -50,7 +52,8 @@ def techniques(): ...@@ -50,7 +52,8 @@ def techniques():
projects=filtered_projects, projects=filtered_projects,
search_query=search_query, search_query=search_query,
sort_by=sort_by, sort_by=sort_by,
sort_order=sort_order) sort_order=sort_order,
search_field=search_field)
if __name__ == "__main__": if __name__ == "__main__":
app.run(debug=True) app.run(debug=True)
...@@ -180,7 +180,7 @@ header a { ...@@ -180,7 +180,7 @@ header a {
flex-shrink: 1; flex-shrink: 1;
background:rgba(25,25,25,.1); background:rgba(25,25,25,.3);
height: 175px; height: 175px;
width: 300px; width: 300px;
...@@ -301,9 +301,9 @@ header a { ...@@ -301,9 +301,9 @@ header a {
.project-showcase img { .project-showcase img {
object-fit:scale-down; object-fit:fill;
width: 25%; width: 50%;
height: 25%; height: 50%;
} }
...@@ -311,7 +311,7 @@ header a { ...@@ -311,7 +311,7 @@ header a {
display: flex; display: flex;
width: 100%; width: 100%;
align-content: center; align-content: center;
margin-top: 85px; margin-top: 30px;
margin-bottom: 125px; margin-bottom: 125px;
} }
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<div class="content-container"> <div class="content-container">
<div class="project-showcase"> <div class="project-showcase">
<h1>{{ project['project_name'] }}</h1> <h1>{{ project['project_name'] }}</h1>
<img class="showcase-img" src="{{ project['small_image'] }}" alt="Project Image"> <img class="showcase-img" src="{{ project['big_image'] }}" alt="Project Image">
<div class="project-stats"> <div class="project-stats">
<ul> <ul>
......
...@@ -41,6 +41,14 @@ ...@@ -41,6 +41,14 @@
<option value="desc" {% if sort_order == 'desc' %}selected{% endif %}>Descending</option> <option value="desc" {% if sort_order == 'desc' %}selected{% endif %}>Descending</option>
<option value="asc" {% if sort_order == 'asc' %}selected{% endif %}>Ascending</option> <option value="asc" {% if sort_order == 'asc' %}selected{% endif %}>Ascending</option>
</select> </select>
<select name="search_field">
<option value=None {% if search_field == None %}selected{% endif %}>All</option>
<option value="long_description" {% if search_field == ['long_description'] %}selected{% endif %}>Description</option>
<option value="start_date" {% if search_field == ['start_date'] %}selected{% endif %}>Start Date</option>
<option value="end_date" {% if search_field == ['end_date'] %}selected{% endif %}>End Date</option>
<option value="project_name" {% if search_field == ['project_name'] %}selected{% endif %}>Project Name</option>
<option value="course_name" {% if search_field == ['course_name'] %}selected{% endif %}>Course Name</option>
</select>
<button type="submit">Search</button> <button type="submit">Search</button>
</div> </div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment