Skip to content

Commit fd6d288

Browse files
authored
Merge branch 'main' into #18_Frontend/Base_Allow_to_duplicate_courses
2 parents 6036e7c + 6d02f83 commit fd6d288

20 files changed

Lines changed: 453 additions & 36 deletions

File tree

.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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,5 @@
166166
"impress_text": "",
167167
"impress_url": ""
168168
}
169+
170+
ALLOW_PUBLIC_COURSE_EDITING_BY_EVERYONE = True

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">

frontend/forms/addcontent.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from django import forms
2+
from base.models.content import Content
3+
from content.models import YTVideoContent, ImageContent
4+
5+
6+
class AddContentForm(forms.ModelForm):
7+
"""
8+
The Form for adding new content to a topic
9+
"""
10+
class Meta: # pylint: disable=too-few-public-methods
11+
model = Content
12+
exclude = ['topic', 'author', 'creation_date', 'ratings', 'preview', 'type']

frontend/locale/de_DE/LC_MESSAGES/django.po

Lines changed: 73 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,27 +33,42 @@ msgstr "Diese Software ist Open Source"
3333
msgid "Are you sure you want to delete the following comment?"
3434
msgstr "Soll der folgende Kommentar wirklich gelöscht werden?"
3535

36+
#: frontend/templates/frontend/content/addcontent.html:23
37+
#: frontend/templates/frontend/course/create.html:29
38+
#: frontend/templates/frontend/course/edit.html:29
39+
msgid "Create"
40+
msgstr "Erzeugen"
41+
42+
#: frontend/templates/frontend/content/addcontent.html:24
43+
#: frontend/templates/frontend/content/detail.html:80
44+
#: frontend/templates/frontend/course/create.html:30
45+
#: frontend/templates/frontend/course/edit.html:30
46+
#: frontend/templates/frontend/profile/profile_edit.html:19
47+
msgid "Cancel"
48+
msgstr "Abbrechen"
49+
3650
#: frontend/templates/frontend/content/detail.html:18
51+
#: frontend/templates/frontend/course/view.html:24
3752
msgid "Actions"
3853
msgstr "Aktionen"
3954

40-
#: frontend/templates/frontend/content/detail.html:46
55+
#: frontend/templates/frontend/content/detail.html:43
4156
msgid "Back to course "
4257
msgstr "Zurück zum Kurs "
4358

44-
#: frontend/templates/frontend/content/detail.html:52
59+
#: frontend/templates/frontend/content/detail.html:49
4560
msgid "By"
4661
msgstr "Von"
4762

48-
#: frontend/templates/frontend/content/detail.html:62
63+
#: frontend/templates/frontend/content/detail.html:59
4964
msgid "Created at"
5065
msgstr "Erstellt am"
5166

52-
#: frontend/templates/frontend/content/detail.html:70
67+
#: frontend/templates/frontend/content/detail.html:67
5368
msgid "Delete"
5469
msgstr "Löschen"
5570

56-
#: frontend/templates/frontend/content/detail.html:74
71+
#: frontend/templates/frontend/content/detail.html:71
5772
#, python-format
5873
msgid ""
5974
"\n"
@@ -77,16 +92,16 @@ msgstr "Abbrechen"
7792
msgid "Confirm"
7893
msgstr "Bestätigen"
7994

80-
#: frontend/templates/frontend/content/detail.html:102
95+
#: frontend/templates/frontend/content/detail.html:99
8196
#: frontend/templates/frontend/course/topic_contents.html:29
8297
msgid "Rating"
8398
msgstr "Bewertung"
8499

85-
#: frontend/templates/frontend/content/detail.html:112
100+
#: frontend/templates/frontend/content/detail.html:109
86101
msgid "Comments"
87102
msgstr "Kommentare"
88103

89-
#: frontend/templates/frontend/content/detail.html:118
104+
#: frontend/templates/frontend/content/detail.html:115
90105
msgid "Add comment"
91106
msgstr "Kommentar hinzufügen"
92107

@@ -105,11 +120,25 @@ msgstr "Erzeugen"
105120
msgid "Duplicate Course"
106121
msgstr "Kurs duplizieren"
107122

123+
#: frontend/templates/frontend/course/view.html:36
108124
#: frontend/templates/frontend/course/view.html:27
109125
msgid "Delete Course"
110126
msgstr "Kurs löschen"
111127

112128
#: frontend/templates/frontend/course/view.html:63
129+
#: frontend/templates/frontend/course/dropdown_topic.html:10
130+
msgid "Add Content"
131+
msgstr "Inhalte hinzufügen"
132+
133+
#: frontend/templates/frontend/course/edit.html:11
134+
msgid "Edit course"
135+
msgstr "Kurs bearbeiten"
136+
137+
#: frontend/templates/frontend/course/view.html:35
138+
msgid "Edit Course"
139+
msgstr "Kurs hinzufügen"
140+
141+
#: frontend/templates/frontend/course/view.html:76
113142
msgid "No topics yet"
114143
msgstr "Bisher keine Themen"
115144

@@ -137,7 +166,7 @@ msgstr "Kurse für Kategorie"
137166

