From f01726dc6f27492a20007ca51d4dda82f1eb43c8 Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Wed, 29 Aug 2018 11:01:33 -0400 Subject: [PATCH] Almost there, one more (preexisting) bug to fix. This adds validation on save and correct processing to the page writer. --- lib/galaxy/webapps/galaxy/controllers/page.py | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/lib/galaxy/webapps/galaxy/controllers/page.py b/lib/galaxy/webapps/galaxy/controllers/page.py index 7215eb335c5..70e5f1577f0 100644 --- a/lib/galaxy/webapps/galaxy/controllers/page.py +++ b/lib/galaxy/webapps/galaxy/controllers/page.py @@ -992,9 +992,31 @@ class PageController(BaseUIController, SharableMixin, pass +PLACEHOLDER_TEMPLATE = ''' +
+

Embedded Galaxy {class_shorthand} - '{item_name}'

+

[Do not edit this block; Galaxy will fill it in with the annotated {class_shorthand} when it is displayed]

+
''' + +# This is a mapping of the id portion of page contents to the cssclass/shortname. +PAGE_CLASS_MAPPING = { + 'History': 'History', + 'HistoryDatasetAssociation': 'Dataset', + 'StoredWorkflow': 'Workflow', + 'Visualization': 'Visualization' +} + + def _placeholderRenderForSave(trans, item_class, item_id): try: decoded_item_id = int(item_id) except ValueError: decoded_item_id = trans.app.security.decode_id(item_id) - return '
' % (item_class, decoded_item_id) + class_shorthand = PAGE_CLASS_MAPPING[item_class] + return PLACEHOLDER_TEMPLATE.format( + item_class=item_class, + class_shorthand=class_shorthand, + class_shorthand_lower=class_shorthand.lower(), + item_id=decoded_item_id, + item_name='' + )