From 4ffdd6a72362f50b4630cfd1f2db162965c3b013 Mon Sep 17 00:00:00 2001 From: Jakub Sygnowski Date: Fri, 6 Mar 2015 21:53:25 +0100 Subject: [PATCH] (#59) setting lighter color for links of already known concepts while browsing --- server/static/css/standard.css | 8 ++++++++ server/static/html/browsing.html | 2 +- server/views.py | 10 ++++++++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/server/static/css/standard.css b/server/static/css/standard.css index f970981a..31cbd6f9 100644 --- a/server/static/css/standard.css +++ b/server/static/css/standard.css @@ -146,6 +146,14 @@ a.sidr-class-ac-li-a { } +.internal-link.known-concept{ + color: #BB9CB0; + text-decoration: none; +} +.internal-link.known-concept:hover{ + text-decoration:underline; + color:#B25291; +} .internal-link, .focus-link{ color: #A01F70; text-decoration: none; diff --git a/server/static/html/browsing.html b/server/static/html/browsing.html index 884cd8c8..0e6e7871 100644 --- a/server/static/html/browsing.html +++ b/server/static/html/browsing.html @@ -92,7 +92,7 @@

Concepts

diff --git a/server/views.py b/server/views.py index c7f6f0da..3a5ad95b 100644 --- a/server/views.py +++ b/server/views.py @@ -11,6 +11,7 @@ from apps.graph.models import Concept, Tag from apps.roadmaps.models import Roadmap +from apps.user_management.models import Profile from forms import ContactForm @@ -44,6 +45,7 @@ def get_browsing_view(request): """ Return the list of concepts and roadmaps, sorted by category """ + print "browsing" tags = Tag.objects.exclude(title='Meta').extra(select={'lower_title': 'lower(title)'}).order_by("lower_title").all() tags = list(Tag.objects.filter(title='Meta').all()) + list(tags) # Meta tag should appear first @@ -57,10 +59,14 @@ def get_browsing_view(request): uncat_course_guides = Roadmap.objects.filter(tags=None, roadmapsettings__doc_type='Course Guide') \ .extra(select={'lower_title': 'lower(title)'}).order_by("lower_title").all() uncat_course_guides = filter(Roadmap.is_listed_in_main, uncat_course_guides) - + + learned = None + if request.user.is_authenticated(): + uprof, _ = Profile.objects.get_or_create(pk=request.user.pk) + learned = [concept for cs in uprof.learned.all() for concept in Concept.objects.filter(id=cs.id).all()] return render(request, "browsing.html", {'tags': tags, 'uncat_concepts': uncat_concepts, 'uncat_roadmaps': uncat_roadmaps, - 'uncat_course_guides': uncat_course_guides}) + 'uncat_course_guides': uncat_course_guides, 'known_concepts': learned})