manager: add an excerpt of the cell content in title
This commit is contained in:
parent
ebff1e6ad1
commit
20fae52c59
|
@ -65,3 +65,8 @@ class WcsFormCell(CellBase):
|
|||
response_json = requests.get(url).json()
|
||||
cache.set(url, response_json)
|
||||
return response_json
|
||||
|
||||
def get_additional_label(self):
|
||||
if not self.cached_title:
|
||||
return
|
||||
return self.cached_title
|
||||
|
|
|
@ -248,6 +248,15 @@ class TextCell(CellBase):
|
|||
def render(self, context):
|
||||
return mark_safe(self.text or '')
|
||||
|
||||
def get_additional_label(self):
|
||||
if not self.text:
|
||||
return None
|
||||
def ellipsize(text):
|
||||
if text < 50:
|
||||
return text
|
||||
return text[:40] + '...'
|
||||
return ellipsize(strip_tags(self.text))
|
||||
|
||||
|
||||
@register_cell_class
|
||||
class FortuneCell(CellBase):
|
||||
|
|
|
@ -51,6 +51,11 @@ div.cell h3 {
|
|||
font-weight: normal;
|
||||
}
|
||||
|
||||
div.cell h3 span.additional-label {
|
||||
font-size: 80%;
|
||||
padding-left: 1em;
|
||||
}
|
||||
|
||||
div.cell-list div h3:after {
|
||||
font-family: FontAwesome;
|
||||
content: "\f107"; /* angle-down */
|
||||
|
|
|
@ -74,7 +74,11 @@ This page redirects to: <a href="{{ object.redirect_url }}">{{ object.redirect_u
|
|||
<div class="cell-list">
|
||||
{% for cell in placeholder.cells %}
|
||||
<div class="cell" data-cell-reference="{{ cell.get_reference }}">
|
||||
<h3>{{ cell.get_label }}</h3>
|
||||
<h3>{{ cell.get_label }}
|
||||
{% if cell.get_additional_label %}
|
||||
<span class="additional-label">
|
||||
<i>{{cell.get_additional_label}}</i></span>{% endif %}
|
||||
</h3>
|
||||
<div>{% cell_form cell %}</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
|
Loading…
Reference in New Issue