Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AKPlanning
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
Service Desk
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
Felix Blanke
AKPlanning
Commits
9164082d
Commit
9164082d
authored
4 years ago
by
Benjamin Hättasch
Committed by
Nadja Geisler
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Created scheduling view (currently "readonly")
parent
1e532cb2
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
AKModel/admin.py
+4
-2
4 additions, 2 deletions
AKModel/admin.py
AKScheduling/templates/admin/AKScheduling/scheduling.html
+139
-0
139 additions, 0 deletions
AKScheduling/templates/admin/AKScheduling/scheduling.html
AKScheduling/views.py
+21
-1
21 additions, 1 deletion
AKScheduling/views.py
with
164 additions
and
3 deletions
AKModel/admin.py
+
4
−
2
View file @
9164082d
...
@@ -217,11 +217,13 @@ class AKSlotAdmin(admin.ModelAdmin):
...
@@ -217,11 +217,13 @@ class AKSlotAdmin(admin.ModelAdmin):
urls
=
super
().
get_urls
()
urls
=
super
().
get_urls
()
custom_urls
=
[]
custom_urls
=
[]
if
apps
.
is_installed
(
"
AKScheduling
"
):
if
apps
.
is_installed
(
"
AKScheduling
"
):
from
AKScheduling.views
import
UnscheduledSlotsAdminView
from
AKScheduling.views
import
SchedulingAdminView
,
UnscheduledSlotsAdminView
custom_urls
.
extend
([
custom_urls
.
extend
([
path
(
'
<slug:event_slug>/schedule/
'
,
self
.
admin_site
.
admin_view
(
SchedulingAdminView
.
as_view
()),
name
=
"
schedule
"
),
path
(
'
<slug:event_slug>/unscheduled/
'
,
self
.
admin_site
.
admin_view
(
UnscheduledSlotsAdminView
.
as_view
()),
path
(
'
<slug:event_slug>/unscheduled/
'
,
self
.
admin_site
.
admin_view
(
UnscheduledSlotsAdminView
.
as_view
()),
name
=
"
slots_unscheduled
"
)
name
=
"
slots_unscheduled
"
)
,
])
])
return
custom_urls
+
urls
return
custom_urls
+
urls
...
...
This diff is collapsed.
Click to expand it.
AKScheduling/templates/admin/AKScheduling/scheduling.html
0 → 100644
+
139
−
0
View file @
9164082d
{% extends "admin_base.html" %}
{% load tags_AKModel %}
{% load i18n %}
{% load tz %}
{% load static %}
{% load tags_AKPlan %}
{% block title %}{% trans "Scheduling for" %} {{event}}{% endblock %}
{% block extrahead %}
{{ block.super }}
{% get_current_language as LANGUAGE_CODE %}
<script
src=
'{% static '
AKPlan
/
vendor
/
fullcalendar-scheduler
/
main.js
'
%}'
></script>
<link
href=
'{% static '
AKPlan
/
vendor
/
fullcalendar-scheduler
/
main.css
'
%}'
rel=
'stylesheet'
/>
{% with 'AKPlan/vendor/fullcalendar-scheduler/locales/'|add:LANGUAGE_CODE|add:'.js' as locale_file %}
<script
src=
"{% static locale_file %}"
></script>
{% endwith %}
<script>
document
.
addEventListener
(
'
DOMContentLoaded
'
,
function
()
{
var
planEl
=
document
.
getElementById
(
'
planCalendar
'
);
var
plan
=
new
FullCalendar
.
Calendar
(
planEl
,
{
timeZone
:
'
{{ event.timezone }}
'
,
headerToolbar
:
{
left
:
'
today prev,next
'
,
center
:
'
title
'
,
right
:
'
resourceTimelineDayVert,resourceTimelineDayHoriz,resourceTimelineEventVert,resourceTimelineEventHoriz
'
},
//aspectRatio: 2,
themeSystem
:
'
bootstrap
'
,
// Adapt to user selected locale
locale
:
'
{{ LANGUAGE_CODE }}
'
,
initialView
:
'
resourceTimelineEventVert
'
,
views
:
{
resourceTimelineDayHoriz
:
{
type
:
'
resourceTimelineDay
'
,
buttonText
:
'
{% trans "Day (Horizontal)" %}
'
,
slotDuration
:
'
00:15
'
,
scrollTime
:
'
08:00
'
,
},
resourceTimelineDayVert
:
{
type
:
'
resourceTimeGridDay
'
,
buttonText
:
'
{% trans "Day (Vertical)" %}
'
,
slotDuration
:
'
00:30
'
,
scrollTime
:
'
08:00
'
,
},
resourceTimelineEventHoriz
:
{
type
:
'
resourceTimeline
'
,
visibleRange
:
{
start
:
'
{{ event.start | timezone:event.timezone | date:"Y-m-d H:i:s" }}
'
,
end
:
'
{{ event.end | timezone:event.timezone | date:"Y-m-d H:i:s"}}
'
,
},
buttonText
:
'
{% trans "Event (Horizontal)" %}
'
,
slotDuration
:
'
00:15
'
,
},
resourceTimelineEventVert
:
{
type
:
'
resourceTimeGrid
'
,
visibleRange
:
{
start
:
'
{{ event.start | timezone:event.timezone | date:"Y-m-d H:i:s" }}
'
,
end
:
'
{{ event.end | timezone:event.timezone | date:"Y-m-d H:i:s"}}
'
,
},
buttonText
:
'
{% trans "Event (Vertical)" %}
'
,
slotDuration
:
'
00:30
'
,
}
},
eventDidMount
:
function
(
info
)
{
if
(
info
.
event
.
extendedProps
.
description
!==
undefined
)
{
$
(
info
.
el
).
tooltip
({
title
:
info
.
event
.
extendedProps
.
description
,
trigger
:
'
hover
'
});
}
},
eventWillUnmount
:
function
(
info
)
{
$
(
info
.
el
).
tooltip
(
'
dispose
'
);
},
editable
:
true
,
allDaySlot
:
false
,
nowIndicator
:
true
,
eventTextColor
:
'
#fff
'
,
eventColor
:
'
#127ba3
'
,
datesAboveResources
:
true
,
resourceAreaHeaderContent
:
'
{% trans "Room" %}
'
,
resources
:
[
{
%
for
room
in
rooms
%
}
{
'
id
'
:
'
{{ room.title }}
'
,
'
title
'
:
'
{{ room.title }}
'
,
},
{
%
endfor
%
}
],
events
:
[
{
%
for
slot
in
akslots
%
}
{
%
if
slot
.
start
%
}
{
'
title
'
:
'
{{ slot.ak.short_name }}
'
,
'
description
'
:
'
{{ slot.ak.name }}
'
,
'
start
'
:
'
{{ slot.start | timezone:event.timezone | date:"Y-m-d H:i:s" }}
'
,
'
end
'
:
'
{{ slot.end | timezone:event.timezone | date:"Y-m-d H:i:s" }}
'
,
'
resourceId
'
:
'
{{ slot.room.title }}
'
,
'
backgroundColor
'
:
'
{{ slot|highlight_change_colors }}
'
,
'
borderColor
'
:
'
{{ slot.ak.category.color }}
'
,
'
url
'
:
'
{% url
'
submit
:
ak_detail
'
event_slug=event.slug pk=slot.ak.pk %}
'
,
constraint
:
'
roomAvailable
'
,
},
{
%
endif
%
}
{
%
endfor
%
}
{
%
for
a
in
availabilities
%
}
{
%
if
a
.
room
!=
None
%
}
{
title
:
''
,
start
:
'
{{ a.start | timezone:event.timezone | date:"Y-m-d H:i:s" }}
'
,
end
:
'
{{ a.end | timezone:event.timezone | date:"Y-m-d H:i:s" }}
'
,
resourceId
:
'
{{ a.room.title }}
'
,
backgroundColor
:
'
#28B62C
'
,
display
:
'
background
'
,
groupId
:
'
roomAvailable
'
,
},
{
%
endif
%
}
{
%
endfor
%
}
],
schedulerLicenseKey
:
'
GPL-My-Project-Is-Open-Source
'
,
dayMinWidth
:
100
,
});
plan
.
setOption
(
'
contentHeight
'
,
$
(
window
).
height
()
-
$
(
'
#header
'
).
height
()
*
11
);
plan
.
render
();
});
</script>
{% endblock extrahead %}
{% block content %}
<div
id=
"planCalendar"
style=
"margin-bottom: 50px;"
></div>
<a
href=
"{% url 'admin:event_status' event.slug %}"
>
{% trans "Event Status" %}
</a>
{% endblock %}
This diff is collapsed.
Click to expand it.
AKScheduling/views.py
+
21
−
1
View file @
9164082d
from
django.urls
import
reverse_lazy
from
django.views.generic
import
ListView
from
django.views.generic
import
ListView
from
django.utils.translation
import
gettext_lazy
as
_
from
django.utils.translation
import
gettext_lazy
as
_
from
AKModel.availability.models
import
Availability
from
AKModel.models
import
AKSlot
from
AKModel.models
import
AKSlot
from
AKModel.views
import
AdminViewMixin
,
FilterByEventSlugMixin
from
AKModel.views
import
AdminViewMixin
,
FilterByEventSlugMixin
...
@@ -18,3 +18,23 @@ class UnscheduledSlotsAdminView(AdminViewMixin, FilterByEventSlugMixin, ListView
...
@@ -18,3 +18,23 @@ class UnscheduledSlotsAdminView(AdminViewMixin, FilterByEventSlugMixin, ListView
def
get_queryset
(
self
):
def
get_queryset
(
self
):
return
super
().
get_queryset
().
filter
(
start
=
None
)
return
super
().
get_queryset
().
filter
(
start
=
None
)
class
SchedulingAdminView
(
AdminViewMixin
,
FilterByEventSlugMixin
,
ListView
):
template_name
=
"
admin/AKScheduling/scheduling.html
"
model
=
AKSlot
context_object_name
=
"
akslots
"
def
get_context_data
(
self
,
*
,
object_list
=
None
,
**
kwargs
):
context
=
super
().
get_context_data
(
object_list
=
object_list
,
**
kwargs
)
context
[
"
title
"
]
=
f
"
{
_
(
'
Scheduling
'
)
}
for
{
context
[
'
event
'
]
}
"
context
[
"
event
"
]
=
self
.
event
context
[
"
start
"
]
=
self
.
event
.
start
context
[
"
end
"
]
=
self
.
event
.
end
context
[
"
rooms
"
]
=
self
.
event
.
room_set
.
all
()
context
[
"
availabilities
"
]
=
Availability
.
objects
.
filter
(
event
=
self
.
event
,
room__isnull
=
False
)
return
context
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