media
search_index
+.sass-cache
+
class CategoryAdmin(admin.ModelAdmin):
- list_display = translated_fields(('title', 'slug'))
+ list_display = translated_fields(('title', 'slug')) + ('taxonomy',)
prepopulated_fields = dict([
("slug_%s" % lang_code, ("title_%s" % lang_code,))
for lang_code, lang_name in settings.LANGUAGES
{% block "main_menu" %}
- {% if entry.categories %}
- {% main_menu 'objects' entry.categories.all %}
- {% else %}
- {% main_menu 'entry_type' entry.type %}
- {% endif %}
+ {% main_menu 'object' entry %}
{% endblock "main_menu" %}
<div id="promobox">
<ul id="promobox-switcher">
{% for object in object_list.promobox %}
- <li>
- <a href=""
- {% if forloop.counter == 1 %} class="active"{% endif %}
+ <li {% if forloop.counter == 1 %} class="active"{% endif %}>
+ <a href="{{ object.get_absolute_url }}"
>{{ forloop.counter }}</a>
</li>
{% endfor %}
</ul>
+<div id="promobox-wrapper">
<ul class="promobox">
{% for object in object_list.promobox %}
- {% entry_promobox object %}
+ {% entry_promobox object forloop.counter %}
{% endfor %}
</ul>
+</div>
</div>
{% endif %}
{% load i18n %}
-<li class="promobox-item" style="
+<li class="promobox-item"{% if counter == 1 %}class="active"{% endif %}
+ style="
+ {% if counter != 1 %}display: none;{% endif %}
{% if object.image %}
background: url('{{ object.image.url }}');
background-size:100%;
background-position: 50% 50%;
{% else %}
- background: white;
+ background: black;
{% endif %}
">
+{% load i18n %}
<h2><a href="{{ object.get_absolute_url }}">{{ object.title }}</a></h2>
<div class="entry-data">
@register.simple_tag(takes_context=True)
-def entry_promobox(context, entry):
+def entry_promobox(context, entry, counter):
t = template.loader.select_template((
'migdal/entry/%s/entry_promobox.html' % entry.type,
'migdal/entry/entry_promobox.html',
context = {
'request': context['request'],
'object': entry,
+ 'counter': counter,
}
return t.render(template.Context(context))
class ModelMenuItem(object):
- def __init__(self, obj, html_id=None):
+ def __init__(self, obj, title=None, html_id=None):
self.obj = obj
- self.title = unicode(obj)
+ self.title = title or unicode(obj)
self.url = obj.get_absolute_url()
self.html_id = html_id
self.active = (chooser == 'object' and value == self.obj or
chooser == 'objects' and self.obj in value)
+class CategoryMenuItem(ModelMenuItem):
+ def check_active(self, chooser, value):
+ super(CategoryMenuItem, self).check_active(chooser, value)
+ self.active = (self.active or
+ (chooser == 'object' and isinstance(value, Entry) and
+ self.obj in value.categories.all()))
+
class EntryTypeMenuItem(object):
def __init__(self, title, type_, html_id=None):
ModelMenuItem(Entry.objects.get(slug_pl='o-nas')),
EntryTypeMenuItem(_(u'Publications'), u'publications'),
MenuItem(_(u'Events'), reverse('events')),
- ModelMenuItem(Category.objects.get(slug_pl='stanowisko')),
- ModelMenuItem(Category.objects.get(slug_pl='pierwsza-pomoc')),
+ CategoryMenuItem(Category.objects.get(slug_pl='stanowisko'), title=_('Positions')),
+ CategoryMenuItem(Category.objects.get(slug_pl='pierwsza-pomoc')),
]
if context['request'].LANGUAGE_CODE == 'pl':
items.append(MenuItem(u'en', '/en/', html_id='item-lang'))
'output_filename': 'compressed/base.css',
},
}
+PIPELINE_JS = {
+ 'base': {
+ 'source_filenames': (
+ 'js/promobox.js',
+ ),
+ 'output_filename': 'compressed/base.js',
+ },
+}
PIPELINE_COMPILERS = (
'pipeline.compilers.sass.SASSCompiler',
padding: 0;
margin: 0;
height: 32.3em;
- overflow: hidden; }
+ overflow: hidden;
+ position: relative; }
.promobox-item {
border-radius: 0 0 2em 0;
list-style: none;
padding: 0;
- margin: 0; }
+ margin: 0;
+ position: absolute;
+ width: 100%; }
.promobox-link {
background-image: url("/static/img/rog.png");
padding: .45em .5em;
border-radius: 0 1em 1em 0;
color: white; }
- #promobox-switcher a.active {
+ #promobox-switcher .active a {
background: #02529b; }
.promobox-info {
margin: 0;
height: 32.3em;
overflow: hidden;
-
+ position: relative;
}
.promobox-item {
border-radius: 0 0 2em 0;
list-style:none;
padding:0;
margin: 0;
+ position:absolute;
+ width: 100%;
}
.promobox-link {
background-image: url('/static/img/rog.png');
border-radius: 0 1em 1em 0;
color: white;
}
- a.active {
+ .active a {
background: #02529b;
}
}
--- /dev/null
+$(document).ready(function(){
+
+var $slides = $("ul.promobox li");
+var $switchers = $("ul#promobox-switcher li");
+
+var change_slide = function(slide_no) {
+ var $slide = $($slides.get(slide_no));
+ var $switcher = $($switchers.get(slide_no));
+
+ $slides.filter('.active').fadeOut();
+ $slides.filter('.active').removeClass('active');
+ $switchers.filter('.active').removeClass('active');
+ $slide.fadeIn();
+ $slide.addClass('active');
+ $switcher.addClass('active');
+ reset_timeout();
+};
+
+
+$switchers.each(function(i, e) {
+ $(e).click(function(e) {
+ e.preventDefault();
+ change_slide(i);
+ });
+});
+
+
+var timeout = null;
+var cycle_slide = function() {
+ var current = $slides.filter('.active').index();
+ change_slide((current + 1) % $slides.length);
+}
+var reset_timeout = function() {
+ clearTimeout(timeout);
+ timeout = setTimeout(cycle_slide, 5000);
+};
+timeout = setTimeout(cycle_slide, 3000);
+
+
+});
\ No newline at end of file
</div>
</div>
+ <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.0.min.js" charset="utf-8"></script>
+ {% compressed_js 'base' %}
</body>
</html>
\ No newline at end of file