- {% for topic in topics %}
- {% professor_subject topic.subject user as topic_professor%}
- {% if topic_professor %}
- {% include "subject/form_view_teacher.html" %}
- {% else %}
- {% include "subject/form_view_student.html" %}
- {% endif %}
- {% endfor %}
- {% professor_subject subject user as professor_sub %}
- {% if professor_sub %}
-
+
+ {# lista de tópicos #}
+ {% for topic in topics %}
+ {% professor_subject topic.subject user as topic_professor%}
+ {% if topic_professor %}
+ {% include "subject/form_view_teacher.html" %}
+ {% else %}
+ {% include "subject/form_view_student.html" %}
+ {% endif %}
+ {% endfor %}
+
+ {# botão create topic #}
+ {% professor_subject subject user as professor_sub %}
+ {% if professor_sub %}
+
+ {% endif %}
+
+ {# local onde vai ser colocado todos os HTML's que retornan de uma requisição ajax feitas dentro de subject #}
+
{% endblock %}
diff --git a/courses/templates/subject/poll_item_actions.html b/courses/templates/subject/poll_item_actions.html
index a5942f2..d949ac4 100644
--- a/courses/templates/subject/poll_item_actions.html
+++ b/courses/templates/subject/poll_item_actions.html
@@ -1,17 +1,7 @@
{% load static i18n permission_tags professor_access %}
-
-
-
-{% for poll in polls %}
- {% professor_subject poll.topic.subject request.user as permission%}
- {% if permission %}
-
+ {% for poll in polls %}
+
{{ poll }}
{% endfor %}
-{#
{% trans '+ Create Poll' %} #}
-
-
diff --git a/courses/templates/topic/delete.html b/courses/templates/topic/delete.html
new file mode 100644
index 0000000..bcb0788
--- /dev/null
+++ b/courses/templates/topic/delete.html
@@ -0,0 +1,36 @@
+{% load static i18n permission_tags %}
+
+
+
+
+
diff --git a/courses/templates/topic/link_topic_list.html b/courses/templates/topic/link_topic_list.html
index 04f2fc9..77e0861 100644
--- a/courses/templates/topic/link_topic_list.html
+++ b/courses/templates/topic/link_topic_list.html
@@ -1,9 +1,6 @@
{% load static i18n list_topic_foruns permission_tags %}
-
-
-
diff --git a/courses/templates/topic/link_topic_list_edit.html b/courses/templates/topic/link_topic_list_edit.html
index dc05444..15734f8 100644
--- a/courses/templates/topic/link_topic_list_edit.html
+++ b/courses/templates/topic/link_topic_list_edit.html
@@ -2,12 +2,12 @@
-
#}
diff --git a/courses/templates/topic/list_file.html b/courses/templates/topic/list_file.html
index cd0dd17..a1df36c 100644
--- a/courses/templates/topic/list_file.html
+++ b/courses/templates/topic/list_file.html
@@ -3,10 +3,10 @@
{% for file in files %}
{{ file.file_type.icon }} {{ file.name }}
- {% endfor %}
+ {% endfor %}
-
-
-
+{#
#}
+
+{#
#}
diff --git a/courses/templates/topic/list_file_edit.html b/courses/templates/topic/list_file_edit.html
index 55bee64..396d1d0 100644
--- a/courses/templates/topic/list_file_edit.html
+++ b/courses/templates/topic/list_file_edit.html
@@ -2,11 +2,11 @@
{% for file in files %}
-
+
{{ file.file_type.icon }} {{ file.name }}
{% endfor %}
-
+{#
#}
-
\ No newline at end of file
+{#
#}
diff --git a/courses/templatetags/list_topic_foruns.py b/courses/templatetags/list_topic_foruns.py
index d095904..710d853 100644
--- a/courses/templatetags/list_topic_foruns.py
+++ b/courses/templatetags/list_topic_foruns.py
@@ -31,6 +31,17 @@ def list_topic_poll(request, topic):
return context
+@register.inclusion_tag('subject/poll_item_actions_teacher.html')
+def list_topic_poll_teacher(request, topic):
+ context = {
+ 'request': request,
+ }
+
+ context['polls'] = Poll.objects.filter(topic = topic)
+ context['topic'] = topic
+
+ return context
+
@register.inclusion_tag('topic/list_file.html')
def list_topic_file(request, topic):
context = {
diff --git a/courses/urls.py b/courses/urls.py
index fe37cfe..285da5f 100644
--- a/courses/urls.py
+++ b/courses/urls.py
@@ -22,6 +22,7 @@ urlpatterns = [
url(r'^subjects/subscribe/(?P
[\w_-]+)/$', views.subscribe_subject, name='subscribe_subject'),
url(r'^topics/create/(?P[\w_-]+)/$', views.CreateTopicView.as_view(), name='create_topic'),
url(r'^topics/update/(?P[\w_-]+)/$', views.UpdateTopicView.as_view(), name='update_topic'),
+ url(r'^topics/update/(?P[\w_-]+)/$', views.DeleteTopic.as_view(), name='update_topic'),
url(r'^topics/(?P[\w_-]+)/$', views.TopicsView.as_view(), name='view_topic'),
url(r'^subjects/categories$',views.IndexSubjectCategoryView.as_view(), name='subject_category_index'),
url(r'^forum/', include('forum.urls', namespace = 'forum')),
diff --git a/courses/views.py b/courses/views.py
index e6ca7aa..95f8ced 100644
--- a/courses/views.py
+++ b/courses/views.py
@@ -142,7 +142,7 @@ class AllCoursesView(LoginRequiredMixin, NotificationMixin, generic.ListView):
context['aparece'] = self.aparece
return context
-
+
class CreateCourseView(LoginRequiredMixin, HasRoleMixin, LogMixin, NotificationMixin, generic.edit.CreateView):
log_component = "course"
log_resource = "course"
@@ -314,7 +314,7 @@ class DeleteCourseView(LoginRequiredMixin, HasRoleMixin, LogMixin, generic.Delet
self.log_context['course_category_name'] = self.object.category.name
super(DeleteCourseView, self).createLog(self.request.user, self.log_component, self.log_action, self.log_resource, self.log_context)
-
+
return reverse_lazy('course:manage')
@@ -359,7 +359,7 @@ class CourseView(LogMixin, NotificationMixin, generic.DetailView):
if not category_sub is None:
cat = get_object_or_404(CategorySubject, slug = category_sub)
subjects = subjects.filter(category = cat)
-
+
context['subjects'] = subjects
if has_role(self.request.user,'system_admin'):
@@ -389,12 +389,12 @@ class CourseView(LogMixin, NotificationMixin, generic.DetailView):
return context
-class DeleteView(LoginRequiredMixin, HasRoleMixin, NotificationMixin, generic.DeleteView):
+class DeleteTopic(LoginRequiredMixin, HasRoleMixin, NotificationMixin, generic.DeleteView):
allowed_roles = ['professor', 'system_admin']
login_url = reverse_lazy("core:home")
redirect_field_name = 'next'
- model = Course
+ model = Topic
template_name = 'course/delete.html'
success_url = reverse_lazy('course:manage')
@@ -412,7 +412,7 @@ def subscribe_course(request, slug):
if request.user in course.students.all():
- log_context = {}
+ log_context = {}
log_context['course_id'] = course.id
log_context['course_name'] = course.name
log_context['course_slug'] = course.slug
@@ -665,7 +665,7 @@ class TopicsView(LoginRequiredMixin, LogMixin, generic.ListView):
topic = get_object_or_404(Topic, slug = self.kwargs.get('slug'))
subject = topic.subject
topics_q = Topic.objects.filter(subject = subject, visible=True)
-
+
return topics_q
def get_context_data(self, **kwargs):
@@ -681,7 +681,7 @@ class TopicsView(LoginRequiredMixin, LogMixin, generic.ListView):
context['students_activit'] = students_activit
context['materials'] = materials
context['form'] = ActivityForm
-
+
return context
@@ -716,7 +716,7 @@ class CreateTopicView(LoginRequiredMixin, HasRoleMixin, LogMixin, NotificationMi
self.object.owner = self.request.user
self.object.save()
action = super(CreateTopicView, self).createorRetrieveAction("create Topic")
- super(CreateTopicView, self).createNotification("Topic "+ self.object.name + " was created",
+ super(CreateTopicView, self).createNotification("Topic "+ self.object.name + " was created",
resource_name=self.object.name, resource_link= reverse('course:view_topic',args=[self.object.slug]),
actor=self.request.user, users = self.object.subject.course.students.all() )
@@ -733,7 +733,7 @@ class CreateTopicView(LoginRequiredMixin, HasRoleMixin, LogMixin, NotificationMi
self.log_context['course_category_name'] = self.object.subject.course.category.name
super(CreateTopicView, self).createLog(self.request.user, self.log_component, self.log_action, self.log_resource, self.log_context)
-
+
return super(CreateTopicView, self).form_valid(form)
class UpdateTopicView(LoginRequiredMixin, HasRoleMixin, LogMixin, generic.UpdateView):
@@ -939,7 +939,7 @@ def subscribe_subject(request, slug):
subject.students.add(request.user)
if request.user in subject.students.all():
- log_context = {}
+ log_context = {}
log_context['subject_id'] = subject.id
log_context['subject_name'] = subject.name
log_context['subject_slug'] = subject.slug
diff --git a/links/static/js/links.js b/links/static/js/links.js
index b906be1..a071569 100644
--- a/links/static/js/links.js
+++ b/links/static/js/links.js
@@ -4,5 +4,4 @@ function get_modal_link(url, id,div_content){
$(div_content).append(data);
$(id).modal('show');
});
-
}
--
libgit2 0.21.2