138167
#: frontend/templates/frontend/course_lists/courses_category.html:18
139168
#: frontend/templates/frontend/course_lists/courses_period.html:18
140-
#: frontend/templates/frontend/navbar.html:5
169+
#: frontend/templates/frontend/navbar.html:12
141170
msgid "All Courses"
142171
msgstr "Alle Kurse"
143172

@@ -181,11 +210,16 @@ msgstr "Login"
181210
msgid "Go to dashboard"
182211
msgstr "Zum Dashboard"
183212

184-
#: frontend/templates/frontend/navbar.html:7
213+
#: frontend/templates/frontend/navbar.html:8
214+
#: frontend/templates/frontend/search.html:11
215+
msgid "Search"
216+
msgstr "Suche"
217+
218+
#: frontend/templates/frontend/navbar.html:14
185219
msgid "Admin Menu"
186220
msgstr "Admin-Menü"
187221

188-
#: frontend/templates/frontend/navbar.html:12
222+
#: frontend/templates/frontend/navbar.html:19
189223
msgid "Logout"
190224
msgstr "Logout"
191225

@@ -217,6 +251,18 @@ msgstr "Zurücksetzen"
217251
msgid "Submit"
218252
msgstr "Abschicken"
219253

254+
#: frontend/templates/frontend/search.html:19
255+
msgid "Search Results for "
256+
msgstr "Suchergebnisse für "
257+
258+
#: frontend/templates/frontend/search.html:30
259+
msgid "No courses found"
260+
msgstr "Keine Kurse gefunden"
261+
262+
#: frontend/templates/frontend/search.html:45
263+
msgid "No topics found"
264+
msgstr "Keine Themen gefunden"
265+
220266
#: frontend/views/comment.py:33 frontend/views/comment.py:107
221267
msgid "You don't have permission to do this."
222268
msgstr "Keine Berechtigung, um das durchzuführen"
@@ -241,6 +287,22 @@ msgstr ""
241287
msgid "Course '{cleaned_data['title']}' successfully created"
242288
msgstr "Kurs '{cleaned_data['title']}' erfolgreich angelegt"
243289

290+
#: frontend/views/content.py:28
291+
msgid "Content '{cleaned_data['type']}' successfully added"
292+
msgstr "Inhalt '{cleaned_data['type']}' erfolgreich hinzugefügt"
293+
294+
#: frontend/views/content.py:35
295+
msgid "An error occurred while processing the request"
296+
msgstr "Es trat ein Fehler beim Verarbeiten der Anfrage auf"
297+
298+
#: frontend/views/course.py:26
299+
msgid "Course '{cleaned_data['title']}' successfully created"
300+
msgstr "Kurs '{cleaned_data['title']}' erfolgreich angelegt"
301+
302+
#: frontend/views/course.py:52
303+
msgid "Course '{cleaned_data['title']}' successfully edited"
304+
msgstr "Kurs '{cleaned_data['title']}' erfolgreich bearbeitet"
305+
244306
#: frontend/views/profile.py:25
245307
msgid "Profile updated"
246308
msgstr "Profil aktualisiert"
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{% extends 'frontend/base_logged_in.html' %}
2+
3+
{# Load the tag library #}
4+
{% load bootstrap4 %}
5+
{% load cc_frontend_tags %}
6+
{% load fontawesome_5 %}
7+
{% load static %}
8+
{% load i18n %}
9+
10+
{% block imports %}
11+
<link href="{% static 'css/content_detail.css' %}" type="text/css" rel="stylesheet"/>
12+
{% endblock %}
13+
14+
{% block content %}
15+
<form method="post" enctype=multipart/form-data>
16+
{% csrf_token %}
17+
{% bootstrap_form form %}
18+
{% bootstrap_form content_type_form %}
19+
20+
{{ form.media }}
21+
<div>
22+
23+
<button type="submit" class="btn btn-primary float-right">{% fa5_icon 'plus-circle' 'fas' %} {% trans "Create" %}</button>
24+
<a href="{% url 'frontend:dashboard' %}" class="btn btn-danger">{% fa5_icon 'times' 'fas' %} {% trans "Cancel" %}</a>
25+
</div>
26+
27+
</form>
28+
{% endblock %}

frontend/templates/frontend/content/detail.html

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,9 @@
2323
{# url 'readingmode' course.id topic.id content.id #}{% if ending %}{{ ending }}{% endif %}">{% fa5_icon 'eye' 'far' %}
2424
Reading Mode</a>
2525
{% if user.is_authenticated %}
26-
<a class="dropdown-item" href="{# url 'favourite_content' course.id topic.id content.id #}?onDetailPage=True">
27-
{% if favourite %}{% fa5_icon 'bookmark' 'fas' %} Unsave {% else %}{% fa5_icon 'bookmark' 'far' %} Save{% endif %}</a>
28-
<div class="dropdown-divider"></div>
29-
{% if markdown %}
26+
{% if content.type|is_content_editable %}
3027
<a class="dropdown-item"
31-
href="{% url 'edit_md_file' course.id topic.id content.id %}">{% fa5_icon 'pencil-alt' 'fas' %}
28+
href="{#{% url 'edit_md_file' course.id topic.id content.id %}#}">{% fa5_icon 'pencil-alt' 'fas' %}
3229
Edit</a>
3330

3431
{% endif %}

0 commit comments

Comments
 (0)