Skip to content

Commit 2e89f66

Browse files
Merge branch 'main' into #5_Rating
2 parents 9f25bb7 + 7aa0568 commit 2e89f66

38 files changed

Lines changed: 953 additions & 87 deletions

.github/workflows/django.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Django CI
22

33
on:
44
push:
5-
branches: [ master ]
5+
branches: [ main ]
66
pull_request:
7-
branches: [ master ]
7+
branches: [ main ]
88

99
jobs:
1010
build:

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Collab Coursebook
22

3+
![Django CI](https://github.com/DataManagementLab/collab-coursebook/workflows/Django%20CI/badge.svg)
4+
35
## Description
46

57
Collab Coursebook is a plattform for collaborative learning und knowledge organization. It provides a place to share and re-use notes and other learning materials.

collab_coursebook/settings.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
MIDDLEWARE = [
5252
'django.middleware.security.SecurityMiddleware',
5353
'django.contrib.sessions.middleware.SessionMiddleware',
54+
'django.middleware.locale.LocaleMiddleware',
5455
'django.middleware.common.CommonMiddleware',
5556
'django.middleware.csrf.CsrfViewMiddleware',
5657
'django.contrib.auth.middleware.AuthenticationMiddleware',
@@ -166,3 +167,5 @@
166167
"impress_text": "",
167168
"impress_url": ""
168169
}
170+
171+
ALLOW_PUBLIC_COURSE_EDITING_BY_EVERYONE = True

collab_coursebook/urls.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,5 @@
2727
path('accounts/logout/', django_cas_ng.views.LogoutView.as_view(), name='cas_ng_logout'),
2828
path('accounts/callback/', django_cas_ng.views.CallbackView.as_view(), name='cas_ng_proxy_callback'),
2929
path('', include('frontend.urls', namespace='frontend')),
30+
path('i18n/', include('django.conf.urls.i18n')),
3031
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

content/forms.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from django import forms
2+
from content.models import YTVideoContent, ImageContent
3+
4+
5+
class AddContentFormYoutubeVideo(forms.ModelForm):
6+
class Meta:
7+
model = YTVideoContent
8+
exclude = ['content']
9+
10+
11+
class AddContentFormImage(forms.ModelForm):
12+
class Meta:
13+
model = ImageContent
14+
exclude = ['content']
15+
16+
17+
CONTENT_TYPE_FORMS = {
18+
YTVideoContent.TYPE: AddContentFormYoutubeVideo,
19+
ImageContent.TYPE: AddContentFormImage,
20+
}
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
{# TODO Replace with real preview #}
2-
<div class="card-img-top fit bg-success" style="height: 180px;"></div>
1+
<img class="card-img-top fit" style="height: 180px;" src="{{ content.imagecontent.image.url }}" alt="{{ content.description }}" width="500" height="600">
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
{# TODO Replace with real preview #}
2-
<div class="card-img-top fit bg-success" style="height: 180px;"></div>
1+
<img class="card-img-top fit" style="height: 180px;" src="https://img.youtube.com/vi/{{ content.ytvideocontent.id }}/0.jpg" alt="{{ content.description }}" width="500" height="600">
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{% load cc_export_tags %}
2+
{% autoescape off %}
3+
4+
\textbf{Image}
5+
\Image{ {{content.description|tex_escape}} }{% templatetag openbrace %}{{content.imagecontent.image.path}}{% templatetag closebrace%}
6+
\newline
7+
{{content.description|tex_escape}}
8+
\newline
9+
10+
{% endautoescape %}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{% load cc_export_tags %}
2+
{% autoescape off %}
3+
\textbf{YouTube video}
4+
\newline
5+
\href{ {{ content.ytvideocontent.url }} }{ {{ content.ytvideocontent.url }} }
6+
\newline
7+
{{content.description|tex_escape}}
8+
\newline
9+
{% endautoescape %}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{% load cc_export_tags %}
2+
{% autoescape off %}
3+
4+
\documentclass[a4paper]{article}
5+
6+
\usepackage[utf8]{inputenc}
7+
\usepackage[T1]{fontenc}
8+
\usepackage[ngerman]{babel}
9+
\usepackage{graphicx}
10+
\usepackage{float}
11+
\usepackage{grffile}
12+
\usepackage{hyperref}
13+
\usepackage[left=1cm, right=1cm, top=2cm, bottom=2cm]{geometry}
14+
15+
%% Generate a latex graphic
16+
% 1: caption
17+
% 2: image path
18+
\newcommand{\Image}[2]{
19+
\begin{figure}[H]
20+
\centering
21+
\includegraphics[width=\textwidth]{#2}
22+
\caption{#1}
23+
\end{figure}
24+
}
25+
26+
\begin{document}
27+
28+
\title{ {{ course.title|tex_escape }} }
29+
\author{ {{user|tex_escape}} }
30+
\maketitle
31+
32+
% \end{document} gets appended in code
33+
34+
{% endautoescape %}

0 commit comments

Comments
 (0)