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
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Marcus Eibrink-Lunzenauer
Stud.IP
Commits
840e59f8
Commit
840e59f8
authored
2 years ago
by
Jan-Hendrik Willms
Browse files
Options
Downloads
Patches
Plain Diff
fix url handling in resources.js, fixes #998
Closes #998 Merge request
studip/studip!576
parent
4a97009b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
resources/assets/javascripts/bootstrap/resources.js
+28
-37
28 additions, 37 deletions
resources/assets/javascripts/bootstrap/resources.js
with
28 additions
and
37 deletions
resources/assets/javascripts/bootstrap/resources.js
+
28
−
37
View file @
840e59f8
...
...
@@ -633,25 +633,18 @@ STUDIP.ready(function () {
}
function
updateViewURL
(
defaultView
)
{
var
sURLVariables
=
window
.
location
.
href
.
split
(
/
[
?&
]
/
);
var
changed
=
false
;
for
(
var
i
=
0
;
i
<
sURLVariables
.
length
;
i
++
)
{
var
sParameterName
=
sURLVariables
[
i
].
split
(
'
=
'
);
if
(
sParameterName
[
0
]
==
"
defaultView
"
)
{
sParameterName
[
1
]
=
defaultView
;
sURLVariables
[
i
]
=
sParameterName
.
join
(
'
=
'
);
changed
=
true
;
}
}
if
(
!
changed
)
{
sURLVariables
.
push
(
'
defaultView=
'
+
defaultView
);
}
const
url
=
new
URL
(
window
.
location
.
href
);
url
.
searchParams
.
set
(
'
defaultView
'
,
defaultView
);
// Push current view url to history
history
.
pushState
({},
null
,
url
.
toString
());
let
newurl
=
`
${
sURLVariables
[
0
]}
?
${
sURLVariables
.
slice
(
1
).
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
'
);
// Set links accordingly
url
.
searchParams
.
delete
(
'
allday
'
);
$
(
'
.booking-plan-std_view
'
).
attr
(
'
href
'
,
url
.
toString
());
url
.
searchParams
.
set
(
'
allday
'
,
1
);
$
(
'
.booking-plan-allday_view
'
).
attr
(
'
href
'
,
url
.
toString
());
}
function
submitDatePicker
()
{
...
...
@@ -705,27 +698,25 @@ STUDIP.ready(function () {
jQuery
(
export_action
).
attr
(
'
href
'
,
export_url
);
}
//Now change the URL of the window.
//
Now change the URL of the window.
var
changeddate
=
STUDIP
.
Fullcalendar
.
toRFC3339String
(
changedmoment
).
split
(
'
T
'
)[
0
];
var
sURLVariables
=
window
.
location
.
href
.
split
(
/
[
?&
]
/
);
var
changed
=
false
;
for
(
var
i
=
0
;
i
<
sURLVariables
.
length
;
i
++
)
{
var
sParameterName
=
sURLVariables
[
i
].
split
(
'
=
'
);
if
(
sParameterName
[
0
]
==
"
defaultDate
"
)
{
sParameterName
[
1
]
=
changeddate
;
sURLVariables
[
i
]
=
sParameterName
.
join
(
'
=
'
);
changed
=
true
;
}
}
if
(
!
changed
)
{
sURLVariables
.
push
(
'
defaultDate=
'
+
changeddate
);
}
let
newurl
=
`
${
sURLVariables
[
0
]}
?
${
sURLVariables
.
slice
(
1
).
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
'
);
const
url
=
new
URL
(
window
.
location
.
href
);
url
.
searchParams
.
set
(
'
defaultDate
'
,
changeddate
);
// Update url in history
history
.
pushState
({},
null
,
url
.
toString
());
// Adjust links accordingly
url
.
searchParams
.
delete
(
'
allday
'
);
$
(
'
.booking-plan-std_view
'
).
attr
(
'
href
'
,
url
.
toString
());
url
.
searchParams
.
set
(
'
allday
'
,
1
);
$
(
'
.booking-plan-allday_view
'
).
attr
(
'
href
'
,
url
.
toString
());
// Update sidebar value
$
(
'
#booking-plan-jmpdate
'
).
val
(
changedmoment
.
toLocaleDateString
(
'
de-DE
'
));
//Store the date in the sessionStorage:
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
register
or
sign in
to comment