From ff0855ab763b179c4715c2fd3b75908cc0d15895 Mon Sep 17 00:00:00 2001 From: Wesley Bomar Date: Tue, 17 Aug 2021 16:55:42 -0500 Subject: [PATCH] Squashed merge of site/frontera/task/GH-75-plugin --- .../contrib/taccsite_data_list/cms_plugins.py | 2 +- taccsite_cms/contrib/taccsite_data_list/models.py | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/taccsite_cms/contrib/taccsite_data_list/cms_plugins.py b/taccsite_cms/contrib/taccsite_data_list/cms_plugins.py index 0f53ee24d..fece7a03f 100644 --- a/taccsite_cms/contrib/taccsite_data_list/cms_plugins.py +++ b/taccsite_cms/contrib/taccsite_data_list/cms_plugins.py @@ -110,7 +110,7 @@ class TaccsiteDataListItemPlugin(CMSPluginBase): plugin_name='Link' ) + '\
\ - The "Link" plugin\'s "Display name" field takes precedence over this plugin\'s "Label" field. If "Link" pluign is not rendered, then check "Advanced settings" of this plugin.', + The "Link" plugin\'s "Display name" field takes precedence over this plugin\'s "Label" field. If "Link" plugin is not rendered, then check "Advanced settings" of this plugin.', 'fields': (), }), (_('Advanced settings'), { diff --git a/taccsite_cms/contrib/taccsite_data_list/models.py b/taccsite_cms/contrib/taccsite_data_list/models.py index e1562c822..750698739 100644 --- a/taccsite_cms/contrib/taccsite_data_list/models.py +++ b/taccsite_cms/contrib/taccsite_data_list/models.py @@ -11,6 +11,14 @@ +# Helpers + +def get_short_description(dict, value): + """Get layout class based on value.""" + return dict.get(value, {}).get('short_description') + + + # Constants ORIENTATION_CHOICES = get_choices(ORIENTATION_DICT) @@ -55,9 +63,9 @@ class TaccsiteDataList(CMSPlugin): attributes = fields.AttributesField() def get_short_description(self): - orientation = ORIENTATION_DICT[self.orientation]['short_description'] - type_style = TYPE_STYLE_DICT[self.type_style]['short_description'] - density = DENSITY_DICT[self.density]['short_description'] + orientation = get_short_description(ORIENTATION_DICT, self.orientation) + type_style = get_short_description(TYPE_STYLE_DICT, self.type_style) + density = get_short_description(DENSITY_DICT, self.density) return density + ', ' + orientation + ' ' + type_style