Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Stud.IP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Automate
Agent sessions
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jan-Hendrik Willms
Stud.IP
Commits
0155e499
Commit
0155e499
authored
May 3, 2022
by
Jan-Hendrik Willms
Committed by
Elmar Ludwig
May 5, 2022
Browse files
Options
Downloads
Patches
Plain Diff
fix url handling in resources.js, fixes #998
Closes #998 Merge request
studip/studip!576
parent
4e9fe604
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
resources/assets/javascripts/bootstrap/resources.js
+30
-52
30 additions, 52 deletions
resources/assets/javascripts/bootstrap/resources.js
with
30 additions
and
52 deletions
resources/assets/javascripts/bootstrap/resources.js
+
30
−
52
View file @
0155e499
...
@@ -634,32 +634,19 @@ STUDIP.ready(function () {
...
@@ -634,32 +634,19 @@ STUDIP.ready(function () {
}
}
function
updateViewURL
(
defaultView
)
{
function
updateViewURL
(
defaultView
)
{
var
sURLVariables
=
window
.
location
.
href
.
split
(
/
[
?&
]
/
);
const
url
=
new
URL
(
window
.
location
.
href
);
var
changed
=
false
;
url
.
searchParams
.
set
(
'
defaultView
'
,
defaultView
);
for
(
var
i
=
0
;
i
<
sURLVariables
.
length
;
i
++
)
{
var
sParameterName
=
sURLVariables
[
i
].
split
(
'
=
'
);
// Push current view url to history
if
(
sParameterName
[
0
]
==
"
defaultView
"
)
{
history
.
pushState
({},
null
,
url
.
toString
());
sParameterName
[
1
]
=
defaultView
;
sURLVariables
[
i
]
=
sParameterName
.
join
(
'
=
'
);
// Set links accordingly
changed
=
true
;
url
.
searchParams
.
delete
(
'
allday
'
);
}
$
(
'
.booking-plan-std_view
'
).
attr
(
'
href
'
,
url
.
toString
());
}
if
(
!
changed
)
{
url
.
searchParams
.
set
(
'
allday
'
,
1
);
sURLVariables
.
push
(
'
defaultView=
'
+
defaultView
);
$
(
'
.booking-plan-allday_view
'
).
attr
(
'
href
'
,
url
.
toString
());
}
if
(
sURLVariables
.
length
>
2
)
{
var
newurl
=
sURLVariables
[
0
]
+
'
?
'
+
sURLVariables
[
1
]
+
'
&
'
;
sURLVariables
.
shift
();
sURLVariables
.
shift
();
newurl
+=
sURLVariables
.
join
(
'
&
'
);
}
else
{
var
newurl
=
sURLVariables
.
join
(
'
?
'
);
}
}
history
.
pushState
({},
null
,
newurl
);
var
std_day
=
newurl
.
replace
(
/&
?
allday=
\d
+/
,
''
);
$
(
'
.booking-plan-std_view
'
).
attr
(
'
href
'
,
std_day
);
$
(
'
.booking-plan-allday_view
'
).
attr
(
'
href
'
,
std_day
+
'
&allday=1
'
);
};
function
submitDatePicker
()
{
function
submitDatePicker
()
{
var
picked
=
$
(
'
#booking-plan-jmpdate
'
).
val
();
var
picked
=
$
(
'
#booking-plan-jmpdate
'
).
val
();
...
@@ -714,32 +701,23 @@ STUDIP.ready(function () {
...
@@ -714,32 +701,23 @@ STUDIP.ready(function () {
// Now change the URL of the window.
// Now change the URL of the window.
var
changeddate
=
STUDIP
.
Fullcalendar
.
toRFC3339String
(
changedmoment
).
split
(
'
T
'
)[
0
];
var
changeddate
=
STUDIP
.
Fullcalendar
.
toRFC3339String
(
changedmoment
).
split
(
'
T
'
)[
0
];
var
sURLVariables
=
window
.
location
.
href
.
split
(
/
[
?&
]
/
);
var
changed
=
false
;
const
url
=
new
URL
(
window
.
location
.
href
);
for
(
var
i
=
0
;
i
<
sURLVariables
.
length
;
i
++
)
{
url
.
searchParams
.
set
(
'
defaultDate
'
,
changeddate
);
var
sParameterName
=
sURLVariables
[
i
].
split
(
'
=
'
);
if
(
sParameterName
[
0
]
==
"
defaultDate
"
)
{
// Update url in history
sParameterName
[
1
]
=
changeddate
;
history
.
pushState
({},
null
,
url
.
toString
());
sURLVariables
[
i
]
=
sParameterName
.
join
(
'
=
'
);
changed
=
true
;
// Adjust links accordingly
}
url
.
searchParams
.
delete
(
'
allday
'
);
}
$
(
'
.booking-plan-std_view
'
).
attr
(
'
href
'
,
url
.
toString
());
if
(
!
changed
)
{
sURLVariables
.
push
(
'
defaultDate=
'
+
changeddate
);
url
.
searchParams
.
set
(
'
allday
'
,
1
);
}
$
(
'
.booking-plan-allday_view
'
).
attr
(
'
href
'
,
url
.
toString
());
if
(
sURLVariables
.
length
>
2
)
{
var
newurl
=
sURLVariables
[
0
]
+
'
?
'
+
sURLVariables
[
1
]
+
'
&
'
;
// Update sidebar value
sURLVariables
.
shift
();
sURLVariables
.
shift
();
newurl
+=
sURLVariables
.
join
(
'
&
'
);
}
else
{
var
newurl
=
sURLVariables
.
join
(
'
?
'
);
}
history
.
pushState
({},
null
,
newurl
);
var
std_day
=
newurl
.
replace
(
/&
?
allday=
\d
+/
,
''
);
$
(
'
.booking-plan-std_view
'
).
attr
(
'
href
'
,
std_day
);
$
(
'
.booking-plan-allday_view
'
).
attr
(
'
href
'
,
std_day
+
'
&allday=1
'
);
$
(
'
#booking-plan-jmpdate
'
).
val
(
changedmoment
.
toLocaleDateString
(
'
de-DE
'
));
$
(
'
#booking-plan-jmpdate
'
).
val
(
changedmoment
.
toLocaleDateString
(
'
de-DE
'
));
//Store the date in the sessionStorage:
//Store the date in the sessionStorage:
sessionStorage
.
setItem
(
'
booking_plan_date
'
,
changeddate
)
sessionStorage
.
setItem
(
'
booking_plan_date
'
,
changeddate
)
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment