diff --git a/combo/data/migrations/0007_auto_20150529_1003.py b/combo/data/migrations/0007_auto_20150529_1003.py
new file mode 100644
index 00000000..9a26b341
--- /dev/null
+++ b/combo/data/migrations/0007_auto_20150529_1003.py
@@ -0,0 +1,38 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('data', '0006_linkcell'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='linkcell',
+ name='anchor',
+ field=models.CharField(max_length=150, verbose_name='Anchor', blank=True),
+ preserve_default=True,
+ ),
+ migrations.AddField(
+ model_name='linkcell',
+ name='link_page',
+ field=models.ForeignKey(related_name='link_cell', to='data.Page', null=True),
+ preserve_default=True,
+ ),
+ migrations.AlterField(
+ model_name='linkcell',
+ name='title',
+ field=models.CharField(max_length=150, verbose_name='Title', blank=True),
+ preserve_default=True,
+ ),
+ migrations.AlterField(
+ model_name='linkcell',
+ name='url',
+ field=models.URLField(verbose_name='URL', blank=True),
+ preserve_default=True,
+ ),
+ ]
diff --git a/combo/data/models.py b/combo/data/models.py
index 699a6eed..9723e0ff 100644
--- a/combo/data/models.py
+++ b/combo/data/models.py
@@ -440,8 +440,10 @@ class MenuCell(CellBase):
@register_cell_class
class LinkCell(CellBase):
- title = models.CharField(_('Title'), max_length=150)
- url = models.URLField(_('URL'))
+ title = models.CharField(_('Title'), max_length=150, blank=True)
+ url = models.URLField(_('URL'), blank=True)
+ link_page = models.ForeignKey('data.Page', related_name='link_cell', null=True)
+ anchor = models.CharField(_('Anchor'), max_length=150, blank=True)
template_name = 'combo/link-cell.html'
@@ -452,3 +454,14 @@ class LinkCell(CellBase):
if not self.title:
return None
return utils.ellipsize(self.title)
+
+ def render(self, context):
+ if self.link_page:
+ context['url'] = self.link_page.get_online_url()
+ context['title'] = self.title or self.link_page.title
+ else:
+ context['url'] = self.url
+ context['title'] = self.title or self.url
+ if self.anchor:
+ context['url'] += '#' + self.anchor
+ return super(LinkCell, self).render(context)
diff --git a/combo/public/templates/combo/link-cell.html b/combo/public/templates/combo/link-cell.html
index c96b7d8a..75a5b597 100644
--- a/combo/public/templates/combo/link-cell.html
+++ b/combo/public/templates/combo/link-cell.html
@@ -1 +1 @@
-{{cell.title}}
+{{title}}