class CiteAdmin(admin.ModelAdmin):
list_display = ['nonempty_text', 'sticky', 'vip', 'small', 'has_image']
fieldsets = (
- (None, {'fields': ('book', 'text', 'small', 'vip', 'link', 'sticky')}),
+ (None, {'fields': ('book', 'text', 'small', 'vip', 'link', 'sticky', 'banner')}),
(
_('Background'),
{'fields': (
link = models.URLField(_('link'))
sticky = models.BooleanField(_('sticky'), default=False, db_index=True,
help_text=_('Sticky cites will take precedense.'))
+ banner = models.BooleanField(_('banner'), default=False, help_text=_('Adjust size to image, ignore the text'))
image = models.ImageField(
_('image'), upload_to='social/cite', null=True, blank=True,
{% load i18n %}
{% if main %}
- <section id="big-cite"{% if cite.image %} style="background-image: url('{{ cite.image.url }}'); background-position: 50% {{ cite.image_shift|default_if_none:50 }}%;"{% endif %} >
+ <section id="big-cite"{% if cite.image and not cite.banner %} style="background-image: url('{{ cite.image.url }}'); background-position: 50% {{ cite.image_shift|default_if_none:50 }}%;"{% endif %} {% if cite.banner %}class="banner"{% endif %}>
{% endif %}
{% if cite %}
- <a href="{{ cite.link }}" class="cite{% if cite.small %} cite-small{% endif %}">
- {% if cite.vip %}
- <p class='vip mono'><span>{{ cite.vip }} {% trans "recommends" %}:</span></p>
- {% endif %}
- <blockquote class="cite-body">
- <span>{{ cite.text|linebreaksbr|safe }}</span>
- </blockquote>
- {% if cite.book %}
- <p class="source mono"><span>{{ cite.book.pretty_title }}</span></p>
+ <a href="{{ cite.link }}" {% if not cite.banner %}class="cite{% if cite.small %} cite-small{% endif %}{% endif %}">
+ {% if cite.banner %}
+ <img src="{{ cite.image.url }}" width="100%"/>
+ {% else %}
+ {% if cite.vip %}
+ <p class='vip mono'><span>{{ cite.vip }} {% trans "recommends" %}:</span></p>
+ {% endif %}
+ <blockquote class="cite-body">
+ <span>{{ cite.text|linebreaksbr|safe }}</span>
+ </blockquote>
+ {% if cite.book %}
+ <p class="source mono"><span>{{ cite.book.pretty_title }}</span></p>
+ {% endif %}
{% endif %}
</a>
{% endif %}
background-image: url(/static/img/backdrop/book-drawer2.jpg);
}
+ &.banner {
+ background-image: none;
+ }
+
.cite {
@include size(padding, 46px 10px 48px 0);
background: none;