misc: add description to form & link cell contexts (#55776)
This commit is contained in:
parent
1f871c2e6e
commit
64859f4837
|
@ -25,6 +25,7 @@ from django.contrib.postgres.fields import JSONField
|
|||
from django.db import models
|
||||
from django.forms import Select
|
||||
from django.forms import models as model_forms
|
||||
from django.utils.safestring import mark_safe
|
||||
from django.utils.text import slugify
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from requests.exceptions import RequestException
|
||||
|
@ -128,6 +129,7 @@ class WcsFormCell(CellBase):
|
|||
context['title'] = self.cached_title
|
||||
context['url'] = self.cached_url + 'tryauth'
|
||||
if self.cached_json:
|
||||
context['description'] = mark_safe(self.cached_json.get('description', ''))
|
||||
context['css_classes'] = get_formdef_css_classes(self.cached_json)
|
||||
for attribute in self.cached_json:
|
||||
if not attribute in context:
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
{% block cell-content %}
|
||||
<div class="wcs-form-{{slug}}"><a href="{{ url }}">{{ title }}</a>
|
||||
{% if cell.cached_json.description %}
|
||||
{% if description %}
|
||||
<div class="description">
|
||||
{{ cell.cached_json.description|safe }}
|
||||
{{ description }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
|
|
@ -1399,6 +1399,7 @@ class LinkCell(CellBase):
|
|||
extra_context = super(LinkCell, self).get_cell_extra_context(context)
|
||||
if self.link_page:
|
||||
extra_context['title'] = self.title or self.link_page.title
|
||||
extra_context['description'] = self.link_page.description
|
||||
else:
|
||||
extra_context['title'] = self.title or self.url
|
||||
url = self.get_url(context)
|
||||
|
|
Loading…
Reference in New Issue