From e0d31cbacda85187d59ee7d1c4d9ca96066bea0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= Date: Wed, 4 Mar 2020 04:48:50 +0000 Subject: [PATCH 1/7] core: set a status message when errors found after editing component --- .../Component_checkSourceCodeAndValidateAfterModified.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/dynamic_class_generation_interaction_workflow/scripts/Component_checkSourceCodeAndValidateAfterModified.py b/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/dynamic_class_generation_interaction_workflow/scripts/Component_checkSourceCodeAndValidateAfterModified.py index 06d43041367..329cb390219 100644 --- a/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/dynamic_class_generation_interaction_workflow/scripts/Component_checkSourceCodeAndValidateAfterModified.py +++ b/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/dynamic_class_generation_interaction_workflow/scripts/Component_checkSourceCodeAndValidateAfterModified.py @@ -1,4 +1,6 @@ +from Products.ERP5Type.Message import translateString obj = state_change['object'] +request = container.REQUEST error_list = [] warning_list = [] @@ -13,6 +15,12 @@ for message_dict in obj.checkSourceCode(): else: warning_list.append(message) +if warning_list or error_list: + request.set( + 'portal_status_message', + translateString("Errors found in source code.")) + request.set('portal_status_level', 'error') + obj.setTextContentWarningMessageList(warning_list) obj.setTextContentErrorMessageList(error_list) -- 2.30.9 From 2948b0f654815f19764da7d0d42d863df1daa1db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= Date: Wed, 8 Apr 2020 09:28:55 +0200 Subject: [PATCH 2/7] core: add "onlyjio" actions to components This allows editing components in ERP5JS, while keeping the same behavior in erp5_xhtml_style --- .../Document%20Component/web_view.xml | 81 +++++++++ .../Extension%20Component/web_view.xml | 81 +++++++++ .../Interface%20Component/web_view.xml | 81 +++++++++ .../Mixin%20Component/web_view.xml | 81 +++++++++ .../Module%20Component/web_view.xml | 81 +++++++++ .../Test%20Component/web_view.xml | 81 +++++++++ .../Tool%20Component/web_view.xml | 81 +++++++++ .../erp5_core/ComponentMixin_viewAsWeb.xml | 162 ++++++++++++++++++ .../my_description.xml | 101 +++++++++++ .../ComponentMixin_viewAsWeb/my_id.xml | 101 +++++++++++ .../ComponentMixin_viewAsWeb/my_reference.xml | 101 +++++++++++ .../my_source_reference.xml | 94 ++++++++++ .../my_text_content.xml | 88 ++++++++++ .../my_text_content_error_message_list.xml | 127 ++++++++++++++ .../my_text_content_warning_message_list.xml | 115 +++++++++++++ .../my_translated_validation_state_title.xml | 96 +++++++++++ .../ComponentMixin_viewAsWeb/my_version.xml | 116 +++++++++++++ .../erp5_core/bt/template_action_path_list | 7 + 18 files changed, 1675 insertions(+) create mode 100644 product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/Document%20Component/web_view.xml create mode 100644 product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/Extension%20Component/web_view.xml create mode 100644 product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/Interface%20Component/web_view.xml create mode 100644 product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/Mixin%20Component/web_view.xml create mode 100644 product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/Module%20Component/web_view.xml create mode 100644 product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/Test%20Component/web_view.xml create mode 100644 product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/Tool%20Component/web_view.xml create mode 100644 product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentMixin_viewAsWeb.xml create mode 100644 product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentMixin_viewAsWeb/my_description.xml create mode 100644 product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentMixin_viewAsWeb/my_id.xml create mode 100644 product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentMixin_viewAsWeb/my_reference.xml create mode 100644 product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentMixin_viewAsWeb/my_source_reference.xml create mode 100644 product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentMixin_viewAsWeb/my_text_content.xml create mode 100644 product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentMixin_viewAsWeb/my_text_content_error_message_list.xml create mode 100644 product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentMixin_viewAsWeb/my_text_content_warning_message_list.xml create mode 100644 product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentMixin_viewAsWeb/my_translated_validation_state_title.xml create mode 100644 product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentMixin_viewAsWeb/my_version.xml diff --git a/product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/Document%20Component/web_view.xml b/product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/Document%20Component/web_view.xml new file mode 100644 index 00000000000..4b85a69bc46 --- /dev/null +++ b/product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/Document%20Component/web_view.xml @@ -0,0 +1,81 @@ + + + + + + + + + + action + + AAAAAAAAAAI= + + + + categories + + + action_type/object_onlyjio_view + + + + + category + object_onlyjio_view + + + condition + + + + description + + + + + + icon + + + + id + web_view + + + permissions + + + View + + + + + priority + 2.0 + + + title + View + + + visible + 1 + + + + + + + + + + + + text + string:${object_url}/ComponentMixin_viewAsWeb + + + + + diff --git a/product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/Extension%20Component/web_view.xml b/product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/Extension%20Component/web_view.xml new file mode 100644 index 00000000000..4b85a69bc46 --- /dev/null +++ b/product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/Extension%20Component/web_view.xml @@ -0,0 +1,81 @@ + + + + + + + + + + action + + AAAAAAAAAAI= + + + + categories + + + action_type/object_onlyjio_view + + + + + category + object_onlyjio_view + + + condition + + + + description + + + + + + icon + + + + id + web_view + + + permissions + + + View + + + + + priority + 2.0 + + + title + View + + + visible + 1 + + + + + + + + + + + + text + string:${object_url}/ComponentMixin_viewAsWeb + + + + + diff --git a/product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/Interface%20Component/web_view.xml b/product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/Interface%20Component/web_view.xml new file mode 100644 index 00000000000..4b85a69bc46 --- /dev/null +++ b/product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/Interface%20Component/web_view.xml @@ -0,0 +1,81 @@ + + + + + + + + + + action + + AAAAAAAAAAI= + + + + categories + + + action_type/object_onlyjio_view + + + + + category + object_onlyjio_view + + + condition + + + + description + + + + + + icon + + + + id + web_view + + + permissions + + + View + + + + + priority + 2.0 + + + title + View + + + visible + 1 + + + + + + + + + + + + text + string:${object_url}/ComponentMixin_viewAsWeb + + + + + diff --git a/product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/Mixin%20Component/web_view.xml b/product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/Mixin%20Component/web_view.xml new file mode 100644 index 00000000000..4b85a69bc46 --- /dev/null +++ b/product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/Mixin%20Component/web_view.xml @@ -0,0 +1,81 @@ + + + + + + + + + + action + + AAAAAAAAAAI= + + + + categories + + + action_type/object_onlyjio_view + + + + + category + object_onlyjio_view + + + condition + + + + description + + + + + + icon + + + + id + web_view + + + permissions + + + View + + + + + priority + 2.0 + + + title + View + + + visible + 1 + + + + + + + + + + + + text + string:${object_url}/ComponentMixin_viewAsWeb + + + + + diff --git a/product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/Module%20Component/web_view.xml b/product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/Module%20Component/web_view.xml new file mode 100644 index 00000000000..4b85a69bc46 --- /dev/null +++ b/product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/Module%20Component/web_view.xml @@ -0,0 +1,81 @@ + + + + + + + + + + action + + AAAAAAAAAAI= + + + + categories + + + action_type/object_onlyjio_view + + + + + category + object_onlyjio_view + + + condition + + + + description + + + + + + icon + + + + id + web_view + + + permissions + + + View + + + + + priority + 2.0 + + + title + View + + + visible + 1 + + + + + + + + + + + + text + string:${object_url}/ComponentMixin_viewAsWeb + + + + + diff --git a/product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/Test%20Component/web_view.xml b/product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/Test%20Component/web_view.xml new file mode 100644 index 00000000000..4b85a69bc46 --- /dev/null +++ b/product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/Test%20Component/web_view.xml @@ -0,0 +1,81 @@ + + + + + + + + + + action + + AAAAAAAAAAI= + + + + categories + + + action_type/object_onlyjio_view + + + + + category + object_onlyjio_view + + + condition + + + + description + + + + + + icon + + + + id + web_view + + + permissions + + + View + + + + + priority + 2.0 + + + title + View + + + visible + 1 + + + + + + + + + + + + text + string:${object_url}/ComponentMixin_viewAsWeb + + + + + diff --git a/product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/Tool%20Component/web_view.xml b/product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/Tool%20Component/web_view.xml new file mode 100644 index 00000000000..4b85a69bc46 --- /dev/null +++ b/product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/Tool%20Component/web_view.xml @@ -0,0 +1,81 @@ + + + + + + + + + + action + + AAAAAAAAAAI= + + + + categories + + + action_type/object_onlyjio_view + + + + + category + object_onlyjio_view + + + condition + + + + description + + + + + + icon + + + + id + web_view + + + permissions + + + View + + + + + priority + 2.0 + + + title + View + + + visible + 1 + + + + + + + + + + + + text + string:${object_url}/ComponentMixin_viewAsWeb + + + + + diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentMixin_viewAsWeb.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentMixin_viewAsWeb.xml new file mode 100644 index 00000000000..041c42a9acd --- /dev/null +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentMixin_viewAsWeb.xml @@ -0,0 +1,162 @@ + + + + + + + + + + _bind_names + + + + + + + + + + _asgns + + + + + + + + + + + _objects + + + + + + action + Base_edit + + + description + + + + edit_order + + + + + + encoding + UTF-8 + + + enctype + + + + group_list + + + left + right + center + bottom + hidden + + + + + groups + + + + bottom + + + my_text_content + + + + + center + + + + + + hidden + + + + + + left + + + my_id + my_reference + my_version + my_text_content_error_message_list + my_text_content_warning_message_list + + + + + right + + + my_source_reference + my_description + my_translated_validation_state_title + + + + + + + + id + ComponentMixin_viewAsWeb + + + method + POST + + + name + Component_view + + + pt + form_view + + + row_length + 4 + + + stored_encoding + UTF-8 + + + title + Component + + + unicode_mode + 0 + + + update_action + + + + update_action_title + + + + + + diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentMixin_viewAsWeb/my_description.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentMixin_viewAsWeb/my_description.xml new file mode 100644 index 00000000000..94031a85446 --- /dev/null +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentMixin_viewAsWeb/my_description.xml @@ -0,0 +1,101 @@ + + + + + + + + + + delegated_list + + + title + width + + + + + id + my_description + + + message_values + + + + external_validator_failed + The input failed the external validator. + + + + + + overrides + + + + field_id + + + + form_id + + + + target + + + + + + + tales + + + + field_id + + + + form_id + + + + target + + + + + + + values + + + + field_id + my_text_area_field + + + form_id + Base_viewFieldLibrary + + + target + Click to edit the target + + + title + Description + + + width + 50 + + + + + + + + diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentMixin_viewAsWeb/my_id.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentMixin_viewAsWeb/my_id.xml new file mode 100644 index 00000000000..8ac1dc2cc93 --- /dev/null +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentMixin_viewAsWeb/my_id.xml @@ -0,0 +1,101 @@ + + + + + + + + + + delegated_list + + + display_width + title + + + + + id + my_id + + + message_values + + + + external_validator_failed + The input failed the external validator. + + + + + + overrides + + + + field_id + + + + form_id + + + + target + + + + + + + tales + + + + field_id + + + + form_id + + + + target + + + + + + + values + + + + display_width + 60 + + + field_id + my_view_mode_id + + + form_id + Base_viewFieldLibrary + + + target + Click to edit the target + + + title + ID + + + + + + + + diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentMixin_viewAsWeb/my_reference.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentMixin_viewAsWeb/my_reference.xml new file mode 100644 index 00000000000..1381aaeed31 --- /dev/null +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentMixin_viewAsWeb/my_reference.xml @@ -0,0 +1,101 @@ + + + + + + + + + + delegated_list + + + display_width + title + + + + + id + my_reference + + + message_values + + + + external_validator_failed + The input failed the external validator. + + + + + + overrides + + + + field_id + + + + form_id + + + + target + + + + + + + tales + + + + field_id + + + + form_id + + + + target + + + + + + + values + + + + display_width + 60 + + + field_id + my_string_field + + + form_id + Base_viewFieldLibrary + + + target + Click to edit the target + + + title + Reference + + + + + + + + diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentMixin_viewAsWeb/my_source_reference.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentMixin_viewAsWeb/my_source_reference.xml new file mode 100644 index 00000000000..26adbdc3e09 --- /dev/null +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentMixin_viewAsWeb/my_source_reference.xml @@ -0,0 +1,94 @@ + + + + + + + + + + delegated_list + + + display_width + editable + title + + + + + id + my_source_reference + + + message_values + + + + external_validator_failed + The input failed the external validator. + + + + + + overrides + + + + field_id + + + + form_id + + + + + + + tales + + + + field_id + + + + form_id + + + + + + + values + + + + display_width + 20 + + + editable + 0 + + + field_id + my_view_mode_reference + + + form_id + Base_viewFieldLibrary + + + title + Origin + + + + + + + + diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentMixin_viewAsWeb/my_text_content.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentMixin_viewAsWeb/my_text_content.xml new file mode 100644 index 00000000000..7a32ce53bd9 --- /dev/null +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentMixin_viewAsWeb/my_text_content.xml @@ -0,0 +1,88 @@ + + + + + + + + + + delegated_list + + + title + + + + + id + my_text_content + + + message_values + + + + external_validator_failed + The input failed the external validator. + + + + + + overrides + + + + field_id + + + + form_id + + + + + + + tales + + + + field_id + + + + form_id + + + + title + + + + + + + values + + + + field_id + my_view_mode_text_content + + + form_id + Base_viewFieldLibrary + + + title + Source Code + + + + + + + + diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentMixin_viewAsWeb/my_text_content_error_message_list.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentMixin_viewAsWeb/my_text_content_error_message_list.xml new file mode 100644 index 00000000000..f60acdecae6 --- /dev/null +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentMixin_viewAsWeb/my_text_content_error_message_list.xml @@ -0,0 +1,127 @@ + + + + + + + + + + delegated_list + + + css_class + editable + height + title + + + + + id + my_text_content_error_message_list + + + message_values + + + + external_validator_failed + The input failed the external validator. + + + + + + overrides + + + + field_id + + + + form_id + + + + target + + + + + + + tales + + + + css_class + + + + editable + + + + field_id + + + + form_id + + + + height + + + + target + + + + title + + + + + + + values + + + + css_class + error + + + editable + 0 + + + field_id + my_lines_field + + + form_id + Base_viewFieldLibrary + + + height + 3 + + + target + Click to edit the target + + + title + Errors + + + + + + + + diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentMixin_viewAsWeb/my_text_content_warning_message_list.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentMixin_viewAsWeb/my_text_content_warning_message_list.xml new file mode 100644 index 00000000000..1bfc6f6e1bf --- /dev/null +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentMixin_viewAsWeb/my_text_content_warning_message_list.xml @@ -0,0 +1,115 @@ + + + + + + + + + + delegated_list + + + css_class + editable + title + view_separator + + + + + id + my_text_content_warning_message_list + + + message_values + + + + external_validator_failed + The input failed the external validator. + + + + + + overrides + + + + field_id + + + + form_id + + + + target + + + + + + + tales + + + + field_id + + + + form_id + + + + target + + + + + + + values + + + + css_class + warning + + + editable + 0 + + + field_id + my_lines_field + + + form_id + Base_viewFieldLibrary + + + target + Click to edit the target + + + title + Warnings + + + view_separator + + +]]> + + + + + + + + diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentMixin_viewAsWeb/my_translated_validation_state_title.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentMixin_viewAsWeb/my_translated_validation_state_title.xml new file mode 100644 index 00000000000..63322fb6801 --- /dev/null +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentMixin_viewAsWeb/my_translated_validation_state_title.xml @@ -0,0 +1,96 @@ + + + + + + + + + + delegated_list + + + css_class + + + + + id + my_translated_validation_state_title + + + message_values + + + + external_validator_failed + The input failed the external validator. + + + + + + overrides + + + + field_id + + + + form_id + + + + target + + + + + + + tales + + + + field_id + + + + form_id + + + + target + + + + + + + values + + + + css_class + editor_validation_state + + + field_id + my_view_mode_translated_workflow_state_title + + + form_id + Base_viewFieldLibrary + + + target + Click to edit the target + + + + + + + + diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentMixin_viewAsWeb/my_version.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentMixin_viewAsWeb/my_version.xml new file mode 100644 index 00000000000..d93b48033b5 --- /dev/null +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentMixin_viewAsWeb/my_version.xml @@ -0,0 +1,116 @@ + + + + + + + + + + delegated_list + + + title + items + + + + + id + my_version + + + message_values + + + + external_validator_failed + The input failed the external validator. + + + + + + overrides + + + + field_id + + + + form_id + + + + target + + + + + + + tales + + + + field_id + + + + form_id + + + + items + + AAAAAAAAAAI= + + + + target + + + + + + + values + + + + field_id + my_list_field + + + form_id + Base_viewFieldLibrary + + + target + Click to edit the target + + + title + Version + + + + + + + + + + + + + + + _text + python: [(v, v) for v in here.getPortalObject().getVersionPriorityNameList()] + + + + + diff --git a/product/ERP5/bootstrap/erp5_core/bt/template_action_path_list b/product/ERP5/bootstrap/erp5_core/bt/template_action_path_list index 1b94b41ab05..d3d76c8df33 100644 --- a/product/ERP5/bootstrap/erp5_core/bt/template_action_path_list +++ b/product/ERP5/bootstrap/erp5_core/bt/template_action_path_list @@ -77,19 +77,24 @@ Contribution Registry Tool | view Diff Tool | view Distributed Ram Cache | view Document Component | view +Document Component | web_view Document | view Domain Generator | view Domain Tool | view Domain | view Dynamic Category Property | view Extension Component | view +Extension Component | web_view Folder | view Id Tool | view Interface Component | view +Interface Component | web_view Memcached Plugin | view Memcached Tool | view Mixin Component | view +Mixin Component | web_view Module Component | view +Module Component | web_view Predicate | view Preference Tool Type | jump_property_sheets Preference Tool Type | view @@ -146,7 +151,9 @@ Template Tool | upgrade_from_repository Template Tool | view Test Component | run_live_test Test Component | view +Test Component | web_view Tool Component | view +Tool Component | web_view Trash Bin | jump_bt5 Trash Bin | view Trash Folder | view -- 2.30.9 From 1d48b2b831b408b1c02bb75f5959f732a8df76e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= Date: Wed, 4 Mar 2020 05:52:16 +0100 Subject: [PATCH 3/7] monaco_editor: fix typescript errors --- .../monaco-editor.gadget.js.js | 40 +++++++++++-------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/bt5/erp5_monaco_editor/SkinTemplateItem/portal_skins/erp5_monaco_editor/monaco-editor.gadget.js.js b/bt5/erp5_monaco_editor/SkinTemplateItem/portal_skins/erp5_monaco_editor/monaco-editor.gadget.js.js index 52d818815fe..a17661bc53f 100644 --- a/bt5/erp5_monaco_editor/SkinTemplateItem/portal_skins/erp5_monaco_editor/monaco-editor.gadget.js.js +++ b/bt5/erp5_monaco_editor/SkinTemplateItem/portal_skins/erp5_monaco_editor/monaco-editor.gadget.js.js @@ -3,6 +3,11 @@ (function(window, rJS, monaco) { 'use strict'; + // globals + const JSLINT = window['JSLINT']; + const prettier = window['prettier']; + const prettierPlugins = window['prettierPlugins']; + rJS(window) .declareAcquiredMethod('notifySubmit', 'notifySubmit') .declareJob('deferNotifySubmit', function() { @@ -14,15 +19,14 @@ // Ensure error will be correctly handled return this.notifyChange(); }) - .ready(function() { - var context = this, - editor; + .ready(function(context) { + let editor; function deferNotifyChange() { if (!context.state.ignoredChangeDuringInitialization) { return context.deferNotifyChange(); } } - this.editor = editor = monaco.editor.create( + context.editor = editor = monaco.editor.create( this.element.querySelector('.monaco-container'), { /* because Alt+Click is LeftClick on ChromeOS */ @@ -154,18 +158,20 @@ }); // Type mapping for Nexedi libraries - function addExtraLibrary(script_name, lib_name) { - return fetch(script_name) - .then(function(resp) { - return resp.text(); - }) - .then(function(script_code) { - monaco.languages.typescript.javascriptDefaults.addExtraLib( - script_code, - lib_name - ); - }); - } + const addExtraLibrary = function(script_name, lib_name) { + return () => { + return fetch(script_name) + .then(function(resp) { + return resp.text(); + }) + .then(function(script_code) { + monaco.languages.typescript.javascriptDefaults.addExtraLib( + script_code, + lib_name + ); + }); + }; + }; queue .push(addExtraLibrary('./monaco-rsvp.d.ts', 'rsvp')) .push(addExtraLibrary('./monaco-renderjs.d.ts', 'renderjs')) @@ -190,4 +196,4 @@ } return form_data; }); -})(window, rJS, monaco); +})(window, rJS, window['monaco']); -- 2.30.9 From 6f968a38dd70c867d18f54b2dbc405f89096427b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= Date: Wed, 4 Mar 2020 05:53:26 +0100 Subject: [PATCH 4/7] monaco_editor: activate python mode for components --- .../erp5_monaco_editor/monaco-editor.gadget.js.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bt5/erp5_monaco_editor/SkinTemplateItem/portal_skins/erp5_monaco_editor/monaco-editor.gadget.js.js b/bt5/erp5_monaco_editor/SkinTemplateItem/portal_skins/erp5_monaco_editor/monaco-editor.gadget.js.js index a17661bc53f..537103f21ef 100644 --- a/bt5/erp5_monaco_editor/SkinTemplateItem/portal_skins/erp5_monaco_editor/monaco-editor.gadget.js.js +++ b/bt5/erp5_monaco_editor/SkinTemplateItem/portal_skins/erp5_monaco_editor/monaco-editor.gadget.js.js @@ -88,7 +88,16 @@ model_language = 'javascript'; } else if (options.portal_type === 'Web Style') { model_language = 'css'; - } else if (options.portal_type === 'Python Script') { + } else if ( + options.portal_type === 'Python Script' || + options.portal_type === 'Test Component' || + options.portal_type === 'Extension Component' || + options.portal_type === 'Document Component' || + options.portal_type === 'Tool Component' || + options.portal_type === 'Interface Component' || + options.portal_type === 'Mixin Component' || + options.portal_type === 'Module Component' + ) { model_language = 'python'; } state_dict.model_language = model_language; -- 2.30.9 From dd22cd9ccb3380bc88cb19ede8c5f5d49a42c2f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= Date: Wed, 4 Mar 2020 05:37:06 +0000 Subject: [PATCH 5/7] monaco_editor_ui_test: test source code editor with new UI --- .../testCodeEditorRenderJSStyle.xml | 58 +++++++++ .../testCodeEditorRenderJSStyle.zpt | 121 ++++++++++++++++++ 2 files changed, 179 insertions(+) create mode 100644 bt5/erp5_monaco_editor_ui_test/PathTemplateItem/portal_tests/monaco_editor_zuite/testCodeEditorRenderJSStyle.xml create mode 100644 bt5/erp5_monaco_editor_ui_test/PathTemplateItem/portal_tests/monaco_editor_zuite/testCodeEditorRenderJSStyle.zpt diff --git a/bt5/erp5_monaco_editor_ui_test/PathTemplateItem/portal_tests/monaco_editor_zuite/testCodeEditorRenderJSStyle.xml b/bt5/erp5_monaco_editor_ui_test/PathTemplateItem/portal_tests/monaco_editor_zuite/testCodeEditorRenderJSStyle.xml new file mode 100644 index 00000000000..8e713babcc7 --- /dev/null +++ b/bt5/erp5_monaco_editor_ui_test/PathTemplateItem/portal_tests/monaco_editor_zuite/testCodeEditorRenderJSStyle.xml @@ -0,0 +1,58 @@ + + + + + + + + + + _bind_names + + + + + + + + + + _asgns + + + + name_subpath + traverse_subpath + + + + + + + + + + + content_type + text/html + + + expand + 0 + + + id + testCodeEditorRenderJSStyle + + + output_encoding + utf-8 + + + title + + + + + + diff --git a/bt5/erp5_monaco_editor_ui_test/PathTemplateItem/portal_tests/monaco_editor_zuite/testCodeEditorRenderJSStyle.zpt b/bt5/erp5_monaco_editor_ui_test/PathTemplateItem/portal_tests/monaco_editor_zuite/testCodeEditorRenderJSStyle.zpt new file mode 100644 index 00000000000..75652ae039f --- /dev/null +++ b/bt5/erp5_monaco_editor_ui_test/PathTemplateItem/portal_tests/monaco_editor_zuite/testCodeEditorRenderJSStyle.zpt @@ -0,0 +1,121 @@ + + + +Python Code Editor Gadget RenderJS Style + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Python Code Editor Gadget RenderJS Style
open${base_url}/foo_module/ListBoxZuite_reset
assertTextPresentReset Successfully.
Set preferred text editor
open${base_url}/portal_preferences/erp5_ui_test_preference/Preference_viewHtmlStyle
click//input[@name="field_my_preferred_text_editor" and @value="monaco"]
clickAndWait//button[@name='Base_edit:method']
Switch to renderjs UI and edit components
open${base_url}/web_site_module/renderjs_runner/#/portal_components?editable=true
Testing
waitForElementPresent//a[@data-i18n='Add']
clicklink=Add
waitForElementPresent//select[@name='field_your_select_action']
select//select[@name='field_your_select_action']label=
Wait for editor to be loaded and edit
waitForElementPresent//div[@data-gadget-scope="editor"]//iframe
selectFrame//div[@data-gadget-scope="editor"]//iframe
waitForElementPresentcss=div.monaco-editor.vs
storeEvalselenium.browserbot.getCurrentWindow().document.querySelector('div.monaco-editor.vs').getAttribute('data-uri')model-data-uri
assertEvalselenium.browserbot.getCurrentWindow().monaco.editor.getModel(storedVars['model-data-uri']).setValue("'ok'")null
selectFramerelative=top
click//button[@data-i18n="Save"]
selectFrame//div[@data-gadget-scope="editor"]//iframe
waitForElementPresentcss=div.monaco-editor.vs
storeEvalselenium.browserbot.getCurrentWindow().document.querySelector('div.monaco-editor.vs').getAttribute('data-uri')model-data-uri
assertEvalselenium.browserbot.getCurrentWindow().monaco.editor.getModel(storedVars['model-data-uri']).setValue("Syntax:Error")null
selectFramerelative=top
click//button[@data-i18n="Save"]
Check that our edition is reflected.
waitForElementPresent//div[@data-gadget-scope="editor"]//iframe
selectFrame//div[@data-gadget-scope="editor"]//iframe
waitForText//bodyglob:1*Syntax:Error
selectFramerelative=top
Use breadcrumbs to go back to portal components
waitForElementPresent//a[@data-i18n="Views"]
click//a[@data-i18n="Views"]
waitForElementPresent//a[.="portal_components"]
click//a[.="portal_components"]
+ + \ No newline at end of file -- 2.30.9 From a437b0ccfcc8fc5905f34adfd1cb1e61ce8bab69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= Date: Wed, 4 Mar 2020 05:44:31 +0000 Subject: [PATCH 6/7] code_mirror: enable python mode for all component types Some new components were introduced, but that list was not updated --- .../portal_skins/erp5_code_mirror/codemirror.gadget.js.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bt5/erp5_code_mirror/SkinTemplateItem/portal_skins/erp5_code_mirror/codemirror.gadget.js.js b/bt5/erp5_code_mirror/SkinTemplateItem/portal_skins/erp5_code_mirror/codemirror.gadget.js.js index 7380aa9a5da..a1933646e65 100644 --- a/bt5/erp5_code_mirror/SkinTemplateItem/portal_skins/erp5_code_mirror/codemirror.gadget.js.js +++ b/bt5/erp5_code_mirror/SkinTemplateItem/portal_skins/erp5_code_mirror/codemirror.gadget.js.js @@ -81,6 +81,10 @@ mode = 'css'; } else if ((options.portal_type === 'Python Script') || (options.portal_type === 'Test Component') || + (options.portal_type === 'Module Component') || + (options.portal_type === 'Interface Component') || + (options.portal_type === 'Document Component') || + (options.portal_type === 'Tool Component') || (options.portal_type === 'Extension Component')) { mode = 'python'; } -- 2.30.9 From cff996cdf73055c4f3e93a1d73b9276a845c5b4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= Date: Fri, 8 Nov 2019 02:48:59 +0000 Subject: [PATCH 7/7] monaco_editor: make editor really full page using the solution from https://stackoverflow.com/a/45753938 and also a rule to disable body margin from user agent stylesheet, in chrome there's a 8px margin. --- .../erp5_monaco_editor/monaco-editor.gadget.html.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bt5/erp5_monaco_editor/SkinTemplateItem/portal_skins/erp5_monaco_editor/monaco-editor.gadget.html.html b/bt5/erp5_monaco_editor/SkinTemplateItem/portal_skins/erp5_monaco_editor/monaco-editor.gadget.html.html index 6edbbd25eab..574b22d9aa4 100644 --- a/bt5/erp5_monaco_editor/SkinTemplateItem/portal_skins/erp5_monaco_editor/monaco-editor.gadget.html.html +++ b/bt5/erp5_monaco_editor/SkinTemplateItem/portal_skins/erp5_monaco_editor/monaco-editor.gadget.html.html @@ -24,7 +24,7 @@ - -
+ +
-- 2.30.9