-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: move from bootstrap modal to standard dialog
This is a major refactoring of the whole template structure. The javascript parts are now all part of `js/apis_bibsonomy.js`, the stylesheets are now all contained in `css/apis_bibsonomy.css`. All the media files are included directly in the form instead of including them in the base template. There is one less template and route and the overlay is now implemented using the HTML `dialog` element instead of the bootstrap modal.
- Loading branch information
Showing
13 changed files
with
100 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.bibsonomydialog { | ||
border: 1px solid black; | ||
border-radius: .3rem; | ||
overflow: visible; | ||
padding: 1em; | ||
opacity: 1; | ||
transform: scale(1); | ||
transition: all 0.5s ease-in-out; | ||
|
||
@starting-style { | ||
opacity: 0; | ||
transform: scale(0.8); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
document.querySelectorAll(".bibsonomydialog").forEach(element => { | ||
element.addEventListener("mousedown", function(evt) { | ||
evt.target == this && this.close(); | ||
}); | ||
}); | ||
add_select2_reinit_listener(); | ||
reinit_select2(); | ||
|
||
function tohtml(item) { | ||
const span = document.createElement('span'); | ||
span.innerHTML = item.text; | ||
return span; | ||
} | ||
function reinit_select2() { | ||
document.querySelectorAll(".listselect2, .modelselect2multiple, .modelselect2").forEach(element => { | ||
$(element).select2({ | ||
ajax: { | ||
url: $(element).data("autocomplete-light-url"), | ||
}, | ||
dropdownParent: $(element.form), | ||
templateResult: tohtml, | ||
templateSelection: tohtml, | ||
}); | ||
}); | ||
$('.select2-selection').addClass("form-control"); | ||
autoFillBibsonomyForm(); | ||
|
||
} | ||
function add_select2_reinit_listener() { | ||
document.body.addEventListener("reinit_select2", function(evt) { | ||
reinit_select2() | ||
autoFillBibsonomyForm(); | ||
}); | ||
} | ||
|
||
function autoFillBibsonomyForm() { | ||
last_bibsonomy_reference = document.getElementById("last_bibsonomy_reference"); | ||
if (last_bibsonomy_reference) { | ||
$('select.listselect2').each(function() { | ||
var newOption = new Option(last_bibsonomy_reference.dataset.title, last_bibsonomy_reference.dataset.url, true, true); | ||
$(this).append(newOption).trigger("change"); | ||
}); | ||
} | ||
} |
7 changes: 4 additions & 3 deletions
7
apis_bibsonomy/templates/apis_bibsonomy/link_to_reference_on_tag.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
<a href="{% url "apis_bibsonomy:referenceonlist" content_type object_pk %}" | ||
{% if modal %} | ||
hx-get="{% url "apis_bibsonomy:referenceonlistmodal" content_type object_pk %}" | ||
hx-target="#modal-here" | ||
data-toggle="modal" | ||
data-target="#modal" | ||
hx-target="#referenceon{{ content_type }}_{{ object_pk }}dlg" | ||
onclick="referenceon{{ content_type }}_{{ object_pk }}dlg.showModal()" | ||
{% endif %} | ||
> | ||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="currentColor"><path d="M260-320q47 0 91.5 10.5T440-278v-394q-41-24-87-36t-93-12q-36 0-71.5 7T120-692v396q35-12 69.5-18t70.5-6Zm260 42q44-21 88.5-31.5T700-320q36 0 70.5 6t69.5 18v-396q-33-14-68.5-21t-71.5-7q-47 0-93 12t-87 36v394Zm-40 118q-48-38-104-59t-116-21q-42 0-82.5 11T100-198q-21 11-40.5-1T40-234v-482q0-11 5.5-21T62-752q46-24 96-36t102-12q58 0 113.5 15T480-740q51-30 106.5-45T700-800q52 0 102 12t96 36q11 5 16.5 15t5.5 21v482q0 23-19.5 35t-40.5 1q-37-20-77.5-31T700-240q-60 0-116 21t-104 59ZM280-494Z"/></svg> | ||
</a> | ||
<dialog id="referenceon{{ content_type }}_{{ object_pk }}dlg" class="bibsonomydialog"> | ||
</dialog> |
23 changes: 0 additions & 23 deletions
23
apis_bibsonomy/templates/apis_bibsonomy/partials/autofill_bibsonomy.html
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
apis_bibsonomy/templates/apis_bibsonomy/partials/fix_select2_bootstrap_focus.html
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
apis_bibsonomy/templates/apis_bibsonomy/partials/fix_select2_bootstrap_overflow.html
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 0 additions & 36 deletions
36
apis_bibsonomy/templates/apis_bibsonomy/partials/reinit_select2.html
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 0 additions & 12 deletions
12
apis_bibsonomy/templates/apis_bibsonomy/reference_list_modal.html
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters