Commit d38fb86513169a97898231faa2d3b28b60ee7d3d

Authored by Gustavo Bernardo
2 parents 0cc4d77e 4ae39012

Merge branch 'refactoring' of https://github.com/amadeusproject/amadeuslms into refactoring

amadeus/static/css/base/amadeus.css
@@ -1563,7 +1563,7 @@ div.dataTables_wrapper div.dataTables_paginate { @@ -1563,7 +1563,7 @@ div.dataTables_wrapper div.dataTables_paginate {
1563 right: -315px; 1563 right: -315px;
1564 overflow-y: auto; 1564 overflow-y: auto;
1565 opacity: 0; 1565 opacity: 0;
1566 - z-index: -1; 1566 + visibility: hidden;
1567 } 1567 }
1568 1568
1569 #participants { 1569 #participants {
reports/views.py
@@ -364,7 +364,7 @@ class ViewReportView(LoginRequiredMixin, generic.TemplateView): @@ -364,7 +364,7 @@ class ViewReportView(LoginRequiredMixin, generic.TemplateView):
364 time_delta = math.fabs(end_time - begin_time) 364 time_delta = math.fabs(end_time - begin_time)
365 365
366 hours_viewed += time_delta/3600 #so it's turned this seconds into hours 366 hours_viewed += time_delta/3600 #so it's turned this seconds into hours
367 - for daynum in day_numbers: 367 + for day_num in day_numbers:
368 count_temp = Log.objects.filter(action="view", resource=resources_types[i].lower(), 368 count_temp = Log.objects.filter(action="view", resource=resources_types[i].lower(),
369 user_id = student.id, context__contains = {'subject_id': subject.id, 369 user_id = student.id, context__contains = {'subject_id': subject.id,
370 resources_types[i].lower()+'_id': resource.id, 'topic_id': topics.id}, datetime__week_day = day_num+1, datetime__range=(init_date, end_date)).count() 370 resources_types[i].lower()+'_id': resource.id, 'topic_id': topics.id}, datetime__week_day = day_num+1, datetime__range=(init_date, end_date)).count()
students_group/templates/groups/_form.html
@@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
9 <div class="panel-heading"> 9 <div class="panel-heading">
10 <div class="row"> 10 <div class="row">
11 <div class="col-md-12"> 11 <div class="col-md-12">
12 - <a data-parent="#professors_accordion" data-toggle="collapse" href="#participants"> 12 + <a data-parent="#professors_accordion" data-toggle="collapse" href="#group_participants">
13 <h4 class="panel-title"> 13 <h4 class="panel-title">
14 <button class="btn btn-default btn-xs text-center cat-selector"><i class="fa fa-angle-right fa-2x" aria-hidden="true"></i></button><label for="{{ field.auto_id }}">{{ field.label }}</label> 14 <button class="btn btn-default btn-xs text-center cat-selector"><i class="fa fa-angle-right fa-2x" aria-hidden="true"></i></button><label for="{{ field.auto_id }}">{{ field.label }}</label>
15 </h4> 15 </h4>
@@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
17 </div> 17 </div>
18 </div> 18 </div>
19 </div> 19 </div>
20 - <div id="participants" class="panel-collapse collapse"> 20 + <div id="group_participants" class="panel-collapse collapse">
21 <p><em>{% trans 'Attribute students to group' %}:</em></p> 21 <p><em>{% trans 'Attribute students to group' %}:</em></p>
22 {% render_field field class='form-control' %} 22 {% render_field field class='form-control' %}
23 </div> 23 </div>
subjects/templates/subjects/view.html
@@ -195,9 +195,8 @@ @@ -195,9 +195,8 @@
195 195
196 list.animate({ 196 list.animate({
197 right : '-315px', 197 right : '-315px',
198 - opacity: 0,  
199 - 'z-index': '-1'  
200 - }, 500); 198 + opacity: 0
  199 + }, 500).css({visibility: 'hidden'});
