Skip to content
This repository has been archived by the owner on Nov 27, 2019. It is now read-only.

[AAMC-970] News: Add Attribution Field to Media #281

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions cmsplugin_filer_image/cms_plugins.py
Expand Up @@ -29,6 +29,8 @@ class FilerImagePlugin(CMSPluginBase):
(None, {
'fields': [
'caption_text',
'caption_alignment',
'attribution_text',
'image',
'image_url',
'alt_text',
Expand Down
24 changes: 24 additions & 0 deletions cmsplugin_filer_image/migrations/0010_auto_20170118_1713.py
@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('cmsplugin_filer_image', '0009_auto_20160713_1853'),
]

operations = [
migrations.AddField(
model_name='filerimage',
name='attribution_text',
field=models.CharField(max_length=255, null=True, verbose_name='attribution text', blank=True),
),
migrations.AddField(
model_name='filerimage',
name='caption_alignment',
field=models.CharField(blank=True, max_length=10, null=True, verbose_name='caption alignment', choices=[('left', 'left'), ('right', 'right')]),
),
]
@@ -1,35 +1,39 @@
{% load thumbnail filer_tags filer_image_tags %}{% spaceless %}
{% comment %}
You may change the image size for special cases in your project by overriding
this template. There are a few size manipulation filters for this in
`filer_image_tags`:
You may change the image size for special cases in your project by overriding
this template. There are a few size manipulation filters for this in
`filer_image_tags`:

{% if placeholder == 'my_special_sidebar' %}
{% thumbnail instance.image opts.size|extra_padding_y:10 crop=opts.crop upscale=opts.upscale as thumbnail %}
{% else %}
{% thumbnail instance.image opts.size crop=opts.crop upscale=opts.upscale as thumbnail %}
{% endif %}
{% if link %}<a href="{{ link }}"{% if instance.target_blank %} target="_blank"{% endif %} {{ instance.link_attributes_str }}>{% endif %}<img{% if instance.alignment %} class="{{ instance.alignment }}"{% endif %} alt="{% if instance.alt %}{{ instance.alt }}{% endif %}" src="{{ thumbnail.url }}"{% if instance.caption %} title="{{ instance.caption }}"{% endif %} />{% if link %}</a>{% endif %}
{% if placeholder == 'my_special_sidebar' %}
{% thumbnail instance.image opts.size|extra_padding_y:10 crop=opts.crop upscale=opts.upscale as thumbnail %}
{% else %}
{% thumbnail instance.image opts.size crop=opts.crop upscale=opts.upscale as thumbnail %}
{% endif %}
{% if link %}<a href="{{ link }}"{% if instance.target_blank %} target="_blank"{% endif %}>{% endif %}<img{% if instance.alignment %} class="{{ instance.alignment }}"{% endif %} alt="{% if instance.alt %}{{ instance.alt }}{% endif %}" src="{{ thumbnail.url }}"{% if instance.caption %} title="{{ instance.caption }}"{% endif %} />{% if link %}</a>{% endif %}
{% endcomment %}

{% if link %}<a href="{{ link }}"{% if instance.target_blank %} target="_blank"{% endif %} class="filer_image_link" {{ instance.link_attributes_str }}>{% endif %}
{% if instance.image %}
{% if instance.use_original_image %}
<img class="filer_image{% if instance.alignment %} {{ instance.alignment }}{% endif %}{% if instance.use_autoscale %} img-responsive{% endif %}" alt="{% if instance.alt %}{{ instance.alt }}{% endif %}" src="{{ instance.image.url }}"{% if instance.width %} width="{{ instance.width }}"{% endif %}{% if instance.height %} height="{{ instance.height }}"{% endif %}{% if instance.caption %} title="{{ instance.caption }}"{% endif %} />
{% else %}
{% thumbnail instance.image size crop=opts.crop upscale=opts.upscale subject_location=opts.subject_location as thumbnail %}
<img class="filer_image {% if instance.alignment %}{{ instance.alignment }}{% endif %}{% if instance.use_autoscale %} img-responsive{% endif %}" alt="{% if instance.alt %}{{ instance.alt }}{% endif %}" src="{{ thumbnail.url }}"{% if instance.width %} width="{{ instance.width }}"{% endif %}{% if instance.height %} height="{{ instance.height }}"{% endif %}{% if instance.caption %} title="{{ instance.caption }}"{% endif %} />
{% endif %}
{% else %}
{# just a plain link to some external image #}
<img class="filer_image {% if instance.alignment %}{{ instance.alignment }}{% endif %}{% if instance.use_autoscale %} img-responsive{% endif %}" alt="{% if instance.alt %}{{ instance.alt }}{% endif %}" src="{{ instance.image_url }}"{% if size.0 %} width="{{ size.0 }}"{% endif %}{% if size.1 %} height="{{ size.1 }}"{% endif %}{% if instance.caption %} title="{{ instance.caption }}"{% endif %} />
{% endif %}
{% if instance.caption or instance.description %}
<span class="filer_image_info">
{% if instance.caption %}<span class="title">{{ instance.caption }}</span>{% endif %}
{% if instance.description %}<span class="desc">{{ instance.description }}</span>{% endif %}
</span>
{% endif %}
{% if link %}</a>{% endif %}

<div class="django-filer-image filer-{% if instance.alignment %}{{ instance.alignment }}{% endif %}">
{% if link %}<a href="{{ link }}"{% if instance.target_blank %} target="_blank"{% endif %} class="filer_image_link">{% endif %}
{% if instance.image %}
{% if instance.use_original_image %}
<img class="filer_image" alt="{% if instance.alt %}{{ instance.alt }}{% endif %}" src="{{ instance.image.url }}"{% if instance.width %} width="{{ instance.width }}"{% endif %}{% if instance.height %} height="{{ instance.height }}"{% endif %}{% if instance.caption %} title="{{ instance.caption }}"{% endif %} />
{% else %}
{% thumbnail instance.image size crop=opts.crop upscale=opts.upscale subject_location=opts.subject_location as thumbnail %}
<img class="filer_image" alt="{% if instance.alt %}{{ instance.alt }}{% endif %}" src="{{ thumbnail.url }}"{% if instance.width %} width="{{ instance.width }}"{% endif %}{% if instance.height %} height="{{ instance.height }}"{% endif %}{% if instance.caption %} title="{{ instance.caption }}"{% endif %} />
{% endif %}
{% else %}
{# just a plain link to some external image #}
<img class="filer_image" alt="{% if instance.alt %}{{ instance.alt }}{% endif %}" src="{{ instance.image_url }}"{% if size.0 %} width="{{ size.0 }}"{% endif %}{% if size.1 %} height="{{ size.1 }}"{% endif %}{% if instance.caption %} title="{{ instance.caption }}"{% endif %} />
{% endif %}
{% if instance.caption or instance.attribution or instance.description %}
<div class="filer_image_info"{% if instance.alignment and instance.width %} style="max-width: {{ instance.width }}px;"{% endif %}>
{% if instance.caption %}
<span class="title"{% if instance.caption_alignment %} style="text-align: {{ instance.caption_aligntment }}"{% endif %}>{{ instance.caption }}</span>
{% if instance.attribution %}<span>{{ instance.attribution }}</span>{% endif %}
{% if instance.description %}<br/>{% endif %}
{% endif %}
{% if instance.description %}<span class="desc">{{ instance.description }}</span>{% endif %}
</div>
{% endif %}
{% if link %}</a>{% endif %}
</div>
{% endspaceless %}