From 34dd0453f1d06a38e62cfbfd9101b1c5db423830 Mon Sep 17 00:00:00 2001 From: fbormann Date: Thu, 23 Feb 2017 12:43:55 -0300 Subject: [PATCH] admin restriction, title is now uniform --- amadeus/static/js/charts/home.js | 18 ++++++++++++------ subjects/templates/subjects/initial.html | 5 ++++- users/views.py | 8 ++++++-- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/amadeus/static/js/charts/home.js b/amadeus/static/js/charts/home.js index fa610af..b9a1621 100644 --- a/amadeus/static/js/charts/home.js +++ b/amadeus/static/js/charts/home.js @@ -18,7 +18,7 @@ var charts = { var width = 600; - var height = 480; + var height = 300; var padding = 30; var radius = Math.min(width, height) / 2 - padding; @@ -43,7 +43,10 @@ var charts = { .attr("x",0 ) .attr("y", -height/2 ) .style("font-size", "30px") - .text("Recursos mais utilizados"); + .text("Recursos mais utilizados") + .attr("fill", "#003333") + .style("font-weight", "bold") + .style("font-style", "italic"); var pie = d3.pie() @@ -86,7 +89,7 @@ var charts = { build_bubble_user: function(url){ $.get(url, function(dataset){ var width = 600; - var height = 480; + var height = 300; function min(){ @@ -132,7 +135,10 @@ var charts = { .attr("x", width/2 ) .attr("y", 30) .style("font-size", "30px") - .text("Usuários mais ativos no Amadeus"); + .text("Usuários mais ativos no Amadeus") + .attr("fill", "#003333") + .style("font-weight", "bold") + .style("font-style", "italic"); var simulation = d3.forceSimulation() .force("x", d3.forceX(width/2).strength(0.05)) @@ -158,7 +164,7 @@ var charts = { .attr("fill", function(d){ //return color(d['count']); - return 'url('+'#'+d['user']+')'; + return 'url('+'#'+'user_'+d['user_id']+')'; }); @@ -174,7 +180,7 @@ var charts = { defs.append("svg:pattern") .attr("id", function(d){ - return d['user']; + return "user_"+d['user_id']; }) .attr("width", function(d){ return radiusScale(d['count']); diff --git a/subjects/templates/subjects/initial.html b/subjects/templates/subjects/initial.html index 2e733ca..076e08d 100644 --- a/subjects/templates/subjects/initial.html +++ b/subjects/templates/subjects/initial.html @@ -82,7 +82,10 @@ - + {% if user.is_staff %} + + {% endif %} + {% endblock content %} \ No newline at end of file diff --git a/users/views.py b/users/views.py index 7d3e471..86be8cf 100644 --- a/users/views.py +++ b/users/views.py @@ -525,8 +525,12 @@ def logout(request, next_page = None): def get_users_log(request): fifty_users = Log.objects.values('user_id').annotate(count = Count('user_id')).order_by('-count')[:50] - - return JsonResponse(list(fifty_users.values('user_id','user','count')), safe=False) + fifty_users = list(fifty_users) + for user in fifty_users: + user_object = User.objects.get(id=user['user_id']) + user['image'] = user_object.image_url + user['user'] = user_object.social_name + return JsonResponse(fifty_users, safe=False) -- libgit2 0.21.2