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
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Model registry
Analyze
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
Uni Osnabrück
Stud.IP
Commits
ca4e1d16
Commit
ca4e1d16
authored
10 months ago
by
Moritz Strohm
Browse files
Options
Downloads
Patches
Plain Diff
set defaultDate on changed calendar dates in sidebar widgets
parent
0efc3059
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/controllers/calendar/calendar.php
+5
-1
5 additions, 1 deletion
app/controllers/calendar/calendar.php
resources/assets/javascripts/lib/fullcalendar.js
+19
-0
19 additions, 0 deletions
resources/assets/javascripts/lib/fullcalendar.js
with
24 additions
and
1 deletion
app/controllers/calendar/calendar.php
+
5
−
1
View file @
ca4e1d16
...
...
@@ -111,6 +111,8 @@ class Calendar_CalendarController extends AuthenticatedController
{
PageLayout
::
setTitle
(
_
(
'Kalender'
));
$default_date
=
\Studip\Calendar\Helper
::
getDefaultCalendarDate
();
if
(
Request
::
isPost
())
{
//In case the checkbox of the options widget is clicked, the resulting
//POST request must be catched here and result in a redirect.
...
...
@@ -203,6 +205,7 @@ class Calendar_CalendarController extends AuthenticatedController
if
(
$calendar_owner
&&
$calendar_owner
->
id
===
User
::
findCurrent
()
->
id
)
{
//The user is viewing their own calendar.
$options
=
new
OptionsWidget
();
$options
->
addLayoutCSSClass
(
'calendar-action'
);
$options
->
addCheckbox
(
_
(
'Abgelehnte Termine anzeigen'
),
Request
::
bool
(
'show_declined'
),
...
...
@@ -237,6 +240,7 @@ class Calendar_CalendarController extends AuthenticatedController
$this
->
url_for
(
'calendar/calendar/index'
,
[
'view'
=>
'group'
]),
'group_id'
);
$group_select
->
addLayoutCSSClass
(
'calendar-action'
);
$options
=
[
''
=>
_
(
'(bitte wählen)'
)
];
...
...
@@ -263,6 +267,7 @@ class Calendar_CalendarController extends AuthenticatedController
$this
->
url_for
(
'calendar/calendar'
),
'user_id'
);
$calendar_select
->
addLayoutCSSClass
(
'calendar-action'
);
$select_options
=
[
''
=>
_
(
'(bitte wählen)'
),
User
::
findCurrent
()
->
id
=>
_
(
'Eigener Kalender'
)
...
...
@@ -335,7 +340,6 @@ class Calendar_CalendarController extends AuthenticatedController
$slot_durations
=
$this
->
getUserCalendarSlotSettings
();
//Create the fullcalendar object:
$default_date
=
\Studip\Calendar\Helper
::
getDefaultCalendarDate
();
$data_url_params
=
[];
if
(
Request
::
bool
(
'show_declined'
))
{
...
...
This diff is collapsed.
Click to expand it.
resources/assets/javascripts/lib/fullcalendar.js
+
19
−
0
View file @
ca4e1d16
...
...
@@ -737,6 +737,25 @@ class Fullcalendar
url
.
searchParams
.
set
(
'
defaultDate
'
,
changed_date
)
this
.
href
=
url
.
toString
();
});
jQuery
(
'
.sidebar-widget.calendar-action
'
).
each
(
function
()
{
//Each sidebar widget is different. The placement of the defaultDate URL parameter
//has to reflect that.
jQuery
(
this
).
find
(
'
button[formaction]
'
).
each
(
function
()
{
//Modify the formaction attribute:
let
url
=
new
URL
(
jQuery
(
this
).
attr
(
'
formaction
'
));
url
.
searchParams
.
set
(
'
defaultDate
'
,
changed_date
);
jQuery
(
this
).
attr
(
'
formaction
'
,
url
.
toString
());
});
jQuery
(
this
).
find
(
'
form[action]
'
).
each
(
function
()
{
//Add a hidden input with the defaultDate:
let
hidden_input
=
jQuery
(
this
).
find
(
'
input[name="defaultDate"]
'
)[
0
];
if
(
!
hidden_input
)
{
hidden_input
=
jQuery
(
'
<input type="hidden" name="defaultDate">
'
);
jQuery
(
this
).
append
(
hidden_input
);
}
jQuery
(
hidden_input
).
val
(
changed_date
);
});
});
// Now change the URL of the window.
const
url
=
new
URL
(
window
.
location
.
href
);
...
...
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