Skip to content

Commit

Permalink
Squashed merge of site/frontera/task/GH-75-plugin at commit 6645360
Browse files Browse the repository at this point in the history
  • Loading branch information
wesleyboar committed Aug 13, 2021
1 parent d7922cd commit ea4535f
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 4 deletions.
17 changes: 17 additions & 0 deletions taccsite_cms/contrib/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
TEXT_FOR_NESTED_PLUGIN_CONTENT_ADD = '\
<dl>\
<dt>To add {element},</dt>\
<dd>nest "{plugin_name}" plugin inside this plugin.</dd>\
<dt>To edit {element},</dt>\
<dd>edit existing nested "{plugin_name}" plugin.*</dd>\
</dl>\
<br />\
* If the existing content is from a plugin not nested within this one, then you should nest it inside this one instead.'

TEXT_FOR_NESTED_PLUGIN_CONTENT_SWAP = '\
<dl>\
<dt>To add {element},</dt>\
<dd>nest "{plugin_name}" plugin inside this plugin.</dd>\
<dt>To edit {element},</dt>\
<dd>edit existing nested "{plugin_name}" plugin.</dd>\
</dl>'
20 changes: 18 additions & 2 deletions taccsite_cms/contrib/taccsite_data_list/cms_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from cms.plugin_pool import plugin_pool
from django.utils.translation import gettext_lazy as _

from taccsite_cms.contrib.constants import TEXT_FOR_NESTED_PLUGIN_CONTENT_SWAP
from taccsite_cms.contrib.helpers import (
concat_classnames,
AbstractMaxChildrenPlugin
Expand Down Expand Up @@ -103,8 +104,23 @@ class TaccsiteDataListItemPlugin(CMSPluginBase):
(None, {
'fields': (
('key', 'value'),
('use_plugin_as_key'),
)
),
}),
(_('Link'), {
'classes': ('collapse',),
'description': TEXT_FOR_NESTED_PLUGIN_CONTENT_SWAP.format(
element='a link',
plugin_name='Link'
) + '\
<br />\
The "Link" plugin\'s "Display name" field takes precedence over this plugin\'s "Label" field. <small>If "Link" pluign is not rendered, then check "Advanced settings" of this plugin.</small>',
'fields': (),
}),
(_('Advanced settings'), {
'classes': ('collapse',),
'fields': (
'use_plugin_as_key',
),
})
]

Expand Down
4 changes: 2 additions & 2 deletions taccsite_cms/contrib/taccsite_data_list/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ class TaccsiteDataListItem(CMSPlugin):
"""
key = models.CharField(
verbose_name=_('Label'),
help_text=_('A label for the data value. To create a link, add a child plugin.'),
blank=False,
help_text=_('A label for the data value.'),
blank=True,
max_length=50,
)
value = models.CharField(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ table.c-data-list {
}
}

/* To space out elements (tables) */
th.c-data-list__key,
td.c-data-list__value {
padding-block: 0.5em;
}

/* To add colon (non-tables) */
.c-data-list__key:not(th)::after {
content: ':';
Expand Down

0 comments on commit ea4535f

Please sign in to comment.