201 200
202 $this.removeClass('open'); 201 $this.removeClass('open');
203 } else { 202 } else {
@@ -207,9 +206,8 @@ @@ -207,9 +206,8 @@
207 206
208 list.animate({ 207 list.animate({
209 right : 0, 208 right : 0,
210 - opacity: 1,  
211 - 'z-index': '1'  
212 - }, 500); 209 + opacity: 1
  210 + }, 500).css({visibility: 'visible'});
213 } 211 }
214 }); 212 });
215 }); 213 });
topics/templates/topics/list.html
@@ -54,12 +54,12 @@ @@ -54,12 +54,12 @@
54 <ul class="dropdown-menu"> 54 <ul class="dropdown-menu">
55 <li><a href="{% url 'pdf_files:create' topic.slug %}"><i class="fa fa-file-pdf-o"></i> {% trans "PDF File" %}</a></li> 55 <li><a href="{% url 'pdf_files:create' topic.slug %}"><i class="fa fa-file-pdf-o"></i> {% trans "PDF File" %}</a></li>
56 <li><a href="{% url 'youtube:create' topic.slug %}"><i class="fa fa-video-camera"></i> {% trans 'YouTube Video' %}</a></li> 56 <li><a href="{% url 'youtube:create' topic.slug %}"><i class="fa fa-video-camera"></i> {% trans 'YouTube Video' %}</a></li>
57 - <li><a href="#"><i class="fa fa-comments-o"></i> {% trans 'Forum' %}</a></li> 57 + <!-- <li><a href="#"><i class="fa fa-comments-o"></i> {% trans 'Forum' %}</a></li> -->
58 <li><a href="{% url 'file_links:create' topic.slug %}"><i class="fa fa-file-archive-o"></i> {% trans 'File Link' %}</a></li> 58 <li><a href="{% url 'file_links:create' topic.slug %}"><i class="fa fa-file-archive-o"></i> {% trans 'File Link' %}</a></li>
59 <li><a href="{% url 'links:create' topic.slug %}" > <i class="fa fa-globe"></i> {% trans "Link to Website" %}</a> 59 <li><a href="{% url 'links:create' topic.slug %}" > <i class="fa fa-globe"></i> {% trans "Link to Website" %}</a>
60 <li><a href="{% url 'goals:create' topic.slug %}"><i class="fa fa-line-chart"></i> {% trans 'Topic Goals' %}</a></li> 60 <li><a href="{% url 'goals:create' topic.slug %}"><i class="fa fa-line-chart"></i> {% trans 'Topic Goals' %}</a></li>
61 <li><a href="{% url 'webpages:create' topic.slug %}"><i class="fa fa-file-code-o"></i> {% trans 'Webpage' %}</a></li> 61 <li><a href="{% url 'webpages:create' topic.slug %}"><i class="fa fa-file-code-o"></i> {% trans 'Webpage' %}</a></li>
62 - <li><a href="#"><i class="fa fa-question-circle-o"></i> {% trans 'Questionary' %}</a></li> 62 + <!-- <li><a href="#"><i class="fa fa-question-circle-o"></i> {% trans 'Questionary' %}</a></li> -->
63 <li><a href="{% url 'webconferences:create' topic.slug %}"><i class="fa fa-desktop"></i> {% trans 'Web Conference' %}</a></li> 63 <li><a href="{% url 'webconferences:create' topic.slug %}"><i class="fa fa-desktop"></i> {% trans 'Web Conference' %}</a></li>
64 64
65 </ul> 65 </ul>
topics/views.py
@@ -20,6 +20,8 @@ from subjects.models import Subject @@ -20,6 +20,8 @@ from subjects.models import Subject
20 from .models import Topic, Resource 20 from .models import Topic, Resource
21 from .forms import TopicForm 21 from .forms import TopicForm
22 22
  23 +import operator
  24 +
23 class CreateView(LoginRequiredMixin, LogMixin, generic.edit.CreateView): 25 class CreateView(LoginRequiredMixin, LogMixin, generic.edit.CreateView):
24 log_component = 'topic' 26 log_component = 'topic'
25 log_action = 'create' 27 log_action = 'create'
@@ -285,7 +287,16 @@ def getResourceCount(request): @@ -285,7 +287,16 @@ def getResourceCount(request):
285 else: 287 else:
286 data[key] = 1 288 data[key] = 1
287 289
  290 + data = [(key,value) for key,value in sorted(data.items(), key=operator.itemgetter(1), reverse=True)]
  291 +
  292 + others = data[4:]
  293 + total_others = 0
  294 + for key,value in others:
  295 + total_others += value
  296 +
  297 + del data[4:] #remove from the 5th element
  298 + data.append(("others", total_others)) #so I have the sum of all other resources added up
288 real_data = [] 299 real_data = []
289 - for item in data.items():  
290 - real_data.append(item) 300 + for key,value in data:
  301 + real_data.append((key,value))
291 return JsonResponse(real_data, safe=False) 302 return JsonResponse(real_data, safe=False)