Commit 5d17f3b4 authored by Bruno Martin's avatar Bruno Martin
Browse files

fix discussion activity type

parent 0be3afa8
......@@ -17,7 +17,7 @@
// 'filters.text',
'youtube',
'ui.bootstrap',
// 'discussion.services',
'discussion.services',
'ngFileUpload',
'ui.tinymce',
'shared',
......
......@@ -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;
......
......@@ -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 %}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment