Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
MOOC packages by hacklab
django-courses-legacy
Commits
5d17f3b4
Commit
5d17f3b4
authored
5 years ago
by
Bruno Martin
Browse files
Options
Download
Email Patches
Plain Diff
fix discussion activity type
parent
0be3afa8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
37 deletions
+36
-37
courses_legacy/static/js/admin/lesson/admin.lesson.app.js
courses_legacy/static/js/admin/lesson/admin.lesson.app.js
+1
-1
courses_legacy/static/js/admin/lesson/admin.lesson.controllers.js
...legacy/static/js/admin/lesson/admin.lesson.controllers.js
+32
-31
courses_legacy/templates/administration/lesson.html
courses_legacy/templates/administration/lesson.html
+3
-5
No files found.
courses_legacy/static/js/admin/lesson/admin.lesson.app.js
View file @
5d17f3b4
...
...
@@ -17,7 +17,7 @@
// 'filters.text',
'
youtube
'
,
'
ui.bootstrap
'
,
//
'discussion.services',
'
discussion.services
'
,
'
ngFileUpload
'
,
'
ui.tinymce
'
,
'
shared
'
,
...
...
This diff is collapsed.
Click to expand it.
courses_legacy/static/js/admin/lesson/admin.lesson.controllers.js
View file @
5d17f3b4
...
...
@@ -14,8 +14,9 @@
'
youtubePlayerApi
'
,
'
MarkdownDirective
'
,
'
waitingScreen
'
,
'
Forum
'
,
function
(
$scope
,
$location
,
Course
,
CourseProfessor
,
Lesson
,
LessonUpdate
,
Unit
,
VideoData
,
youtubePlayerApi
,
MarkdownDirective
,
waitingScreen
)
{
MarkdownDirective
,
waitingScreen
,
Forum
)
{
$scope
.
errors
=
{};
var
httpErrors
=
{
'
400
'
:
'
Os campos não foram preenchidos corretamente.
'
,
...
...
@@ -267,14 +268,14 @@
$scope
.
currentActivity
.
data
.
end_date
=
new
Date
(
$scope
.
currentActivity
.
data
.
end_date
);
};
$scope
.
$on
(
'
$locationChangeStart
'
,
function
(
event
)
{
// TODO
// Verify if user has saved the discussion activity and if not, delete the created forum.
//
var answer = confirm("Are you sure you want to leave this page?")
//
if (!answer) {
//
event.preventDefault();
//
}
});
//
$scope.$on('$locationChangeStart', function( event ) {
//
// TODO
//
// Verify if user has saved the discussion activity and if not, delete the created forum.
//
var answer = confirm("Are you sure you want to leave this page?")
//
if (!answer) {
//
event.preventDefault();
//
}
//
});
$scope
.
addNewActivity
=
function
(
type
)
{
if
(
!
$scope
.
currentUnit
)
return
;
...
...
@@ -289,28 +290,28 @@
expected
=
[];
}
//
if(type === 'discussion'){
if
(
type
===
'
discussion
'
){
// JSON pattern for the discussion type of activities
//
$scope.currentActivity = {
//
'type': type,
//
'data': {
//
'forum': null,
//
'content': '',
//
'start_date': null,
//
'end_date': null
//
},
//
'expected': ''
//
};
//
//
Create a new forum to recieve the students answers
//
var new_forum = new Forum();
//
new_forum.title = 'Fórum de atividades: ' + $scope.lesson.name;
//
new_forum.forum_type = 'activity';
//
new_forum.$save(function(forum) {
//
$scope.currentActivity.data.forum = forum.id;
//
});
//
} else {
$scope
.
currentActivity
=
{
'
type
'
:
type
,
'
data
'
:
{
'
forum
'
:
null
,
'
content
'
:
''
,
'
start_date
'
:
null
,
'
end_date
'
:
null
},
'
expected
'
:
''
};
// Create a new forum to recieve the students answers
var
new_forum
=
new
Forum
();
new_forum
.
title
=
'
Fórum de atividades:
'
+
$scope
.
lesson
.
name
;
new_forum
.
forum_type
=
'
activity
'
;
new_forum
.
$save
(
function
(
forum
)
{
$scope
.
currentActivity
.
data
.
forum
=
forum
.
id
;
});
}
else
{
// JSON pattern for other types of activities
$scope
.
currentActivity
=
{
'
type
'
:
type
,
...
...
@@ -322,7 +323,7 @@
},
'
expected
'
:
expected
};
//
}
}
$scope
.
currentUnit
.
activities
.
push
(
$scope
.
currentActivity
);
$scope
.
newActivityType
=
null
;
...
...
This diff is collapsed.
Click to expand it.
courses_legacy/templates/administration/lesson.html
View file @
5d17f3b4
...
...
@@ -4,11 +4,6 @@
{% load compress %}
{% block js %} {{block.super}}
<script
src=
"https://unpkg.com/tinymce@4.5.10/tinymce.min.js"
></script>
<script
src=
"https://unpkg.com/ng-file-upload@12.0.4/dist/ng-file-upload.min.js"
></script>
<script
src=
"https://unpkg.com/angular-ui-tinymce@0.0.19/dist/tinymce.min.js"
></script>
<script
src=
"{% static 'js/ui.tinymce.courses-legacy.config.js' %}"
></script>
{% compress js %}
<script
src=
"{% static 'js/admin/lesson/admin.lesson.app.js' %}"
></script>
...
...
@@ -24,6 +19,9 @@
<script
src=
"{% static 'js/directives/fixedBar.js' %}"
></script>
<script
src=
"{% static 'js/directives/markdowneditor.js' %}"
></script>
<script
src=
"{% static 'js/directives/sortable.js' %}"
></script>
<script
type=
"text/javascript"
src=
"{% static 'js/discussion-services.js' %}"
></script>
{% endcompress %}
{% endblock %}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment