Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core: create image carousel on front page
- Loading branch information
Showing
16 changed files
with
182 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,4 @@ rev-manifest.json | |
tmp/ | ||
virtualenv/ | ||
.DS_Store | ||
media/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.10.7 on 2017-07-22 16:13 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('core', '0023_auto_20160704_2155'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='CarouselSlide', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('active_from', models.DateTimeField(blank=True, null=True)), | ||
('active_until', models.DateTimeField(blank=True, null=True)), | ||
('href', models.CharField(blank=True, default='', max_length=512)), | ||
('title', models.CharField(blank=True, default='', max_length=512)), | ||
('image_file', models.FileField(blank=True, upload_to='carousel_slides')), | ||
('image_credit', models.CharField(blank=True, default='', max_length=512)), | ||
('target', models.CharField(choices=[('', 'Same window'), ('_blank', 'New window')], default='', max_length=6)), | ||
], | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from django.db import models | ||
from django.utils.translation import ugettext_lazy as _ | ||
|
||
from core.utils import get_objects_within_period | ||
|
||
|
||
TARGET_CHOICES = [ | ||
('', _('Same window')), | ||
('_blank', _('New window')), | ||
] | ||
|
||
|
||
class CarouselSlide(models.Model): | ||
active_from = models.DateTimeField(blank=True, null=True) | ||
active_until = models.DateTimeField(blank=True, null=True) | ||
href = models.CharField(max_length=512, blank=True, default='') | ||
title = models.CharField(max_length=512, blank=True, default='') | ||
image_file = models.FileField(upload_to='carousel_slides', blank=True) | ||
image_credit = models.CharField(max_length=512, blank=True, default='') | ||
target = models.CharField( | ||
choices=TARGET_CHOICES, | ||
max_length=max(len(key) for (key, label) in TARGET_CHOICES), | ||
default=TARGET_CHOICES[0][0], | ||
) | ||
|
||
@classmethod | ||
def get_active_slides(cls, t=None, **extra_criteria): | ||
return get_objects_within_period(cls, t=t, **extra_criteria) | ||
|
||
def __str__(self): | ||
return self.title |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
- load i18n | ||
if carousel_slides.exists | ||
.carousel.slide#core-frontpage-carousel(data-ride='carousel', style='margin-top: -25px') | ||
ol.carousel-indicators | ||
for slide in carousel_slides | ||
if forloop.first | ||
li.active(data-target='#core-frontpage-carousel', data-slide-to='{{ forloop.counter0 }}') | ||
else | ||
li(data-target='#core-frontpage-carousel', data-slide-to='{{ forloop.counter0 }}') | ||
|
||
.carousel-inner(role="listbox") | ||
for slide in carousel_slides | ||
a.item(href="{{ slide.href }}" | ||
target="{{ slide.target }}" | ||
class="{% if forloop.first %}active{% endif %}" | ||
style="background-image: url({{ slide.image_file.url }})") | ||
.carousel-caption | ||
if slide.image_credit | ||
.slide-image-credit {% trans "Picture:" %} {{ slide.image_credit }} | ||
.slide-title {{ slide.title }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
extends base | ||
block full_title | ||
| {{ settings.KOMPASSI_INSTALLATION_NAME }} | ||
block content | ||
if "branding" in settings.INSTALLED_APPS | ||
include branding_frontpage.jade | ||
include core_event_boxen.jade | ||
include core_organization_boxen.jade | ||
block content_full_width | ||
include core_frontpage_carousel.jade | ||
|
||
.container | ||
include core_event_boxen.jade | ||
include core_organization_boxen.jade |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters