Skip to content

Commit

Permalink
Merge branch 'run-selection' of https://github.com/cschlaffner/PROTzi…
Browse files Browse the repository at this point in the history
…lla2 into run-selection
  • Loading branch information
gitjannes committed Dec 12, 2024
2 parents 8bb2d07 + 7c35a10 commit 383b1ad
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 17 deletions.
21 changes: 20 additions & 1 deletion ui/runs/static/runs/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,23 @@ input[value="Continue"] {
border-left: 4px solid #bc3838;
margin-bottom: 10px;
padding-bottom: 10px;
}
}


.tags {
display: flex;
flex-wrap: wrap;
gap: 5px;
margin-top: 5px;
}

.tag {
display: inline-block;
position: relative;
border-radius: 5px;
clip-path: polygon(0 0, calc(100% - 15px) 0, 100% 50%, calc(100% - 15px) 100%, 0 100%);
padding: 5px 10px;
font-size: 0.9rem;
white-space: nowrap;
}

12 changes: 6 additions & 6 deletions ui/runs/static/runs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,17 @@ function toggleFavouriteRun(runName, favouriteStatus){
document.getElementById('change_favourite').submit();
};

function addTag(runName, tagName){

document.getElementById('run_name_id').value = runName;
document.getElementById('tag_name_id').value = tagName;
function addTag(runName){
tagName = "Janneessss";
document.getElementById('add_tag_run_name_id').value = runName;
document.getElementById('add_tag_name_id').value = tagName;
document.getElementById('add_tag').submit();
};

function deleteTag(runName, tagName){

document.getElementById('run_name_id').value = runName;
document.getElementById('tag_name_id').value = tagName;
document.getElementById('delete_tag_run_name_id').value = runName;
document.getElementById('delete_tag_name_id').value = tagName;
document.getElementById('delete_tag').submit();
};

Expand Down
17 changes: 11 additions & 6 deletions ui/runs/templates/runs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,13 @@ <h3>Continue an existing run:
</button>
</div>
<div class="details">
<!-- Zusätzliche Informationen -->
<span>Tags: {{run.tags}}</span>
<span>Tags:</span>
<div class="tags">
{% for tag in run.run_tags %}
<span class="tag btn-orange">{{ tag }}</span>
{% endfor %}
<button type="button" class="btn btn-grey" onclick="addTag('{{run.run_name}}')"></button>
</div>
<p style="margin: 5px 0;">Description: </p>
<input type="submit" value="Continue" class="btn btn-red">
</div>
Expand All @@ -124,13 +129,13 @@ <h3>Continue an existing run:
</form>
<form id="add_tag" class="mb-5" action="{% url 'runs:add_tag' %}" method="post">
{% csrf_token %}
<input type="hidden" name="tag_name" id="tag_name_id" value="">
<input type="hidden" name="run_name" id="run_name_id" value="">
<input type="hidden" name="add_tag_name" id="add_tag_name_id" value="">
<input type="hidden" name="add_tag_run_name" id="add_tag_run_name_id" value="">
</form>
<form id="delete_tag" class="mb-5" action="{% url 'runs:delete_tag' %}" method="post">
{% csrf_token %}
<input type="hidden" name="tag_name" id="tag_name_id" value="">
<input type="hidden" name="run_name" id="run_name_id" value="">
<input type="hidden" name="delete_tag_name" id="delete_tag_name_id" value="">
<input type="hidden" name="delete_tag_run_name" id="delete_tag_run_name_id" value="">
</form>
</div>
<div class="col-2">
Expand Down
8 changes: 4 additions & 4 deletions ui/runs/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ def favourite(request: HttpRequest):

def add_tag(request: HttpRequest):

run_name = request.POST["run_name"]
run_tag = request.POST["tag"]
run_tag = request.POST["add_tag_name"]
run_name = request.POST["add_tag_run_name"]

from protzilla.disk_operator import YamlOperator # to avoid a circular import (geht das cleaner? habs einfach kopiert von unten?)

Expand Down Expand Up @@ -278,8 +278,8 @@ def delete_tag(request: HttpRequest):
:rtype: HttpResponse
"""

run_name = request.POST["run_name"]
run_tag = request.POST["tag"]
run_name = request.POST["delete_tag_run_name"]
run_tag = request.POST["delete_tag_name"]

from protzilla.disk_operator import YamlOperator # to avoid a circular import (geht das cleaner? habs einfach kopiert von unten?)

Expand Down

0 comments on commit 383b1ad

Please sign in to comment.