зеркало из https://github.com/mozilla/bedrock.git
Alternate job listing view (still needs styling)
This commit is contained in:
Родитель
84dd574dcb
Коммит
f5785190dc
|
@ -0,0 +1,62 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block page_title %}{{ _('Open Positions | Mozilla') }}{% endblock %}
|
||||
|
||||
{% block js %}
|
||||
<script type="text/javascript">
|
||||
|
||||
var handleResponse = function(data) {
|
||||
var job_ids = [];
|
||||
$.each(data, function(k, v) {
|
||||
job_ids.push(k);
|
||||
});
|
||||
$('ul.positions').children().filter(function(i) {
|
||||
var job_id = $(this).attr('job_id');
|
||||
return $.inArray(job_id, job_ids) < 0;
|
||||
}).addClass('faded');
|
||||
};
|
||||
|
||||
$('ul#locations li a').click(function(e) {
|
||||
e.preventDefault();
|
||||
$('ul.positions').children().removeClass('faded');
|
||||
var city = $(this).text().toLowerCase();
|
||||
if (city == 'all locations') {
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
url: '/jobvite/positions/',
|
||||
dataType: 'json',
|
||||
data: { location: city },
|
||||
success: handleResponse,
|
||||
error: function() {
|
||||
$('ul.positions').children().addClass('faded');
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>{{ _('Open Positions') }}</h1>
|
||||
<ul id="locations">
|
||||
<!-- todo: make these degrade gracefully, i.e. link to something real -->
|
||||
<li><a href="#">All Locations</a></li>
|
||||
<li><a href="#">Mountain View</a></li>
|
||||
<li><a href="#">Toronto</a></li>
|
||||
<li><a href="#">Beijing</a></li>
|
||||
<li><a href="#">Aukland</a></li>
|
||||
<li><a href="#">Remote</a></li>
|
||||
</ul>
|
||||
|
||||
{% for category, positions in categorized|dictsort(true) %}
|
||||
<h3>{{ category }}</h3>
|
||||
<ul class="positions">
|
||||
{% for position in positions %}
|
||||
<li job_id="{{ position.job_id }}"><a href="{{ url('careers.views.position', job_id=position.job_id) }}">{{ position.title }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endfor %}
|
||||
|
||||
{% endblock %}
|
|
@ -4,6 +4,7 @@ from django.conf.urls.defaults import patterns
|
|||
urlpatterns = patterns('',
|
||||
# Example:
|
||||
(r'^careers/?$', 'careers.views.careers'),
|
||||
(r'^careers/all/?$', 'careers.views.careers_two'),
|
||||
(r'^careers/(?P<slug>[\w-]+)/$', 'careers.views.department'),
|
||||
(r'^careers/position/(?P<job_id>[\w]+)/$', 'careers.views.position'),
|
||||
)
|
||||
|
|
|
@ -12,6 +12,20 @@ def careers(request, slug=None):
|
|||
})
|
||||
|
||||
|
||||
def careers_two(request):
|
||||
positions = Position.objects.all()
|
||||
categorized = {}
|
||||
categories = Category.objects.all()
|
||||
for category in categories:
|
||||
categorized[category.name] = [p for p in positions
|
||||
if category in p.category.all()]
|
||||
return jingo.render(request, 'careers/all.html', {
|
||||
'positions': positions,
|
||||
'categories': categories,
|
||||
'categorized': categorized,
|
||||
})
|
||||
|
||||
|
||||
def department(request, slug):
|
||||
selected = get_object_or_404(Category, slug=slug)
|
||||
categories = Category.objects.all()
|
||||
|
|
|
@ -39,3 +39,7 @@ div#position h1, h2, h3 {
|
|||
padding: 0px;
|
||||
margin: 0px 0px 10px 0px;
|
||||
}
|
||||
|
||||
.faded, .faded a {
|
||||
color: #ccc;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче