forked from beba/foerderbarometer
otrs_link.js fixes *all* links on a page. for travel and project forms.
This commit is contained in:
parent
723f7b42cf
commit
7930d7af40
|
@ -105,6 +105,10 @@ class TravelAdmin(admin.ModelAdmin):
|
|||
autocomplete_fields = ['project']
|
||||
readonly_fields = ['service_id']
|
||||
|
||||
class Media:
|
||||
js = ('dropdown/js/otrs_link.js',)
|
||||
|
||||
|
||||
@admin.register(Email)
|
||||
class EmailAdmin(admin.ModelAdmin):
|
||||
save_as = True
|
||||
|
|
|
@ -84,11 +84,11 @@ class TravelForm(FdbForm):
|
|||
hotel = ChoiceField(label='Hotelzimmer benötigt:', choices=HOTEL_CHOICES.items(), widget=RadioSelect())
|
||||
|
||||
class Media:
|
||||
js = ('dropdown/js/otrs_link.js',)
|
||||
css = {
|
||||
'all': ('css/dateFieldNoNowShortcutInTravels.css',)
|
||||
}
|
||||
|
||||
|
||||
class LibraryForm(FdbForm):
|
||||
|
||||
class Meta:
|
||||
|
|
|
@ -1,9 +1,18 @@
|
|||
window.addEventListener("load", function() {
|
||||
|
||||
|
||||
|
||||
(function($) {
|
||||
$(function() {
|
||||
|
||||
document.querySelectorAll("a").forEach(link => {
|
||||
link.href = link.href.replace(/%3B/g, ";").replace(/%3D/g, "=");
|
||||
});
|
||||
|
||||
/*
|
||||
// let linkElement = document.querySelector(".field-otrs > div > p.url > a");
|
||||
let linkElement = document.querySelector(".field-otrs p.url a");
|
||||
//let linkElement = document.querySelector(".field-otrs p.url a");
|
||||
let linkElement = document.querySelector("a");
|
||||
if (!linkElement) {
|
||||
console.error("OTRS-Link not found!");
|
||||
return;
|
||||
|
@ -18,7 +27,7 @@ window.addEventListener("load", function() {
|
|||
|
||||
//console.log("Modified link:", otrs_link_pretty);
|
||||
linkElement.href = otrs_link_pretty;
|
||||
|
||||
*/
|
||||
});
|
||||
})(django.jQuery);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue