Commit 224ef953 authored by Luuk Scholten's avatar Luuk Scholten
Browse files

Add absolute url to go directly to vacancies

parent 4ce21b27
......@@ -130,6 +130,12 @@ class Vacancy(models.Model):
class Meta:
verbose_name_plural = _('Vacancies')
def get_absolute_url(self):
url = reverse('partners:vacancies')
if self.partner:
url = reverse('partners:partner', args=(self.partner.slug,))
return '{}#vacancy-{}'.format(url, self.pk)
class PartnerEvent(models.Model, metaclass=ModelTranslateMeta):
partner = models.ForeignKey(
......
......@@ -20,7 +20,7 @@
<!-- .portfolio-filter -->
<div class="isotope-filter tabs-wrapper tabs-centered clearfix">
<ul class="tabs">
<li class="{% if not preselected_category %}current{% endif %}">
<li class="{% if not preselected_category %}current{% endif %}" id="tab-everything">
<a href="#">{% trans "Everything" %}</a>
</li>
{% for category in categories %}
......@@ -37,7 +37,9 @@
<div class="row isotope-items">
{% for vacancy in vacancies %}
<div class="team span4 clearfix isotope-item"
data-filter="{% for cat in vacancy.categories.all %}category-{{ cat.id }} {% endfor %}">
data-filter="{% for cat in vacancy.categories.all %}category-{{ cat.id }} {% endfor %}"
data-vacancy="{{ vacancy.id }}"
>
<div class="team-header">
{% if vacancy.get_company_logo %}
<img src="{{ vacancy.get_company_logo.url }}" alt="">
......@@ -110,11 +112,17 @@
isotopeFilter = isotope.find('.isotope-filter'),
isotopePosts = isotope.find('.isotope-items');
var windowhash = window.location.hash;
if (jQuery().isotope) {
isotopeFilter.delegate('li', 'click', function(e) {
var filter;
if ($(this).data('filter')==undefined) {
if (windowhash !== '' && windowhash.substr(0, 9) === '#vacancy-') {
filter = '[data-vacancy*="' + windowhash.replace('#vacancy-', '') + '"]';
$('#tab-everything').removeClass('current');
windowhash = '';
} else if ($(this).data('filter')==undefined) {
filter='*';
} else {
filter='[data-filter*="' + $(this).data('filter') + '"]';
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment