Skip to content

Commit

Permalink
renamed discover to learn
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkcuys committed Aug 22, 2012
1 parent 4287bb3 commit 8629b61
Show file tree
Hide file tree
Showing 19 changed files with 56 additions and 60 deletions.
15 changes: 0 additions & 15 deletions lernanta/apps/discover/urls.py

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from schools.models import School

from discover.models import get_active_languages
from learn.models import get_active_languages

log = logging.getLogger(__name__)

Expand All @@ -22,7 +22,3 @@ class ProjectsFilterForm(forms.Form):
language = forms.ChoiceField(required=False, choices=[('all', 'All')] + get_active_languages())
reviewed = forms.BooleanField(required=False)


class SearchPreferenceForm(forms.Form):
search_language = forms.ChoiceField(required=False, choices=[('all', 'All')] + get_active_languages())
reviewed = forms.BooleanField(required=False)
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
@register.simple_tag
def learn_default(tag=None, school=None):
""" return the default URL for the learn page """
learn_url = reverse('discover_featured', kwargs={'feature':'community'})
learn_url = reverse('learn_featured', kwargs={'feature':'community'})
params = []
if school:
learn_url = reverse('discover_schools',
learn_url = reverse('learn_schools',
kwargs={'school_slug':school.slug})
if tag:
params += ['tag=%s' % tag.name]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from users.models import create_profile
from projects.models import Project
from discover.models import get_listed_courses
from learn.models import get_listed_courses

from test_utils import TestCase

Expand Down
15 changes: 15 additions & 0 deletions lernanta/apps/learn/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from django.conf.urls.defaults import patterns, url, include

urlpatterns = patterns('',
url(r'^$', 'learn.views.learn',
name='learn_all'),

url(r'^schools/(?P<school_slug>[\w-]+)/', 'learn.views.schools',
name='learn_schools'),

url(r'^featured/(?P<feature>[\w-]+)/', 'learn.views.featured',
name='learn_featured'),

url(r'^tags/$', 'learn.views.learn_tags',
name='learn_tags'),
)
34 changes: 17 additions & 17 deletions lernanta/apps/discover/views.py → lernanta/apps/learn/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
from pagination.views import get_pagination_context

from projects.models import Project
from discover import forms as project_forms
from discover.models import get_listed_courses
from discover.models import get_popular_tags
from discover.models import get_weighted_tags
from discover.models import get_courses_by_tag
from discover.models import get_courses_by_tags
from discover.models import get_courses_by_list
from discover.models import get_tags_for_courses
from learn import forms as project_forms
from learn.models import get_listed_courses
from learn.models import get_popular_tags
from learn.models import get_weighted_tags
from learn.models import get_courses_by_tag
from learn.models import get_courses_by_tags
from learn.models import get_courses_by_list
from learn.models import get_tags_for_courses
from l10n.urlresolvers import reverse
from relationships.models import Relationship
from schools.models import School
Expand All @@ -47,13 +47,13 @@ def _filter_and_return(request, context, projects, max_count):
context['projects'] = projects
context.update(get_pagination_context(request, projects, max_count))
if request.is_ajax():
projects_html = render_to_string('discover/_learn_projects.html',
projects_html = render_to_string('learn/_learn_projects.html',
context, context_instance=RequestContext(request))
projects_pagination = render_to_string('discover/_learn_pagination.html',
projects_pagination = render_to_string('learn/_learn_pagination.html',
context, context_instance=RequestContext(request))
learn_header = render_to_string('discover/_learn_header.html',
learn_header = render_to_string('learn/_learn_header.html',
context, context_instance=RequestContext(request))
learn_filters = render_to_string('discover/_learn_filters.html',
learn_filters = render_to_string('learn/_learn_filters.html',
context, context_instance=RequestContext(request))
data = {
'projects_html': projects_html,
Expand All @@ -63,7 +63,7 @@ def _filter_and_return(request, context, projects, max_count):
}
json = simplejson.dumps(data)
return http.HttpResponse(json, mimetype="application/json")
return render_to_response('discover/discover.html', context,
return render_to_response('learn/learn.html', context,
context_instance=RequestContext(request))


Expand All @@ -79,7 +79,7 @@ def learn(request, max_count=24):
'schools': School.objects.all(),
'popular_tags': get_popular_tags(),
'form': form,
'learn_url': reverse('discover_learn'),
'learn_url': reverse('learn_all'),
'infinite_scroll': request.GET.get('infinite_scroll', False),
}
if form.is_valid():
Expand Down Expand Up @@ -111,7 +111,7 @@ def schools(request, school_slug, max_count=24):
'schools': School.objects.all(),
'popular_tags': get_popular_tags(),
'form': form,
'learn_url': reverse('discover_learn'),
'learn_url': reverse('learn_all'),
'infinite_scroll': request.GET.get('infinite_scroll', False),
'learn_school': school,
}
Expand Down Expand Up @@ -141,7 +141,7 @@ def featured(request, feature, max_count=24):
'schools': School.objects.all(),
'popular_tags': get_popular_tags(),
'form': form,
'learn_url': reverse('discover_learn'),
'learn_url': reverse('learn_all'),
'infinite_scroll': request.GET.get('infinite_scroll', False),
}

Expand All @@ -159,6 +159,6 @@ def featured(request, feature, max_count=24):

def learn_tags(request):
tags = get_weighted_tags()
return render_to_response('discover/discover_tags.html', {'tags': tags},
return render_to_response('learn/learn_tags.html', {'tags': tags},
context_instance=RequestContext(request))

2 changes: 1 addition & 1 deletion lernanta/apps/projects/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from l10n.urlresolvers import reverse
from drumbeat import messages
from projects.models import Project
from discover.templatetags.learn_tags import learn_default
from learn.templatetags.learn_tags import learn_default


def organizer_required(func):
Expand Down
2 changes: 1 addition & 1 deletion lernanta/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
'lernanta.apps.news',
'lernanta.apps.pages',
'lernanta.apps.projects',
'lernanta.apps.discover',
'lernanta.apps.learn',
'lernanta.apps.badges',
'lernanta.apps.drumbeat',
'django_obi',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{% load l10n_tags %}
{% load learn_tags %}
<a class="filter {% if not learn_showcase and not learn_community and not learn_fresh and not learn_school and not learn_tag %}active{% endif %}" href="{% locale_url discover_learn %}">{{ _('View All') }}</a>
<a class="filter {% if not learn_showcase and not learn_community and not learn_fresh and not learn_school and not learn_tag %}active{% endif %}" href="{% locale_url learn_all %}">{{ _('View All') }}</a>
<h2><i class="icon-star-empty icon-large"></i>{{ _('Featured') }}</h2>
<a class="filter {% if learn_community %}active{% endif %}" href="{% locale_url discover_featured feature='community' %}">
<a class="filter {% if learn_community %}active{% endif %}" href="{% locale_url learn_featured feature='community' %}">
{{ _('Community Picks') }}
</a>
<a class="filter {% if learn_showcase %}active{% endif %}" href="{% locale_url discover_featured feature='showcase' %}">
<a class="filter {% if learn_showcase %}active{% endif %}" href="{% locale_url learn_featured feature='showcase' %}">
{{ _('Showcase') }}
</a>
<a class="filter {% if learn_fresh %}active{% endif %}" href="{% locale_url discover_featured feature='fresh' %}">
<a class="filter {% if learn_fresh %}active{% endif %}" href="{% locale_url learn_featured feature='fresh' %}">
{{ _('Fresh Additions') }}
</a>
<h2><i class="icon-trophy icon-large"></i>{{ _('Schools') }}</h2>
{% for school in schools %}
<a class="filter {% if learn_school.id == school.id %}active{% endif %}" href="{% locale_url discover_schools school_slug=school.slug %}">
<a class="filter {% if learn_school.id == school.id %}active{% endif %}" href="{% locale_url learn_schools school_slug=school.slug %}">
{{ school.short_name|title }}
</a>
{% endfor %}
Expand All @@ -30,12 +30,12 @@ <h2><i class="icon-tags icon-large"></i>{{ _('Tags') }}</h2>
</a>
{% endfor %}
<a href="./"><strong>{{ _('Clear Tags') }}</strong></a>
<a href="{% locale_url discover_learn_tags %}">
<a href="{% locale_url learn_tags %}">
<strong>{{ _('Browse All Tags') }}</strong>
<i class="icon-arrow-right"></i>
</a>
<h2><i class="icon-pencil icon-large"></i>{{ _('Preferences') }}</h2>
<form id="learn-projects-filter" action="{% locale_url discover_learn %}" method="get">
<form id="learn-projects-filter" action="{% locale_url learn_all %}" method="get">
{{ form.featured }}
{{ form.school }}
{{ form.tag }}
Expand All @@ -45,8 +45,8 @@ <h2><i class="icon-pencil icon-large"></i>{{ _('Preferences') }}</h2>
{{ form.language }}
</label>
{{ form.language.errors }}
</div>
<div class="field{% if form.reviewed.errors %} error{% endif %}">
</div>
<div class="field{% if form.reviewed.errors %} error{% endif %}">
<label for="id_reviewed">
{{ form.reviewed }}
{{ _('Community Reviewed') }}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<a href="{{ learn_school.get_absolute_url }}">{{ learn_school.name }}</a>
{% endif %}
<span class="arrow">&rsaquo;</span>
<a href="{% if learn_school %}{% locale_url discover_schools school_slug=learn_school.slug %}{% else %}{% learn_default %}{% endif %}">{{ _('Learn') }}</a>
<a href="{% if learn_school %}{% locale_url learn_schools school_slug=learn_school.slug %}{% else %}{% learn_default %}{% endif %}">{{ _('Learn') }}</a>
{% endblock %}
{% block breadcrumbs_actions %}
{% if user.is_authenticated %}
Expand All @@ -23,22 +23,22 @@

{% block body %}
<div id="sidebar">
{% include "discover/_learn_filters.html"%}
{% include "learn/_learn_filters.html"%}
</div>

<div id="main">
<br>
<section>
<h1 id="learn-header">
{% include "discover/_learn_header.html"%}
{% include "learn/_learn_header.html"%}
</h1>
<br>
<ul class="project-list">
{% include "discover/_learn_projects.html" %}
{% include "learn/_learn_projects.html" %}
</ul>
<br clear="both">
<div id="learn-pagination">
{% include "discover/_learn_pagination.html" %}
{% include "learn/_learn_pagination.html" %}
</div>
<a id="show-more-results" class="button" href="#">{{ _('Show More Results') }}</a>
</section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
<span class="arrow">&rsaquo;</span>
<a href="{% learn_default %}">{{ _('Learn') }}</a>
<span class="arrow">&rsaquo;</span>
<a href="{% locale_url discover_learn_tags %}">{{ _('Tags') }}</a>
<a href="{% locale_url learn_tags %}">{{ _('Tags') }}</a>
{% endblock %}

{% block body %}
<div id="main">
{% for tag in tags %}
<a href="{% locale_url discover_learn %}?filter_tags={{ tag.tag__name }}">
<a href="{% locale_url learn_all %}?filter_tags={{ tag.tag__name }}">
<font size={{tag.weight|floatformat:0}}>{{tag.tag__name}}</font>
</a>
{% endfor %}
Expand Down
2 changes: 1 addition & 1 deletion lernanta/templates/schools/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
{% if user.is_authenticated %}
<a id="create-project" class="button" href="{% locale_url projects_create %}">{{ _('Create') }}</a>
{% endif %}
<a class="button" href="{% locale_url discover_schools school_slug=school.slug %}">{{ _('Browse') }}</a>
<a class="button" href="{% locale_url learn_schools school_slug=school.slug %}">{{ _('Browse') }}</a>
{% endblock %}

{% block body %}
Expand Down
2 changes: 1 addition & 1 deletion lernanta/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
(r'^robots.txt$', include('robots.urls')),
(r'', include('activity.urls')),
(r'^statuses/', include('statuses.urls')),
(r'^groups/', include('discover.urls')),
(r'^groups/', include('learn.urls')),
(r'^groups/', include('projects.urls')),
(r'^schools/', include('schools.urls')),
(r'^relationships/', include('relationships.urls')),
Expand Down

0 comments on commit 8629b61

Please sign in to comment.