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

Feature/link plugin style templates #192

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion cmsplugin_filer_link/cms_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,26 @@
from cms.plugin_pool import plugin_pool
from django.utils.translation import ugettext as _
from django.conf import settings
from django.template.loader import select_template

from .models import FilerLinkPlugin


class FilerLinkPlugin(CMSPluginBase):
module = 'Filer'
model = FilerLinkPlugin
name = _("Link")
text_enabled = True
raw_id_fields = ('page_link', )
render_template = "cmsplugin_filer_link/link.html"
TEMPLATE_NAME = 'cmsplugin_filer_link/plugins/link/%s.html'
render_template = 'cmsplugin_filer_link/link.html'

def render(self, context, instance, placeholder):
self.render_template = select_template((
self.TEMPLATE_NAME % instance.link_style,
'cmsplugin_filer_link/link.html',)
)

if instance.file:
link = instance.file.url
elif instance.mailto:
Expand Down