diff --git a/.travis.yml b/.travis.yml index ede0cdb80a49..74368db938cf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ env: matrix: - LINT_CHECK="1" - TESTS="1" ODOO_REPO="OCA/OCB" - - TESTS="1" ODOO_REPO="odoo/odoo" + - TESTS="1" ODOO_REPO="odoo/odoo" MAKEPOT="1" install: diff --git a/setup/_metapackage/VERSION.txt b/setup/_metapackage/VERSION.txt new file mode 100644 index 000000000000..3c36591b61c3 --- /dev/null +++ b/setup/_metapackage/VERSION.txt @@ -0,0 +1 @@ +11.0.20190227.0 \ No newline at end of file diff --git a/setup/_metapackage/setup.cfg b/setup/_metapackage/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/setup/_metapackage/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/setup/_metapackage/setup.py b/setup/_metapackage/setup.py new file mode 100644 index 000000000000..17eda132aa74 --- /dev/null +++ b/setup/_metapackage/setup.py @@ -0,0 +1,52 @@ +import setuptools + +with open('VERSION.txt', 'r') as f: + version = f.read().strip() + +setuptools.setup( + name="odoo11-addons-oca-web", + description="Meta package for oca-web Odoo addons", + version=version, + install_requires=[ + 'odoo11-addon-web_action_conditionable', + 'odoo11-addon-web_advanced_search', + 'odoo11-addon-web_decimal_numpad_dot', + 'odoo11-addon-web_dialog_size', + 'odoo11-addon-web_disable_export_group', + 'odoo11-addon-web_editor_background_color', + 'odoo11-addon-web_environment_ribbon', + 'odoo11-addon-web_export_view', + 'odoo11-addon-web_favicon', + 'odoo11-addon-web_group_expand', + 'odoo11-addon-web_ir_actions_act_multi', + 'odoo11-addon-web_ir_actions_act_view_reload', + 'odoo11-addon-web_listview_range_select', + 'odoo11-addon-web_m2x_options', + 'odoo11-addon-web_no_bubble', + 'odoo11-addon-web_notify', + 'odoo11-addon-web_responsive', + 'odoo11-addon-web_search_with_and', + 'odoo11-addon-web_searchbar_full_width', + 'odoo11-addon-web_send_message_popup', + 'odoo11-addon-web_sheet_full_width', + 'odoo11-addon-web_timeline', + 'odoo11-addon-web_tree_dynamic_colored_field', + 'odoo11-addon-web_tree_image', + 'odoo11-addon-web_tree_many2one_clickable', + 'odoo11-addon-web_tree_resize_column', + 'odoo11-addon-web_widget_bokeh_chart', + 'odoo11-addon-web_widget_color', + 'odoo11-addon-web_widget_datepicker_options', + 'odoo11-addon-web_widget_domain_editor_dialog', + 'odoo11-addon-web_widget_image_download', + 'odoo11-addon-web_widget_image_url', + 'odoo11-addon-web_widget_many2many_tags_multi_selection', + 'odoo11-addon-web_widget_url_advanced', + 'odoo11-addon-web_widget_x2many_2d_matrix', + 'odoo11-addon-web_widget_x2many_2d_matrix_example', + ], + classifiers=[ + 'Programming Language :: Python', + 'Framework :: Odoo', + ] +) diff --git a/setup/web_action_conditionable/odoo/__init__.py b/setup/web_action_conditionable/odoo/__init__.py deleted file mode 100644 index de40ea7ca058..000000000000 --- a/setup/web_action_conditionable/odoo/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__import__('pkg_resources').declare_namespace(__name__) diff --git a/setup/web_action_conditionable/odoo/addons/__init__.py b/setup/web_action_conditionable/odoo/addons/__init__.py deleted file mode 100644 index de40ea7ca058..000000000000 --- a/setup/web_action_conditionable/odoo/addons/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__import__('pkg_resources').declare_namespace(__name__) diff --git a/setup/web_advanced_search/odoo/addons/web_advanced_search b/setup/web_advanced_search/odoo/addons/web_advanced_search new file mode 120000 index 000000000000..77a1d3db86cc --- /dev/null +++ b/setup/web_advanced_search/odoo/addons/web_advanced_search @@ -0,0 +1 @@ +../../../../web_advanced_search \ No newline at end of file diff --git a/setup/web_advanced_search/setup.cfg b/setup/web_advanced_search/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/setup/web_advanced_search/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/setup/web_advanced_search/setup.py b/setup/web_advanced_search/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/web_advanced_search/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/web_disable_export_group/odoo/addons/web_disable_export_group b/setup/web_disable_export_group/odoo/addons/web_disable_export_group new file mode 120000 index 000000000000..d8a2f35c1a37 --- /dev/null +++ b/setup/web_disable_export_group/odoo/addons/web_disable_export_group @@ -0,0 +1 @@ +../../../../web_disable_export_group \ No newline at end of file diff --git a/setup/web_disable_export_group/setup.cfg b/setup/web_disable_export_group/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/setup/web_disable_export_group/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/setup/web_disable_export_group/setup.py b/setup/web_disable_export_group/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/web_disable_export_group/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/web_editor_background_color/odoo/addons/web_editor_background_color b/setup/web_editor_background_color/odoo/addons/web_editor_background_color new file mode 120000 index 000000000000..c3c5fcfddeff --- /dev/null +++ b/setup/web_editor_background_color/odoo/addons/web_editor_background_color @@ -0,0 +1 @@ +../../../../web_editor_background_color \ No newline at end of file diff --git a/setup/web_editor_background_color/setup.cfg b/setup/web_editor_background_color/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/setup/web_editor_background_color/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/setup/web_editor_background_color/setup.py b/setup/web_editor_background_color/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/web_editor_background_color/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/web_export_view/odoo/addons/web_export_view b/setup/web_export_view/odoo/addons/web_export_view new file mode 120000 index 000000000000..b6de71e3935a --- /dev/null +++ b/setup/web_export_view/odoo/addons/web_export_view @@ -0,0 +1 @@ +../../../../web_export_view \ No newline at end of file diff --git a/setup/web_export_view/setup.cfg b/setup/web_export_view/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/setup/web_export_view/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/setup/web_export_view/setup.py b/setup/web_export_view/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/web_export_view/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/web_group_expand/odoo/addons/web_group_expand b/setup/web_group_expand/odoo/addons/web_group_expand new file mode 120000 index 000000000000..bfe3387eb14e --- /dev/null +++ b/setup/web_group_expand/odoo/addons/web_group_expand @@ -0,0 +1 @@ +../../../../web_group_expand \ No newline at end of file diff --git a/setup/web_group_expand/setup.cfg b/setup/web_group_expand/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/setup/web_group_expand/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/setup/web_group_expand/setup.py b/setup/web_group_expand/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/web_group_expand/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/web_ir_actions_act_multi/odoo/addons/web_ir_actions_act_multi b/setup/web_ir_actions_act_multi/odoo/addons/web_ir_actions_act_multi new file mode 120000 index 000000000000..70dacab2198a --- /dev/null +++ b/setup/web_ir_actions_act_multi/odoo/addons/web_ir_actions_act_multi @@ -0,0 +1 @@ +../../../../web_ir_actions_act_multi \ No newline at end of file diff --git a/setup/web_ir_actions_act_multi/setup.cfg b/setup/web_ir_actions_act_multi/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/setup/web_ir_actions_act_multi/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/setup/web_ir_actions_act_multi/setup.py b/setup/web_ir_actions_act_multi/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/web_ir_actions_act_multi/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/web_ir_actions_act_view_reload/odoo/addons/web_ir_actions_act_view_reload b/setup/web_ir_actions_act_view_reload/odoo/addons/web_ir_actions_act_view_reload new file mode 120000 index 000000000000..7ce67dc50547 --- /dev/null +++ b/setup/web_ir_actions_act_view_reload/odoo/addons/web_ir_actions_act_view_reload @@ -0,0 +1 @@ +../../../../web_ir_actions_act_view_reload \ No newline at end of file diff --git a/setup/web_ir_actions_act_view_reload/setup.cfg b/setup/web_ir_actions_act_view_reload/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/setup/web_ir_actions_act_view_reload/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/setup/web_ir_actions_act_view_reload/setup.py b/setup/web_ir_actions_act_view_reload/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/web_ir_actions_act_view_reload/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/web_listview_range_select/odoo/addons/web_listview_range_select b/setup/web_listview_range_select/odoo/addons/web_listview_range_select new file mode 120000 index 000000000000..131f2ee050d0 --- /dev/null +++ b/setup/web_listview_range_select/odoo/addons/web_listview_range_select @@ -0,0 +1 @@ +../../../../web_listview_range_select \ No newline at end of file diff --git a/setup/web_listview_range_select/setup.cfg b/setup/web_listview_range_select/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/setup/web_listview_range_select/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/setup/web_listview_range_select/setup.py b/setup/web_listview_range_select/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/web_listview_range_select/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/web_m2x_options/odoo/addons/web_m2x_options b/setup/web_m2x_options/odoo/addons/web_m2x_options new file mode 120000 index 000000000000..16ed8b7f0af2 --- /dev/null +++ b/setup/web_m2x_options/odoo/addons/web_m2x_options @@ -0,0 +1 @@ +../../../../web_m2x_options \ No newline at end of file diff --git a/setup/web_m2x_options/setup.cfg b/setup/web_m2x_options/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/setup/web_m2x_options/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/setup/web_m2x_options/setup.py b/setup/web_m2x_options/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/web_m2x_options/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/web_notify/odoo/addons/web_notify b/setup/web_notify/odoo/addons/web_notify new file mode 120000 index 000000000000..f778fe739b62 --- /dev/null +++ b/setup/web_notify/odoo/addons/web_notify @@ -0,0 +1 @@ +../../../../web_notify \ No newline at end of file diff --git a/setup/web_notify/setup.cfg b/setup/web_notify/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/setup/web_notify/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/setup/web_notify/setup.py b/setup/web_notify/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/web_notify/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/web_search_with_and/odoo/addons/web_search_with_and b/setup/web_search_with_and/odoo/addons/web_search_with_and new file mode 120000 index 000000000000..d32981712daa --- /dev/null +++ b/setup/web_search_with_and/odoo/addons/web_search_with_and @@ -0,0 +1 @@ +../../../../web_search_with_and \ No newline at end of file diff --git a/setup/web_search_with_and/setup.cfg b/setup/web_search_with_and/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/setup/web_search_with_and/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/setup/web_search_with_and/setup.py b/setup/web_search_with_and/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/web_search_with_and/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/web_send_message_popup/odoo/addons/web_send_message_popup b/setup/web_send_message_popup/odoo/addons/web_send_message_popup new file mode 120000 index 000000000000..6fb492b625aa --- /dev/null +++ b/setup/web_send_message_popup/odoo/addons/web_send_message_popup @@ -0,0 +1 @@ +../../../../web_send_message_popup \ No newline at end of file diff --git a/setup/web_send_message_popup/setup.cfg b/setup/web_send_message_popup/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/setup/web_send_message_popup/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/setup/web_send_message_popup/setup.py b/setup/web_send_message_popup/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/web_send_message_popup/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/web_timeline/odoo/addons/web_timeline b/setup/web_timeline/odoo/addons/web_timeline new file mode 120000 index 000000000000..580d87bcd3c0 --- /dev/null +++ b/setup/web_timeline/odoo/addons/web_timeline @@ -0,0 +1 @@ +../../../../web_timeline \ No newline at end of file diff --git a/setup/web_timeline/setup.cfg b/setup/web_timeline/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/setup/web_timeline/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/setup/web_timeline/setup.py b/setup/web_timeline/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/web_timeline/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/web_tree_image/odoo/addons/web_tree_image b/setup/web_tree_image/odoo/addons/web_tree_image new file mode 120000 index 000000000000..53de5befb7be --- /dev/null +++ b/setup/web_tree_image/odoo/addons/web_tree_image @@ -0,0 +1 @@ +../../../../web_tree_image \ No newline at end of file diff --git a/setup/web_tree_image/setup.cfg b/setup/web_tree_image/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/setup/web_tree_image/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/setup/web_tree_image/setup.py b/setup/web_tree_image/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/web_tree_image/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/web_tree_resize_column/odoo/addons/web_tree_resize_column b/setup/web_tree_resize_column/odoo/addons/web_tree_resize_column new file mode 120000 index 000000000000..a6031842b0bc --- /dev/null +++ b/setup/web_tree_resize_column/odoo/addons/web_tree_resize_column @@ -0,0 +1 @@ +../../../../web_tree_resize_column \ No newline at end of file diff --git a/setup/web_tree_resize_column/setup.cfg b/setup/web_tree_resize_column/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/setup/web_tree_resize_column/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/setup/web_tree_resize_column/setup.py b/setup/web_tree_resize_column/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/web_tree_resize_column/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/web_widget_datepicker_options/odoo/addons/web_widget_datepicker_options b/setup/web_widget_datepicker_options/odoo/addons/web_widget_datepicker_options new file mode 120000 index 000000000000..282598f1c68b --- /dev/null +++ b/setup/web_widget_datepicker_options/odoo/addons/web_widget_datepicker_options @@ -0,0 +1 @@ +../../../../web_widget_datepicker_options \ No newline at end of file diff --git a/setup/web_widget_datepicker_options/setup.cfg b/setup/web_widget_datepicker_options/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/setup/web_widget_datepicker_options/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/setup/web_widget_datepicker_options/setup.py b/setup/web_widget_datepicker_options/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/web_widget_datepicker_options/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/web_widget_domain_editor_dialog/odoo/addons/web_widget_domain_editor_dialog b/setup/web_widget_domain_editor_dialog/odoo/addons/web_widget_domain_editor_dialog new file mode 120000 index 000000000000..a36691af28cb --- /dev/null +++ b/setup/web_widget_domain_editor_dialog/odoo/addons/web_widget_domain_editor_dialog @@ -0,0 +1 @@ +../../../../web_widget_domain_editor_dialog \ No newline at end of file diff --git a/setup/web_widget_domain_editor_dialog/setup.cfg b/setup/web_widget_domain_editor_dialog/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/setup/web_widget_domain_editor_dialog/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/setup/web_widget_domain_editor_dialog/setup.py b/setup/web_widget_domain_editor_dialog/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/web_widget_domain_editor_dialog/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/web_widget_image_download/odoo/addons/web_widget_image_download b/setup/web_widget_image_download/odoo/addons/web_widget_image_download new file mode 120000 index 000000000000..ab050eae885f --- /dev/null +++ b/setup/web_widget_image_download/odoo/addons/web_widget_image_download @@ -0,0 +1 @@ +../../../../web_widget_image_download \ No newline at end of file diff --git a/setup/web_widget_image_download/setup.cfg b/setup/web_widget_image_download/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/setup/web_widget_image_download/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/setup/web_widget_image_download/setup.py b/setup/web_widget_image_download/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/web_widget_image_download/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/web_widget_image_url/odoo/addons/web_widget_image_url b/setup/web_widget_image_url/odoo/addons/web_widget_image_url new file mode 120000 index 000000000000..d2525a200519 --- /dev/null +++ b/setup/web_widget_image_url/odoo/addons/web_widget_image_url @@ -0,0 +1 @@ +../../../../web_widget_image_url \ No newline at end of file diff --git a/setup/web_widget_image_url/setup.cfg b/setup/web_widget_image_url/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/setup/web_widget_image_url/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/setup/web_widget_image_url/setup.py b/setup/web_widget_image_url/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/web_widget_image_url/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/web_widget_url_advanced/odoo/addons/web_widget_url_advanced b/setup/web_widget_url_advanced/odoo/addons/web_widget_url_advanced new file mode 120000 index 000000000000..53c82b305b7f --- /dev/null +++ b/setup/web_widget_url_advanced/odoo/addons/web_widget_url_advanced @@ -0,0 +1 @@ +../../../../web_widget_url_advanced \ No newline at end of file diff --git a/setup/web_widget_url_advanced/setup.cfg b/setup/web_widget_url_advanced/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/setup/web_widget_url_advanced/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/setup/web_widget_url_advanced/setup.py b/setup/web_widget_url_advanced/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/web_widget_url_advanced/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/web_widget_x2many_2d_matrix_example/odoo/addons/web_widget_x2many_2d_matrix_example b/setup/web_widget_x2many_2d_matrix_example/odoo/addons/web_widget_x2many_2d_matrix_example new file mode 120000 index 000000000000..e358520f38bb --- /dev/null +++ b/setup/web_widget_x2many_2d_matrix_example/odoo/addons/web_widget_x2many_2d_matrix_example @@ -0,0 +1 @@ +../../../../web_widget_x2many_2d_matrix_example \ No newline at end of file diff --git a/setup/web_widget_x2many_2d_matrix_example/setup.cfg b/setup/web_widget_x2many_2d_matrix_example/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/setup/web_widget_x2many_2d_matrix_example/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/setup/web_widget_x2many_2d_matrix_example/setup.py b/setup/web_widget_x2many_2d_matrix_example/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/web_widget_x2many_2d_matrix_example/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/web_action_conditionable/i18n/web_action_conditionable.pot b/web_action_conditionable/i18n/web_action_conditionable.pot new file mode 100644 index 000000000000..447d3bb3ca4c --- /dev/null +++ b/web_action_conditionable/i18n/web_action_conditionable.pot @@ -0,0 +1,14 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + diff --git a/web_advanced_search/README.rst b/web_advanced_search/README.rst new file mode 100644 index 000000000000..5c7cdf093ccf --- /dev/null +++ b/web_advanced_search/README.rst @@ -0,0 +1,166 @@ +=============== +Advanced search +=============== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github + :target: https://github.com/OCA/web/tree/11.0/web_advanced_search + :alt: OCA/web +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/web-11-0/web-11-0-web_advanced_search + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/162/11.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +More powerful and easy to use search, especially for related fields. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +To use this module, you need to: + +* Open *Filters* in a search view +* Select any relational field +* Select operator `is equal to` or `is not equal to` +* The text field changes to a relational selection field where you + can search for the record in question +* Click *Apply* + +To search for properties of linked records (ie invoices for customers +with a credit limit higher than X): + +* Open *Filters* in a search view +* Select *Add Advanced Filter* +* Edit the advanced filter +* Click *Save* + +Note that you can stack searching for properties: Simply add another +advanced search in the selection search window. You can do +this indefinetely, so it is possible to search for moves belonging +to a journal which has a user who is member of a certain group etc. + +Known issues / Roadmap +====================== + +Improvements to the ``domain`` widget, not exclusively related to this addon: + +* Use relational widgets when filtering a relational field +* Allow to filter field names + +Improvements to the search view in this addon: + +* Use widgets ``one2many_tags`` when searching ``one2many`` fields +* Use widgets ``many2many_tags`` when searching ``many2many`` fields +* Allow to edit current full search using the advanced domain editor +* Allow to edit individually any facet from current search using the + advanced domain editor +* Beautiful, human-readable, domain representation when adding an + advanced filter + +Changelog +========= + +11.0.1.0.2 (2018-10-31) +~~~~~~~~~~~~~~~~~~~~~~~ + +* Fix initialization of 1st domain node + + Sometime the dialog is not ready yet, like on EE version. + Hence when you inject the 1st domain node + the dialog must be already opened. + + [simahawk] + + +11.0.1.0.1 (2018-09-18) +~~~~~~~~~~~~~~~~~~~~~~~ + +* Fix `undefined` in x2m fields + + Before this patch, when searching with the "equals to" operator in any + x2many field, the searched parameter was always `undefined`. + + The problem was that the underlying field manager implementation was + treating those fields as x2many, while the widget used was the `one2many` + one. + + This patch simply mocks the underlying fake record to make think that + any relational field is always a `one2many`. This sets all pieces in + place and makes the field manager work as expected, and thus you can + search as expected too. + +* Make linter happy + + [Yajo] + + +11.0.1.0.0 (2018-07-20) +~~~~~~~~~~~~~~~~~~~~~~~ + +* Rename, refactor, migrate to v11 + + [Yajo] + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Therp BV +* Tecnativa + +Contributors +~~~~~~~~~~~~ + +* Holger Brunn +* Vicent Cubells +* Jairo Llopis +* Rami Alwafaie +* Jose Mª Bernet +* Simone Orsi + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/web `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/web_advanced_search/__init__.py b/web_advanced_search/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/web_advanced_search/__manifest__.py b/web_advanced_search/__manifest__.py new file mode 100644 index 000000000000..b17b84a2f954 --- /dev/null +++ b/web_advanced_search/__manifest__.py @@ -0,0 +1,27 @@ +# Copyright 2015 Therp BV +# Copyright 2017 Tecnativa - Vicent Cubells +# Copyright 2018 Tecnativa - Jairo Llopis +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Advanced search", + "version": "11.0.1.0.2", + "author": "Therp BV, " + "Tecnativa, " + "Odoo Community Association (OCA)", + "license": "AGPL-3", + "category": "Usability", + "summary": "Easier and more powerful searching tools", + "website": "https://github.com/OCA/web", + "depends": [ + 'web', + ], + "data": [ + 'views/templates.xml', + ], + "qweb": [ + 'static/src/xml/web_advanced_search.xml', + ], + "installable": True, + "application": False, +} diff --git a/web_advanced_search/i18n/da.po b/web_advanced_search/i18n/da.po new file mode 100644 index 000000000000..67a3aae14cbe --- /dev/null +++ b/web_advanced_search/i18n/da.po @@ -0,0 +1,24 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_advanced_search +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2018-09-01 05:03+0000\n" +"Last-Translator: Hans Henrik Gabelgaard \n" +"Language-Team: none\n" +"Language: da\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 3.1.1\n" + +#. module: web_advanced_search +#. openerp-web +#: code:addons/web_advanced_search/static/src/xml/web_advanced_search.xml:9 +#, python-format +msgid "Add Advanced Filter" +msgstr "Tilføj avanceret filter" diff --git a/web_advanced_search/i18n/de.po b/web_advanced_search/i18n/de.po new file mode 100644 index 000000000000..2105b6a720bd --- /dev/null +++ b/web_advanced_search/i18n/de.po @@ -0,0 +1,29 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_advanced_search_x2x +# +# Translators: +# Rudolf Schnapka , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-01-03 03:49+0000\n" +"PO-Revision-Date: 2018-01-03 03:49+0000\n" +"Last-Translator: Rudolf Schnapka , 2018\n" +"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: web_advanced_search +#. openerp-web +#: code:addons/web_advanced_search/static/src/xml/web_advanced_search.xml:9 +#, python-format +msgid "Add Advanced Filter" +msgstr "" + +#~ msgid "is in selection" +#~ msgstr "Ist in Auswahl" diff --git a/web_advanced_search/i18n/es.po b/web_advanced_search/i18n/es.po new file mode 100644 index 000000000000..8ae0ceba5530 --- /dev/null +++ b/web_advanced_search/i18n/es.po @@ -0,0 +1,29 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_advanced_search_x2x +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-01-03 03:49+0000\n" +"PO-Revision-Date: 2018-01-03 03:49+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: web_advanced_search +#. openerp-web +#: code:addons/web_advanced_search/static/src/xml/web_advanced_search.xml:9 +#, python-format +msgid "Add Advanced Filter" +msgstr "" + +#~ msgid "is in selection" +#~ msgstr "está en la selección" diff --git a/web_advanced_search/i18n/fr.po b/web_advanced_search/i18n/fr.po new file mode 100644 index 000000000000..dfdf93384996 --- /dev/null +++ b/web_advanced_search/i18n/fr.po @@ -0,0 +1,29 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_advanced_search_x2x +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-01-03 03:49+0000\n" +"PO-Revision-Date: 2018-01-03 03:49+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#. module: web_advanced_search +#. openerp-web +#: code:addons/web_advanced_search/static/src/xml/web_advanced_search.xml:9 +#, python-format +msgid "Add Advanced Filter" +msgstr "" + +#~ msgid "is in selection" +#~ msgstr "parmi la sélection" diff --git a/web_advanced_search/i18n/hr.po b/web_advanced_search/i18n/hr.po new file mode 100644 index 000000000000..82f429165757 --- /dev/null +++ b/web_advanced_search/i18n/hr.po @@ -0,0 +1,30 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_advanced_search_x2x +# +# Translators: +# Bole , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-01-03 03:49+0000\n" +"PO-Revision-Date: 2018-01-03 03:49+0000\n" +"Last-Translator: Bole , 2017\n" +"Language-Team: Croatian (https://www.transifex.com/oca/teams/23907/hr/)\n" +"Language: hr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" + +#. module: web_advanced_search +#. openerp-web +#: code:addons/web_advanced_search/static/src/xml/web_advanced_search.xml:9 +#, python-format +msgid "Add Advanced Filter" +msgstr "" + +#~ msgid "is in selection" +#~ msgstr "je u odabiru" diff --git a/web_advanced_search/i18n/nl.po b/web_advanced_search/i18n/nl.po new file mode 100644 index 000000000000..cae5e1aa6b69 --- /dev/null +++ b/web_advanced_search/i18n/nl.po @@ -0,0 +1,29 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_advanced_search_x2x +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-01-03 03:49+0000\n" +"PO-Revision-Date: 2018-01-03 03:49+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Dutch (https://www.transifex.com/oca/teams/23907/nl/)\n" +"Language: nl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: web_advanced_search +#. openerp-web +#: code:addons/web_advanced_search/static/src/xml/web_advanced_search.xml:9 +#, python-format +msgid "Add Advanced Filter" +msgstr "" + +#~ msgid "is in selection" +#~ msgstr "is in selectie" diff --git a/web_advanced_search/i18n/nl_NL.po b/web_advanced_search/i18n/nl_NL.po new file mode 100644 index 000000000000..949c83a99090 --- /dev/null +++ b/web_advanced_search/i18n/nl_NL.po @@ -0,0 +1,30 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_advanced_search_x2x +# +# Translators: +# Peter Hageman , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-01-03 03:49+0000\n" +"PO-Revision-Date: 2018-01-03 03:49+0000\n" +"Last-Translator: Peter Hageman , 2017\n" +"Language-Team: Dutch (Netherlands) (https://www.transifex.com/oca/" +"teams/23907/nl_NL/)\n" +"Language: nl_NL\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: web_advanced_search +#. openerp-web +#: code:addons/web_advanced_search/static/src/xml/web_advanced_search.xml:9 +#, python-format +msgid "Add Advanced Filter" +msgstr "" + +#~ msgid "is in selection" +#~ msgstr "Is in selectie" diff --git a/web_advanced_search/i18n/pt_BR.po b/web_advanced_search/i18n/pt_BR.po new file mode 100644 index 000000000000..a2d187ee84c4 --- /dev/null +++ b/web_advanced_search/i18n/pt_BR.po @@ -0,0 +1,31 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_advanced_search_x2x +# +# Translators: +# Rodrigo de Almeida Sottomaior Macedo , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-01-03 03:49+0000\n" +"PO-Revision-Date: 2018-01-03 03:49+0000\n" +"Last-Translator: Rodrigo de Almeida Sottomaior Macedo " +", 2017\n" +"Language-Team: Portuguese (Brazil) (https://www.transifex.com/oca/" +"teams/23907/pt_BR/)\n" +"Language: pt_BR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#. module: web_advanced_search +#. openerp-web +#: code:addons/web_advanced_search/static/src/xml/web_advanced_search.xml:9 +#, python-format +msgid "Add Advanced Filter" +msgstr "" + +#~ msgid "is in selection" +#~ msgstr "Está em seleção" diff --git a/web_advanced_search/i18n/web_advanced_search.pot b/web_advanced_search/i18n/web_advanced_search.pot new file mode 100644 index 000000000000..51844650496f --- /dev/null +++ b/web_advanced_search/i18n/web_advanced_search.pot @@ -0,0 +1,22 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_advanced_search +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: web_advanced_search +#. openerp-web +#: code:addons/web_advanced_search/static/src/xml/web_advanced_search.xml:9 +#, python-format +msgid "Add Advanced Filter" +msgstr "" + diff --git a/web_advanced_search/readme/CONTRIBUTORS.rst b/web_advanced_search/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000000..ed3dc10c4292 --- /dev/null +++ b/web_advanced_search/readme/CONTRIBUTORS.rst @@ -0,0 +1,6 @@ +* Holger Brunn +* Vicent Cubells +* Jairo Llopis +* Rami Alwafaie +* Jose Mª Bernet +* Simone Orsi diff --git a/web_advanced_search/readme/DESCRIPTION.rst b/web_advanced_search/readme/DESCRIPTION.rst new file mode 100644 index 000000000000..bd4c29fdd20b --- /dev/null +++ b/web_advanced_search/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +More powerful and easy to use search, especially for related fields. diff --git a/web_advanced_search/readme/HISTORY.rst b/web_advanced_search/readme/HISTORY.rst new file mode 100644 index 000000000000..7b791ed951d7 --- /dev/null +++ b/web_advanced_search/readme/HISTORY.rst @@ -0,0 +1,40 @@ +11.0.1.0.2 (2018-10-31) +~~~~~~~~~~~~~~~~~~~~~~~ + +* Fix initialization of 1st domain node + + Sometime the dialog is not ready yet, like on EE version. + Hence when you inject the 1st domain node + the dialog must be already opened. + + [simahawk] + + +11.0.1.0.1 (2018-09-18) +~~~~~~~~~~~~~~~~~~~~~~~ + +* Fix `undefined` in x2m fields + + Before this patch, when searching with the "equals to" operator in any + x2many field, the searched parameter was always `undefined`. + + The problem was that the underlying field manager implementation was + treating those fields as x2many, while the widget used was the `one2many` + one. + + This patch simply mocks the underlying fake record to make think that + any relational field is always a `one2many`. This sets all pieces in + place and makes the field manager work as expected, and thus you can + search as expected too. + +* Make linter happy + + [Yajo] + + +11.0.1.0.0 (2018-07-20) +~~~~~~~~~~~~~~~~~~~~~~~ + +* Rename, refactor, migrate to v11 + + [Yajo] diff --git a/web_advanced_search/readme/ROADMAP.rst b/web_advanced_search/readme/ROADMAP.rst new file mode 100644 index 000000000000..122e1efb5055 --- /dev/null +++ b/web_advanced_search/readme/ROADMAP.rst @@ -0,0 +1,14 @@ +Improvements to the ``domain`` widget, not exclusively related to this addon: + +* Use relational widgets when filtering a relational field +* Allow to filter field names + +Improvements to the search view in this addon: + +* Use widgets ``one2many_tags`` when searching ``one2many`` fields +* Use widgets ``many2many_tags`` when searching ``many2many`` fields +* Allow to edit current full search using the advanced domain editor +* Allow to edit individually any facet from current search using the + advanced domain editor +* Beautiful, human-readable, domain representation when adding an + advanced filter diff --git a/web_advanced_search/readme/USAGE.rst b/web_advanced_search/readme/USAGE.rst new file mode 100644 index 000000000000..b8e6f27780d2 --- /dev/null +++ b/web_advanced_search/readme/USAGE.rst @@ -0,0 +1,21 @@ +To use this module, you need to: + +* Open *Filters* in a search view +* Select any relational field +* Select operator `is equal to` or `is not equal to` +* The text field changes to a relational selection field where you + can search for the record in question +* Click *Apply* + +To search for properties of linked records (ie invoices for customers +with a credit limit higher than X): + +* Open *Filters* in a search view +* Select *Add Advanced Filter* +* Edit the advanced filter +* Click *Save* + +Note that you can stack searching for properties: Simply add another +advanced search in the selection search window. You can do +this indefinetely, so it is possible to search for moves belonging +to a journal which has a user who is member of a certain group etc. diff --git a/web_advanced_search/static/description/icon.png b/web_advanced_search/static/description/icon.png new file mode 100644 index 000000000000..1ab5d1e10173 Binary files /dev/null and b/web_advanced_search/static/description/icon.png differ diff --git a/web_advanced_search/static/description/index.html b/web_advanced_search/static/description/index.html new file mode 100644 index 000000000000..847a54b83a74 --- /dev/null +++ b/web_advanced_search/static/description/index.html @@ -0,0 +1,516 @@ + + + + + + +Advanced search + + + + + + diff --git a/web_advanced_search/static/src/css/web_advanced_search.less b/web_advanced_search/static/src/css/web_advanced_search.less new file mode 100644 index 000000000000..796a756f9453 --- /dev/null +++ b/web_advanced_search/static/src/css/web_advanced_search.less @@ -0,0 +1,13 @@ +.o_search_options { + .o_filters_menu { + .o_filter_condition { + max-width: inherit; + + .o_searchview_extended_prop_value { + .o_field_domain { + min-width: 30vw; + } + } + } + } +} diff --git a/web_advanced_search/static/src/js/human_domain.js b/web_advanced_search/static/src/js/human_domain.js new file mode 100644 index 000000000000..82aefc5ce523 --- /dev/null +++ b/web_advanced_search/static/src/js/human_domain.js @@ -0,0 +1,86 @@ +/* Copyright 2018 Tecnativa - Jairo Llopis + * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ + + odoo.define("web_advanced_search.human_domain", function (require) { + "use strict"; + + var DomainSelector = require("web.DomainSelector"); + + var join_mapping = { + "&": _(" and "), + "|": _(" or "), + "!": _(" is not "), + }; + + // HACK I should extend classes, but they are not exposed + // TODO Remove file when merged https://github.com/odoo/odoo/pull/25922 + var human_domain_methods = { + DomainTree: function () { + var human_domains = []; + _.each(this.children, function (child) { + human_domains.push( + human_domain_methods[child.template].apply(child) + ); + }); + return _.str.sprintf( + "(%s)", + human_domains.join(join_mapping[this.operator]) + ); + }, + + DomainSelector: function () { + var result = human_domain_methods.DomainTree.apply(this, arguments); + // Remove surrounding parenthesis + return result.slice(1, -1); + }, + + DomainLeaf: function () { + var chain = [], + operator = this.operator_mapping[this.operator], + value = _.str.sprintf('"%s"', this.value); + // Humanize chain + this.chain.split(".").forEach(function (element, index) { + chain.push( + _.findWhere( + this.fieldSelector.pages[index], + {name: element} + ).string || element + ); + }, this); + // Special beautiness for some values + if (this.operator === "=" && _.isBoolean(this.value)) { + operator = this.operator_mapping[this.value ? "set" : "not set"]; + value = ""; + } else if (_.isArray(this.value)) { + value = _.str.sprintf('["%s"]', this.value.join('", "')); + } + return _.str.sprintf( + "%s %s %s", + chain.join("→"), + operator || this.operator, + value + ).trim(); + }, + }; + + function getHumanDomain (parent, model, domain, options) { + var domain_selector = new DomainSelector( + parent, + model, + domain, + options + ); + var dummy_parent = $("
"); + domain_selector.appendTo(dummy_parent); + var result = human_domain_methods.DomainSelector.apply( + domain_selector + ); + domain_selector.destroy(); + dummy_parent.destroy(); + return result; + } + + return { + getHumanDomain: getHumanDomain, + }; +}); diff --git a/web_advanced_search/static/src/js/web_advanced_search.js b/web_advanced_search/static/src/js/web_advanced_search.js new file mode 100644 index 000000000000..9d16135c5711 --- /dev/null +++ b/web_advanced_search/static/src/js/web_advanced_search.js @@ -0,0 +1,348 @@ +/* Copyright 2015 Therp BV + * Copyright 2017-2018 Jairo Llopis + * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ + +odoo.define("web_advanced_search", function (require) { + "use strict"; + + var core = require("web.core"); + var Domain = require("web.Domain"); + var DomainSelectorDialog = require("web.DomainSelectorDialog"); + var field_registry = require("web.field_registry"); + var FieldManagerMixin = require("web.FieldManagerMixin"); + var FilterMenu = require("web.FilterMenu"); + var human_domain = require("web_advanced_search.human_domain"); + var SearchView = require("web.SearchView"); + var Widget = require("web.Widget"); + var Char = core.search_filters_registry.get("char"); + + SearchView.include({ + custom_events: _.extend({}, SearchView.prototype.custom_events, { + "get_dataset": "_on_get_dataset", + }), + + /** + * Add or update a `dataset` attribute in event target + * + * The search view dataset includes things such as the model, which + * is required to make some parts of search views smarter. + * + * @param {OdooEvent} event The target will get the dataset. + */ + _on_get_dataset: function (event) { + event.target.dataset = this.dataset; + event.stopPropagation(); + }, + }); + + /** + * An almost dummy search proposition, to use with domain widget + */ + var AdvancedSearchProposition = Widget.extend({ + + /** + * @override + */ + init: function (parent, model, domain) { + this._super(parent); + this.model = model; + this.domain = new Domain(domain); + }, + + /** + * Produce a filter descriptor for advanced searches. + * + * @returns {Object} In the format expected by `web.FilterMenu`. + */ + get_filter: function () { + var domain_array = this.domain.toArray(); + return { + attrs: { + domain: domain_array, + // TODO Remove when merged + // https://github.com/odoo/odoo/pull/25922 + string: human_domain.getHumanDomain( + this, + this.model, + domain_array + ), + }, + children: [], + tag: "filter", + }; + }, + }); + + // Add advanced search features + FilterMenu.include({ + custom_events: _.extend({}, FilterMenu.prototype.custom_events, { + "domain_selected": "advanced_search_commit", + }), + + events: _.extend({}, FilterMenu.prototype.events, { + "click .o_add_advanced_search": "advanced_search_open", + }), + + /** + * @override + */ + init: function () { + this._super.apply(this, arguments); + this.trigger_up("get_dataset"); + }, + + /** + * Open advanced search dialog + * + * @returns {$.Deferred} The opening dialog itself. + */ + advanced_search_open: function () { + var domain_selector_dialog = new DomainSelectorDialog( + this, + this.dataset.model, + "[]", + { + debugMode: core.debug, + readonly: false, + } + ); + domain_selector_dialog.opened(function () { + // Add 1st domain node by default + domain_selector_dialog.domainSelector._onAddFirstButtonClick(); + }); + return domain_selector_dialog.open(); + }, + + /** + * Apply advanced search on dialog save + * + * @param {OdooEvent} event A `domain_selected` event from the dialog. + */ + advanced_search_commit: function (event) { + _.invoke(this.propositions, "destroy"); + var proposition = new AdvancedSearchProposition( + this, + this.dataset.model, + event.data.domain + ); + this.propositions = [proposition]; + this.commit_search(); + }, + }); + + /** + * A search field for relational fields. + * + * It implements and extends the `FieldManagerMixin`, and acts as if it + * were a reduced dummy controller. Some actions "mock" the underlying + * model, since sometimes we use a char widget to fill related fields + * (which is not supported by that widget), and fields need an underlying + * model implementation, which can only hold fake data, given a search view + * has no data on it by definition. + */ + var Relational = Char.extend(FieldManagerMixin, { + tagName: "div", + className: "x2x_container", + attributes: {}, + + /** + * @override + */ + init: function () { + this._super.apply(this, arguments); + // To make widgets work, we need a model and an empty record + FieldManagerMixin.init.call(this); + this.trigger_up("get_dataset"); + // Make equal and not equal appear 1st and 2nd + this.operators = _.sortBy( + this.operators, + function (op) { + switch (op.value) { + case "=": + return -2; + case "!=": + return -1; + default: + return 0; + } + }); + // Create dummy record with only the field the user is searching + var params = { + fieldNames: [this.field.name], + modelName: this.dataset.model, + context: this.dataset.context, + fields: {}, + type: "record", + viewType: "default", + fieldsInfo: { + default: {}, + }, + }; + // See https://stackoverflow.com/a/11508530/1468388 + // to know how to include this in the previous step in ES6 + params.fields[this.field.name] = _.omit( + this.field, + // User needs all records, to actually produce a new domain + "domain", + // Onchanges make no sense in this context, there's no record + "onChange" + ); + if (this.field.type.endsWith("2many")) { + // X2many fields behave like m2o in the search context + params.fields[this.field.name].type = "many2one"; + } + params.fieldsInfo.default[this.field.name] = {}; + // Emulate `model.load()`, without RPC-calling `default_get()` + this.datapoint_id = this.model._makeDataPoint(params).id; + this.model.applyDefaultValues( + this.datapoint_id, + {}, + params.fieldNames + ); + // To generate a new fake ID + this._fake_id = -1; + }, + + /** + * @override + */ + start: function () { + var result = this._super.apply(this, arguments); + // Render the initial widget + result.done($.proxy(this, "show_inputs", $(""))); + return result; + }, + + /** + * @override + */ + destroy: function () { + if (this._field_widget) { + this._field_widget.destroy(); + } + this.model.destroy(); + delete this.record; + return this._super.apply(this, arguments); + }, + + /** + * Get record object for current datapoint. + * + * @returns {Object} + */ + _get_record: function () { + return this.model.get(this.datapoint_id); + }, + + /** + * @override + */ + show_inputs: function ($operator) { + // Get widget class to be used + switch ($operator.val()) { + case "=": + case "!=": + this._field_widget_name = "many2one"; + break; + default: + this._field_widget_name = "char"; + } + var _Widget = field_registry.get(this._field_widget_name); + // Destroy previous widget, if any + if (this._field_widget) { + this._field_widget.destroy(); + delete this._field_widget; + } + // Create new widget + var options = { + mode: "edit", + attrs: { + options: { + no_create_edit: true, + no_create: true, + no_open: true, + no_quick_create: true, + }, + }, + }; + this._field_widget = new _Widget( + this, + this.field.name, + this._get_record(), + options + ); + this._field_widget.appendTo(this.$el); + return this._super.apply(this, arguments); + }, + + /** + * @override + */ + _applyChanges: function (dataPointID, changes, event) { + // Make char updates look like valid x2one updates + if (_.isNaN(changes[this.field.name].id)) { + changes[this.field.name] = { + id: this._fake_id--, + display_name: event.target.lastSetValue, + }; + } + return FieldManagerMixin._applyChanges.apply(this, arguments); + }, + + /** + * @override + */ + _confirmChange: function (id, fields, event) { + this.datapoint_id = id; + return this._field_widget.reset(this._get_record(), event); + }, + + /** + * @override + */ + get_value: function () { + try { + switch (this._field_widget_name) { + case "many2one": + return this._field_widget.value.res_id; + default: + return this._field_widget.value.data.display_name; + } + } catch (error) { + if (error.name === "TypeError") { + return false; + } + } + }, + + /** + * Extract the field's value in a human-readable format. + * + * @override + */ + toString: function () { + try { + switch (this._field_widget_name) { + case "many2one": + return this._field_widget.value.data.display_name; + } + return this._super.apply(this, arguments); + } catch (error) { + if (error.name === "TypeError") { + return ""; + } + } + }, + }); + + // Register search filter widgets + core.search_filters_registry + .add("many2many", Relational) + .add("many2one", Relational) + .add("one2many", Relational); + + return { + AdvancedSearchProposition: AdvancedSearchProposition, + Relational: Relational, + }; +}); diff --git a/web_advanced_search/static/src/xml/web_advanced_search.xml b/web_advanced_search/static/src/xml/web_advanced_search.xml new file mode 100644 index 000000000000..ed4e0bbc03fa --- /dev/null +++ b/web_advanced_search/static/src/xml/web_advanced_search.xml @@ -0,0 +1,13 @@ + + + + + +
  • +
  • + Add Advanced Filter +
  • +
    +
    +
    diff --git a/web_advanced_search/views/templates.xml b/web_advanced_search/views/templates.xml new file mode 100644 index 000000000000..9409c0e73f82 --- /dev/null +++ b/web_advanced_search/views/templates.xml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/web_editor_background_color/README.rst b/web_editor_background_color/README.rst new file mode 100644 index 000000000000..7a6ffd78de60 --- /dev/null +++ b/web_editor_background_color/README.rst @@ -0,0 +1,98 @@ +================================== +Web Editor Background Color Picker +================================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github + :target: https://github.com/OCA/web/tree/11.0/web_editor_background_color + :alt: OCA/web +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/web-11-0/web-11-0-web_editor_background_color + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/162/11.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module extends the functionality of the web editor to support +setting a custom background color to any snippet allowing you to customize it. + +.. figure:: https://user-images.githubusercontent.com/973709/46802401-1c915180-cd55-11e8-9397-f198548a690c.gif + :alt: Screenshot of color picker in mass mailing editor + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +To use this module, you need to: + +#. Install any module that makes use of the web editor, such as + ``mass_mailing`` or ``website``. +#. Use that module's facilities to edit some web content. +#. Drag & drop any snippet into the web editor body. +#. Click on *Customize > Text-Image > Background Color > icon*. +#. Choose a custom color by either: + * Writing any valid HTML color code in the text input. + * Selecting a color from the color picker. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Tecnativa + +Contributors +~~~~~~~~~~~~ + +* Jairo Llopis - https://www.tecnativa.com + +Other credits +~~~~~~~~~~~~~ + +* This addon includes code copied from bootstrap-colorpicker_ + +.. _bootstrap-colorpicker: https://github.com/itsjavi/bootstrap-colorpicker/tree/2.5.3 + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/web `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/web_editor_background_color/__init__.py b/web_editor_background_color/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/web_editor_background_color/__manifest__.py b/web_editor_background_color/__manifest__.py new file mode 100644 index 000000000000..29fda211c3ca --- /dev/null +++ b/web_editor_background_color/__manifest__.py @@ -0,0 +1,22 @@ +# Copyright 2017 Jairo Llopis +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). +{ + "name": "Web Editor Background Color Picker", + "summary": "Set any background color for web editor snippets", + "version": "11.0.1.0.0", + "category": "Website", + "website": "https://www.tecnativa.com", + "author": "Tecnativa, Odoo Community Association (OCA)", + "license": "LGPL-3", + "application": False, + "installable": True, + "images": [ + "static/description/mass_mailing_editor.png", + ], + "depends": [ + "web_editor", + ], + "data": [ + "templates/assets.xml", + ], +} diff --git a/web_editor_background_color/i18n/ca.po b/web_editor_background_color/i18n/ca.po new file mode 100644 index 000000000000..5e97c5832a08 --- /dev/null +++ b/web_editor_background_color/i18n/ca.po @@ -0,0 +1,22 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_editor_background_color +# +# Translators: +# Marc Tormo i Bochaca , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-03-30 08:28+0000\n" +"PO-Revision-Date: 2017-03-30 08:28+0000\n" +"Last-Translator: Marc Tormo i Bochaca , 2017\n" +"Language-Team: Catalan (https://www.transifex.com/oca/teams/23907/ca/)\n" +"Language: ca\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#~ msgid "Color" +#~ msgstr "Color" diff --git a/web_editor_background_color/i18n/es.po b/web_editor_background_color/i18n/es.po new file mode 100644 index 000000000000..bab232fcbfaf --- /dev/null +++ b/web_editor_background_color/i18n/es.po @@ -0,0 +1,21 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * website_mail_snippet_bg_color +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-02-09 16:32+0000\n" +"PO-Revision-Date: 2016-02-09 17:33+0100\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: \n" +"X-Generator: Poedit 1.8.6\n" + +#~ msgid "Pick Background Color" +#~ msgstr "Escoger el color de fondo" diff --git a/web_editor_background_color/i18n/fr.po b/web_editor_background_color/i18n/fr.po new file mode 100644 index 000000000000..0a3d95a3f466 --- /dev/null +++ b/web_editor_background_color/i18n/fr.po @@ -0,0 +1,23 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * website_mail_snippet_bg_color +# +# Translators: +# Christophe CHAUVET , 2016 +msgid "" +msgstr "" +"Project-Id-Version: social (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-06-30 01:07+0000\n" +"PO-Revision-Date: 2016-06-17 14:52+0000\n" +"Last-Translator: Christophe CHAUVET \n" +"Language-Team: French (http://www.transifex.com/oca/OCA-social-8-0/language/" +"fr/)\n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#~ msgid "Pick Background Color" +#~ msgstr "Mettre la couleur de fond" diff --git a/web_editor_background_color/i18n/sl.po b/web_editor_background_color/i18n/sl.po new file mode 100644 index 000000000000..a06a2d19a0f1 --- /dev/null +++ b/web_editor_background_color/i18n/sl.po @@ -0,0 +1,24 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * website_mail_snippet_bg_color +# +# Translators: +# Matjaž Mozetič , 2016 +msgid "" +msgstr "" +"Project-Id-Version: social (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-02-27 01:40+0000\n" +"PO-Revision-Date: 2016-02-27 16:56+0000\n" +"Last-Translator: Matjaž Mozetič \n" +"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-social-8-0/" +"language/sl/)\n" +"Language: sl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n" +"%100==4 ? 2 : 3);\n" + +#~ msgid "Pick Background Color" +#~ msgstr "Izbira barve ozadja" diff --git a/web_editor_background_color/i18n/web_editor_background_color.pot b/web_editor_background_color/i18n/web_editor_background_color.pot new file mode 100644 index 000000000000..447d3bb3ca4c --- /dev/null +++ b/web_editor_background_color/i18n/web_editor_background_color.pot @@ -0,0 +1,14 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + diff --git a/web_editor_background_color/readme/CONTRIBUTORS.rst b/web_editor_background_color/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000000..bf93c78d350a --- /dev/null +++ b/web_editor_background_color/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Jairo Llopis - https://www.tecnativa.com diff --git a/web_editor_background_color/readme/CREDITS.rst b/web_editor_background_color/readme/CREDITS.rst new file mode 100644 index 000000000000..7c81b130e67c --- /dev/null +++ b/web_editor_background_color/readme/CREDITS.rst @@ -0,0 +1,3 @@ +* This addon includes code copied from bootstrap-colorpicker_ + +.. _bootstrap-colorpicker: https://github.com/itsjavi/bootstrap-colorpicker/tree/2.5.3 diff --git a/web_editor_background_color/readme/DESCRIPTION.rst b/web_editor_background_color/readme/DESCRIPTION.rst new file mode 100644 index 000000000000..76576d159934 --- /dev/null +++ b/web_editor_background_color/readme/DESCRIPTION.rst @@ -0,0 +1,5 @@ +This module extends the functionality of the web editor to support +setting a custom background color to any snippet allowing you to customize it. + +.. figure:: https://user-images.githubusercontent.com/973709/46802401-1c915180-cd55-11e8-9397-f198548a690c.gif + :alt: Screenshot of color picker in mass mailing editor diff --git a/web_editor_background_color/readme/USAGE.rst b/web_editor_background_color/readme/USAGE.rst new file mode 100644 index 000000000000..6046c99f148d --- /dev/null +++ b/web_editor_background_color/readme/USAGE.rst @@ -0,0 +1,10 @@ +To use this module, you need to: + +#. Install any module that makes use of the web editor, such as + ``mass_mailing`` or ``website``. +#. Use that module's facilities to edit some web content. +#. Drag & drop any snippet into the web editor body. +#. Click on *Customize > Text-Image > Background Color > icon*. +#. Choose a custom color by either: + * Writing any valid HTML color code in the text input. + * Selecting a color from the color picker. diff --git a/web_editor_background_color/static/description/icon.png b/web_editor_background_color/static/description/icon.png new file mode 100644 index 000000000000..794e8ef53be2 Binary files /dev/null and b/web_editor_background_color/static/description/icon.png differ diff --git a/web_editor_background_color/static/description/index.html b/web_editor_background_color/static/description/index.html new file mode 100644 index 000000000000..d8bc819f7318 --- /dev/null +++ b/web_editor_background_color/static/description/index.html @@ -0,0 +1,445 @@ + + + + + + +Web Editor Background Color Picker + + + +
    +

    Web Editor Background Color Picker

    + + +

    Beta License: LGPL-3 OCA/web Translate me on Weblate Try me on Runbot

    +

    This module extends the functionality of the web editor to support +setting a custom background color to any snippet allowing you to customize it.

    +
    +Screenshot of color picker in mass mailing editor +
    +

    Table of contents

    + +
    +

    Usage

    +

    To use this module, you need to:

    +
      +
    1. Install any module that makes use of the web editor, such as +mass_mailing or website.
    2. +
    3. Use that module’s facilities to edit some web content.
    4. +
    5. Drag & drop any snippet into the web editor body.
    6. +
    7. Click on Customize > Text-Image > Background Color > </> icon.
    8. +
    9. Choose a custom color by either: +* Writing any valid HTML color code in the text input. +* Selecting a color from the color picker.
    10. +
    +
    +
    +

    Bug Tracker

    +

    Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

    +

    Do not contact contributors directly about support or help with technical issues.

    +
    +
    +

    Credits

    +
    +

    Authors

    +
      +
    • Tecnativa
    • +
    +
    + +
    +

    Other credits

    + +
    +
    +

    Maintainers

    +

    This module is maintained by the OCA.

    +Odoo Community Association +

    OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

    +

    This module is part of the OCA/web project on GitHub.

    +

    You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

    +
    +
    +
    + + diff --git a/web_editor_background_color/static/src/css/background_color.less b/web_editor_background_color/static/src/css/background_color.less new file mode 100644 index 000000000000..52680a2ddd2e --- /dev/null +++ b/web_editor_background_color/static/src/css/background_color.less @@ -0,0 +1,21 @@ +/* Copyright 2017 Jairo Llopis + * License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). */ + +.colorpicker-element { + @colorpicker-width: 170px; + @colorpicker-height: 118px; + + .colorpicker-inline { + min-width: initial; + display: block; + margin-top: 3px !important; + } + .colorpicker-saturation { + width: @colorpicker-height; + height: @colorpicker-height; + } + .colorpicker-hue, .colorpicker-alpha { + width: (@colorpicker-width - @colorpicker-height) / 2; + height: @colorpicker-height; + } +} diff --git a/web_editor_background_color/static/src/js/background_color.js b/web_editor_background_color/static/src/js/background_color.js new file mode 100644 index 000000000000..8b33cc64ccb0 --- /dev/null +++ b/web_editor_background_color/static/src/js/background_color.js @@ -0,0 +1,103 @@ +/* Copyright 2016-2017 Jairo Llopis + * License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). */ + +odoo.define("web_editor_background_color.colorpicker", function (require) { + "use strict"; + var options = require("web_editor.snippets.options"); + var colorpicker = options.registry.colorpicker; + + colorpicker.include({ + events: _.extend({}, colorpicker.prototype.events, { + "changeColor [data-name=custom_color]": + "set_inline_background_color", + // Remove inline background-color for normal class-based buttons + "click .o_colorpicker_section button[data-color]": + "remove_inline_background_color", + "click [data-name=custom_color] input": "input_select", + "click [data-name=custom_color]": "custom_abort_event", + "keydown [data-name=custom_color]": "custom_abort_event", + "keypress [data-name=custom_color]": "custom_abort_event", + "keyup [data-name=custom_color]": "custom_abort_event", + }), + xmlDependencies: colorpicker.prototype.xmlDependencies.concat([ + "/web_editor_background_color/static/src/xml/colorpicker.xml", + ]), + + /** + * @override + */ + start: function () { + this._super(); + // Enable custom color picker + this.$custom = this.$el.find('[data-name="custom_color"]'); + this.$custom.colorpicker({ + color: this.$target.css("background-color"), + container: true, + inline: true, + sliders: { + saturation: { + maxLeft: 118, + maxTop: 118, + }, + hue: { + maxTop: 118, + }, + alpha: { + maxTop: 118, + }, + }, + }); + // Activate border color changes if it matches background's + var style = this.$target.prop("style"); + this.change_border = + style["border-color"] && + style["background-color"] === style["border-color"]; + }, + + /** + * A HACK to avoid dropdown disappearing when picking colors + * + * @param {Event} event + */ + custom_abort_event: function (event) { + event.stopPropagation(); + }, + + /** + * Select the color picker input + * + * @param {Event} event + */ + input_select: function (event) { + $(event.target).focus().select(); + }, + + /** + * Undo the inline background color, besides upstream color classes + * + * @override + */ + _onColorResetButtonClick: function (event) { + this._super.apply(this, arguments); + this.$target.css("background-color", ""); + if (this.change_border) { + this.$target.css("border-color", ""); + } + this.$target.trigger("background-color-event", event.type); + }, + + /** + * Apply the chosen color as an inline style + * + * @param {Event} event + */ + set_inline_background_color: function (event) { + var color = String(event.color); + this.$target.css("background-color", color); + if (this.change_border) { + this.$target.css("border-color", color); + } + this.$target.trigger("background-color-event", event.type); + }, + }); +}); diff --git a/web_editor_background_color/static/src/lib/bootstrap-colorpicker/bootstrap-colorpicker.css b/web_editor_background_color/static/src/lib/bootstrap-colorpicker/bootstrap-colorpicker.css new file mode 100644 index 000000000000..359676d5ead4 --- /dev/null +++ b/web_editor_background_color/static/src/lib/bootstrap-colorpicker/bootstrap-colorpicker.css @@ -0,0 +1,230 @@ +/*! + * Bootstrap Colorpicker v2.5.2 + * https://itsjavi.com/bootstrap-colorpicker/ + * + * Originally written by (c) 2012 Stefan Petre + * Licensed under the Apache License v2.0 + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + */ +.colorpicker-saturation { + width: 100px; + height: 100px; + background-image: url("data:image/png;base64,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"); + cursor: crosshair; + float: left; +} +.colorpicker-saturation i { + display: block; + height: 5px; + width: 5px; + border: 1px solid #000; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; + position: absolute; + top: 0; + left: 0; + margin: -4px 0 0 -4px; +} +.colorpicker-saturation i b { + display: block; + height: 5px; + width: 5px; + border: 1px solid #fff; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; +} +.colorpicker-hue, +.colorpicker-alpha { + width: 15px; + height: 100px; + float: left; + cursor: row-resize; + margin-left: 4px; + margin-bottom: 4px; +} +.colorpicker-hue i, +.colorpicker-alpha i { + display: block; + height: 1px; + background: #000; + border-top: 1px solid #fff; + position: absolute; + top: 0; + left: 0; + width: 100%; + margin-top: -1px; +} +.colorpicker-hue { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAABkCAMAAABw8qpSAAABLFBMVEXqFBb/ABH/ACL/ADH/AEH/AFD/AGD/AG7/AH7/AI3/AJ3/AKz/ALz/AMr/ANv/AOr/APr2AP/mAP/XAP/HAP+4AP+oAP+aAP+JAP97AP9rAP9cAP9MAP8+AP8tAP8fAP8PAP8BAv8AEP8AH/8AL/8APv8ATv8AXP8Abf8Ae/8Ai/8Amv8Aqv8AuP8Ayf8A1/8A5/8A9/8A//gA/+kA/9kA/8oA/7oA/6wA/5sA/40A/30A/24A/14A/1AA/z8A/zEA/yEA/xEB/wMN/wAd/wAs/wA8/wBK/wBb/wBp/wB5/wCI/wCY/wCm/wC3/wDF/wDV/wDk/wD1/wD/+gD/7AD/3AD/zAD/vgD/rQD/nwD/jgD/gAD/cAD/YgD/UQD/QwD/MgD/JAD/FAD4Eg42qAedAAAAh0lEQVR4XgXAg3EDAAAAwI9to7Zt27a1/w49BASFhEVExcQlJKWkZWTl5BUUlZRVVNXUNTS1tHXo1KVbj159+g0YNGTYiFFjxk2YNGXajFlz5i1YtGTZilVr1m3YtGXbjl179h04dOTYiVNnzl24dOXajVt37j149OTZi1dv3n349OXbj19//wOxE1dQ8reGAAAAAElFTkSuQmCC"); +} +.colorpicker-alpha { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAABkCAQAAAAVxWkcAAABr0lEQVR4Xo2VwU0DQQxF7dmRuNIFlzlSAR3QAaXQQdIBJVABFXDcOVAAd67cjJLR07dkhcSrkZKfb/t7bG88rFo3B5gZPMNycItu2xloGV7MWHzM9zuzFWCkmA0nK6AszCUJDW6+mG6R03ncw5v8EMTEvZ2O3AliYjpslblc0RF9LmZYWxURU6aKytWZYsoWCAe+xwOZp1GsEukGiIkYxcQCHck99+gRgB7JncyIB5SGEhP3Yh5P6JwX+u6AnYot104d8DJT7uH7M9JH6OZbimj0vfMVaYnJIZFJDBW9kHlerL2C6JV4mSt7uuo2N57RxnZ+usQjn0R1jwBJBrNO3evJpVYUWsJ/E3UiXRlv24/7YZ04xmEdWlzcKS+B/eapeyMvFd2k0+hRk/T0AmTW8h69s2sjYMsdPntECiILhAeIMZAeH4QvUwfn6ijC0tTV+fT9ky8jM9nK2g7Ly1VjSpKYq6IvsAm7MtNu1orEqa/K3KNvgMFdhfquPfJmp2dbh0/8Gzb6Y22ViaNr6n5410zXdngVhbu6XqdOtWOuin5hjABGp4a2uotZ71MVCfwDBt2/v37yo6AAAAAASUVORK5CYII="); + display: none; +} +.colorpicker-saturation, +.colorpicker-hue, +.colorpicker-alpha { + background-size: contain; +} +.colorpicker { + padding: 4px; + min-width: 130px; + margin-top: 1px; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + z-index: 2500; +} +.colorpicker:before, +.colorpicker:after { + display: table; + content: ""; + line-height: 0; +} +.colorpicker:after { + clear: both; +} +.colorpicker:before { + content: ''; + display: inline-block; + border-left: 7px solid transparent; + border-right: 7px solid transparent; + border-bottom: 7px solid #ccc; + border-bottom-color: rgba(0, 0, 0, 0.2); + position: absolute; + top: -7px; + left: 6px; +} +.colorpicker:after { + content: ''; + display: inline-block; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-bottom: 6px solid #ffffff; + position: absolute; + top: -6px; + left: 7px; +} +.colorpicker div { + position: relative; +} +.colorpicker.colorpicker-with-alpha { + min-width: 140px; +} +.colorpicker.colorpicker-with-alpha .colorpicker-alpha { + display: block; +} +.colorpicker-color { + height: 10px; + margin-top: 5px; + clear: both; + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAABkCAQAAAAVxWkcAAABr0lEQVR4Xo2VwU0DQQxF7dmRuNIFlzlSAR3QAaXQQdIBJVABFXDcOVAAd67cjJLR07dkhcSrkZKfb/t7bG88rFo3B5gZPMNycItu2xloGV7MWHzM9zuzFWCkmA0nK6AszCUJDW6+mG6R03ncw5v8EMTEvZ2O3AliYjpslblc0RF9LmZYWxURU6aKytWZYsoWCAe+xwOZp1GsEukGiIkYxcQCHck99+gRgB7JncyIB5SGEhP3Yh5P6JwX+u6AnYot104d8DJT7uH7M9JH6OZbimj0vfMVaYnJIZFJDBW9kHlerL2C6JV4mSt7uuo2N57RxnZ+usQjn0R1jwBJBrNO3evJpVYUWsJ/E3UiXRlv24/7YZ04xmEdWlzcKS+B/eapeyMvFd2k0+hRk/T0AmTW8h69s2sjYMsdPntECiILhAeIMZAeH4QvUwfn6ijC0tTV+fT9ky8jM9nK2g7Ly1VjSpKYq6IvsAm7MtNu1orEqa/K3KNvgMFdhfquPfJmp2dbh0/8Gzb6Y22ViaNr6n5410zXdngVhbu6XqdOtWOuin5hjABGp4a2uotZ71MVCfwDBt2/v37yo6AAAAAASUVORK5CYII="); + background-position: 0 100%; +} +.colorpicker-color div { + height: 10px; +} +.colorpicker-selectors { + display: none; + height: 10px; + margin-top: 5px; + clear: both; +} +.colorpicker-selectors i { + cursor: pointer; + float: left; + height: 10px; + width: 10px; +} +.colorpicker-selectors i + i { + margin-left: 3px; +} +.colorpicker-element .input-group-addon i, +.colorpicker-element .add-on i { + display: inline-block; + cursor: pointer; + height: 16px; + vertical-align: text-top; + width: 16px; +} +.colorpicker.colorpicker-inline { + position: relative; + display: inline-block; + float: none; + z-index: auto; +} +.colorpicker.colorpicker-horizontal { + width: 110px; + min-width: 110px; + height: auto; +} +.colorpicker.colorpicker-horizontal .colorpicker-saturation { + margin-bottom: 4px; +} +.colorpicker.colorpicker-horizontal .colorpicker-color { + width: 100px; +} +.colorpicker.colorpicker-horizontal .colorpicker-hue, +.colorpicker.colorpicker-horizontal .colorpicker-alpha { + width: 100px; + height: 15px; + float: left; + cursor: col-resize; + margin-left: 0px; + margin-bottom: 4px; +} +.colorpicker.colorpicker-horizontal .colorpicker-hue i, +.colorpicker.colorpicker-horizontal .colorpicker-alpha i { + display: block; + height: 15px; + background: #ffffff; + position: absolute; + top: 0; + left: 0; + width: 1px; + border: none; + margin-top: 0px; +} +.colorpicker.colorpicker-horizontal .colorpicker-hue { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAABCAMAAAAfBfuPAAABLFBMVEXqFBb/ABH/ACL/ADH/AEH/AFD/AGD/AG7/AH7/AI3/AJ3/AKz/ALz/AMr/ANv/AOr/APr2AP/mAP/XAP/HAP+4AP+oAP+aAP+JAP97AP9rAP9cAP9MAP8+AP8tAP8fAP8PAP8BAv8AEP8AH/8AL/8APv8ATv8AXP8Abf8Ae/8Ai/8Amv8Aqv8AuP8Ayf8A1/8A5/8A9/8A//gA/+kA/9kA/8oA/7oA/6wA/5sA/40A/30A/24A/14A/1AA/z8A/zEA/yEA/xEB/wMN/wAd/wAs/wA8/wBK/wBb/wBp/wB5/wCI/wCY/wCm/wC3/wDF/wDV/wDk/wD1/wD/+gD/7AD/3AD/zAD/vgD/rQD/nwD/jgD/gAD/cAD/YgD/UQD/QwD/MgD/JAD/FAD4Eg42qAedAAAAbUlEQVR4XgXAghEDsbxtlrZt27ax/w49ACAYQTGcICmaYTleECVZUTXdMC1Wm93hdLk9Xp8/EAyFI9FYPJFMpTPZXL5QLJUr1Vq90Wy1O91efzAcjSfT2XyxXK03293+cDydL9fb/fF8vT/f3x+LfRNXARMbCAAAAABJRU5ErkJggg=="); +} +.colorpicker.colorpicker-horizontal .colorpicker-alpha { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAAKCAQAAADoFTP1AAAB9ElEQVR4XoWTQW4VMRBEu9qWEimL7DhEMp8NF+ASnJJLcAQgE1bcgBUSkYKUuHCrZ9pjeqSU5Yn9LPu7umJQBIIv+k7vIOrtK66L4lmr3pVOrOv3otp619KZ0/KjdNI79L52Uo09FBQWrU0vfe5trezU+hLsoUKd3Repovte+0vbq/7Lj5XbaHECKasR9G4MPlbp+gzZxd6koPEJCkAYC5SjcOTAIIOK90Dja1IfIZ8Z+zAY9jm3b5Ia+MT5sFcqRJrR2AYYA8Kua5BzYRrFPNmD4PQMegGJMOffJJUsWiI3nCHZZjInNdffLWOufzbc3JaboCAVxwmnRHbhLSPwRJ4wU0BRSc6HkECYYVw95nMKgJOcylxrJttE5Ibzf9Xq9GPvP+WX3MiV/MGHfRu/SentRQrfG1GzsIrytdNXucSRKxQNIGHM9YhGFQJcdjNcBZvfJayuYe4Sia1CzwW+19mWOhe37HsxJWKwbu/jluEU15QzAQjAqCEbhMJc78GYV2E0kooHDubUImWkTOhGpgv8PoT8DJG/bzxna4BZ0eOFSOaLADGeSpFsg5AzeaDZIDQQXjZ4y/8ryfzUXBwdELRjTjCNvOeT0rNlrJz90vwy6N9pXXQEluX0inElpPWokSdiLCfiNJJjMKQ8Qsh8GEKQKMo/eiHrNbI9UksAAAAASUVORK5CYII="); +} +.colorpicker-right:before { + left: auto; + right: 6px; +} +.colorpicker-right:after { + left: auto; + right: 7px; +} +.colorpicker-no-arrow:before { + border-right: 0; + border-left: 0; +} +.colorpicker-no-arrow:after { + border-right: 0; + border-left: 0; +} +.colorpicker.colorpicker-visible, +.colorpicker-alpha.colorpicker-visible, +.colorpicker-saturation.colorpicker-visible, +.colorpicker-hue.colorpicker-visible, +.colorpicker-selectors.colorpicker-visible { + display: block; +} +.colorpicker.colorpicker-hidden, +.colorpicker-alpha.colorpicker-hidden, +.colorpicker-saturation.colorpicker-hidden, +.colorpicker-hue.colorpicker-hidden, +.colorpicker-selectors.colorpicker-hidden { + display: none; +} +.colorpicker-inline.colorpicker-visible { + display: inline-block; +} +/*# sourceMappingURL=bootstrap-colorpicker.css.map */ \ No newline at end of file diff --git a/web_editor_background_color/static/src/lib/bootstrap-colorpicker/bootstrap-colorpicker.js b/web_editor_background_color/static/src/lib/bootstrap-colorpicker/bootstrap-colorpicker.js new file mode 100644 index 000000000000..ac22ed526c62 --- /dev/null +++ b/web_editor_background_color/static/src/lib/bootstrap-colorpicker/bootstrap-colorpicker.js @@ -0,0 +1,1327 @@ +/*! + * Bootstrap Colorpicker v2.5.2 + * https://itsjavi.com/bootstrap-colorpicker/ + * + * Originally written by (c) 2012 Stefan Petre + * Licensed under the Apache License v2.0 + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module unless amdModuleId is set + define(["jquery"], function(jq) { + return (factory(jq)); + }); + } else if (typeof exports === 'object') { + // Node. Does not work with strict CommonJS, but + // only CommonJS-like environments that support module.exports, + // like Node. + module.exports = factory(require("jquery")); + } else if (jQuery && !jQuery.fn.colorpicker) { + factory(jQuery); + } +}(this, function($) { + 'use strict'; + /** + * Color manipulation helper class + * + * @param {Object|String} [val] + * @param {Object} [predefinedColors] + * @param {String|null} [fallbackColor] + * @param {String|null} [fallbackFormat] + * @param {Boolean} [hexNumberSignPrefix] + * @constructor + */ + var Color = function( + val, predefinedColors, fallbackColor, fallbackFormat, hexNumberSignPrefix) { + this.fallbackValue = fallbackColor ? + ( + (typeof fallbackColor === 'string') ? + this.parse(fallbackColor) : + fallbackColor + ) : + null; + + this.fallbackFormat = fallbackFormat ? fallbackFormat : 'rgba'; + + this.hexNumberSignPrefix = hexNumberSignPrefix === true; + + this.value = this.fallbackValue; + + this.origFormat = null; // original string format + + this.predefinedColors = predefinedColors ? predefinedColors : {}; + + // We don't want to share aliases across instances so we extend new object + this.colors = $.extend({}, Color.webColors, this.predefinedColors); + + if (val) { + if (typeof val.h !== 'undefined') { + this.value = val; + } else { + this.setColor(String(val)); + } + } + + if (!this.value) { + // Initial value is always black if no arguments are passed or val is empty + this.value = { + h: 0, + s: 0, + b: 0, + a: 1 + }; + } + }; + + Color.webColors = { // 140 predefined colors from the HTML Colors spec + "aliceblue": "f0f8ff", + "antiquewhite": "faebd7", + "aqua": "00ffff", + "aquamarine": "7fffd4", + "azure": "f0ffff", + "beige": "f5f5dc", + "bisque": "ffe4c4", + "black": "000000", + "blanchedalmond": "ffebcd", + "blue": "0000ff", + "blueviolet": "8a2be2", + "brown": "a52a2a", + "burlywood": "deb887", + "cadetblue": "5f9ea0", + "chartreuse": "7fff00", + "chocolate": "d2691e", + "coral": "ff7f50", + "cornflowerblue": "6495ed", + "cornsilk": "fff8dc", + "crimson": "dc143c", + "cyan": "00ffff", + "darkblue": "00008b", + "darkcyan": "008b8b", + "darkgoldenrod": "b8860b", + "darkgray": "a9a9a9", + "darkgreen": "006400", + "darkkhaki": "bdb76b", + "darkmagenta": "8b008b", + "darkolivegreen": "556b2f", + "darkorange": "ff8c00", + "darkorchid": "9932cc", + "darkred": "8b0000", + "darksalmon": "e9967a", + "darkseagreen": "8fbc8f", + "darkslateblue": "483d8b", + "darkslategray": "2f4f4f", + "darkturquoise": "00ced1", + "darkviolet": "9400d3", + "deeppink": "ff1493", + "deepskyblue": "00bfff", + "dimgray": "696969", + "dodgerblue": "1e90ff", + "firebrick": "b22222", + "floralwhite": "fffaf0", + "forestgreen": "228b22", + "fuchsia": "ff00ff", + "gainsboro": "dcdcdc", + "ghostwhite": "f8f8ff", + "gold": "ffd700", + "goldenrod": "daa520", + "gray": "808080", + "green": "008000", + "greenyellow": "adff2f", + "honeydew": "f0fff0", + "hotpink": "ff69b4", + "indianred": "cd5c5c", + "indigo": "4b0082", + "ivory": "fffff0", + "khaki": "f0e68c", + "lavender": "e6e6fa", + "lavenderblush": "fff0f5", + "lawngreen": "7cfc00", + "lemonchiffon": "fffacd", + "lightblue": "add8e6", + "lightcoral": "f08080", + "lightcyan": "e0ffff", + "lightgoldenrodyellow": "fafad2", + "lightgrey": "d3d3d3", + "lightgreen": "90ee90", + "lightpink": "ffb6c1", + "lightsalmon": "ffa07a", + "lightseagreen": "20b2aa", + "lightskyblue": "87cefa", + "lightslategray": "778899", + "lightsteelblue": "b0c4de", + "lightyellow": "ffffe0", + "lime": "00ff00", + "limegreen": "32cd32", + "linen": "faf0e6", + "magenta": "ff00ff", + "maroon": "800000", + "mediumaquamarine": "66cdaa", + "mediumblue": "0000cd", + "mediumorchid": "ba55d3", + "mediumpurple": "9370d8", + "mediumseagreen": "3cb371", + "mediumslateblue": "7b68ee", + "mediumspringgreen": "00fa9a", + "mediumturquoise": "48d1cc", + "mediumvioletred": "c71585", + "midnightblue": "191970", + "mintcream": "f5fffa", + "mistyrose": "ffe4e1", + "moccasin": "ffe4b5", + "navajowhite": "ffdead", + "navy": "000080", + "oldlace": "fdf5e6", + "olive": "808000", + "olivedrab": "6b8e23", + "orange": "ffa500", + "orangered": "ff4500", + "orchid": "da70d6", + "palegoldenrod": "eee8aa", + "palegreen": "98fb98", + "paleturquoise": "afeeee", + "palevioletred": "d87093", + "papayawhip": "ffefd5", + "peachpuff": "ffdab9", + "peru": "cd853f", + "pink": "ffc0cb", + "plum": "dda0dd", + "powderblue": "b0e0e6", + "purple": "800080", + "red": "ff0000", + "rosybrown": "bc8f8f", + "royalblue": "4169e1", + "saddlebrown": "8b4513", + "salmon": "fa8072", + "sandybrown": "f4a460", + "seagreen": "2e8b57", + "seashell": "fff5ee", + "sienna": "a0522d", + "silver": "c0c0c0", + "skyblue": "87ceeb", + "slateblue": "6a5acd", + "slategray": "708090", + "snow": "fffafa", + "springgreen": "00ff7f", + "steelblue": "4682b4", + "tan": "d2b48c", + "teal": "008080", + "thistle": "d8bfd8", + "tomato": "ff6347", + "turquoise": "40e0d0", + "violet": "ee82ee", + "wheat": "f5deb3", + "white": "ffffff", + "whitesmoke": "f5f5f5", + "yellow": "ffff00", + "yellowgreen": "9acd32", + "transparent": "transparent" + }; + + Color.prototype = { + constructor: Color, + colors: {}, // merged web and predefined colors + predefinedColors: {}, + /** + * @return {Object} + */ + getValue: function() { + return this.value; + }, + /** + * @param {Object} val + */ + setValue: function(val) { + this.value = val; + }, + _sanitizeNumber: function(val) { + if (typeof val === 'number') { + return val; + } + if (isNaN(val) || (val === null) || (val === '') || (val === undefined)) { + return 1; + } + if (val === '') { + return 0; + } + if (typeof val.toLowerCase !== 'undefined') { + if (val.match(/^\./)) { + val = "0" + val; + } + return Math.ceil(parseFloat(val) * 100) / 100; + } + return 1; + }, + isTransparent: function(strVal) { + if (!strVal || !(typeof strVal === 'string' || strVal instanceof String)) { + return false; + } + strVal = strVal.toLowerCase().trim(); + return (strVal === 'transparent') || (strVal.match(/#?00000000/)) || (strVal.match(/(rgba|hsla)\(0,0,0,0?\.?0\)/)); + }, + rgbaIsTransparent: function(rgba) { + return ((rgba.r === 0) && (rgba.g === 0) && (rgba.b === 0) && (rgba.a === 0)); + }, + // parse a string to HSB + /** + * @protected + * @param {String} strVal + * @returns {boolean} Returns true if it could be parsed, false otherwise + */ + setColor: function(strVal) { + strVal = strVal.toLowerCase().trim(); + if (strVal) { + if (this.isTransparent(strVal)) { + this.value = { + h: 0, + s: 0, + b: 0, + a: 0 + }; + return true; + } else { + var parsedColor = this.parse(strVal); + if (parsedColor) { + this.value = this.value = { + h: parsedColor.h, + s: parsedColor.s, + b: parsedColor.b, + a: parsedColor.a + }; + if (!this.origFormat) { + this.origFormat = parsedColor.format; + } + } else if (this.fallbackValue) { + // if parser fails, defaults to fallbackValue if defined, otherwise the value won't be changed + this.value = this.fallbackValue; + } + } + } + return false; + }, + setHue: function(h) { + this.value.h = 1 - h; + }, + setSaturation: function(s) { + this.value.s = s; + }, + setBrightness: function(b) { + this.value.b = 1 - b; + }, + setAlpha: function(a) { + this.value.a = Math.round((parseInt((1 - a) * 100, 10) / 100) * 100) / 100; + }, + toRGB: function(h, s, b, a) { + if (arguments.length === 0) { + h = this.value.h; + s = this.value.s; + b = this.value.b; + a = this.value.a; + } + + h *= 360; + var R, G, B, X, C; + h = (h % 360) / 60; + C = b * s; + X = C * (1 - Math.abs(h % 2 - 1)); + R = G = B = b - C; + + h = ~~h; + R += [C, X, 0, 0, X, C][h]; + G += [X, C, C, X, 0, 0][h]; + B += [0, 0, X, C, C, X][h]; + + return { + r: Math.round(R * 255), + g: Math.round(G * 255), + b: Math.round(B * 255), + a: a + }; + }, + toHex: function(ignoreFormat, h, s, b, a) { + if (arguments.length <= 1) { + h = this.value.h; + s = this.value.s; + b = this.value.b; + a = this.value.a; + } + + var prefix = '#'; + var rgb = this.toRGB(h, s, b, a); + + if (this.rgbaIsTransparent(rgb)) { + return 'transparent'; + } + + if (!ignoreFormat) { + prefix = (this.hexNumberSignPrefix ? '#' : ''); + } + + var hexStr = prefix + ( + (1 << 24) + + (parseInt(rgb.r) << 16) + + (parseInt(rgb.g) << 8) + + parseInt(rgb.b)) + .toString(16) + .slice(1); + + return hexStr; + }, + toHSL: function(h, s, b, a) { + if (arguments.length === 0) { + h = this.value.h; + s = this.value.s; + b = this.value.b; + a = this.value.a; + } + + var H = h, + L = (2 - s) * b, + S = s * b; + if (L > 0 && L <= 1) { + S /= L; + } else { + S /= 2 - L; + } + L /= 2; + if (S > 1) { + S = 1; + } + return { + h: isNaN(H) ? 0 : H, + s: isNaN(S) ? 0 : S, + l: isNaN(L) ? 0 : L, + a: isNaN(a) ? 0 : a + }; + }, + toAlias: function(r, g, b, a) { + var c, rgb = (arguments.length === 0) ? this.toHex(true) : this.toHex(true, r, g, b, a); + + // support predef. colors in non-hex format too, as defined in the alias itself + var original = this.origFormat === 'alias' ? rgb : this.toString(false, this.origFormat); + + for (var alias in this.colors) { + c = this.colors[alias].toLowerCase().trim(); + if ((c === rgb) || (c === original)) { + return alias; + } + } + return false; + }, + RGBtoHSB: function(r, g, b, a) { + r /= 255; + g /= 255; + b /= 255; + + var H, S, V, C; + V = Math.max(r, g, b); + C = V - Math.min(r, g, b); + H = (C === 0 ? null : + V === r ? (g - b) / C : + V === g ? (b - r) / C + 2 : + (r - g) / C + 4 + ); + H = ((H + 360) % 6) * 60 / 360; + S = C === 0 ? 0 : C / V; + return { + h: this._sanitizeNumber(H), + s: S, + b: V, + a: this._sanitizeNumber(a) + }; + }, + HueToRGB: function(p, q, h) { + if (h < 0) { + h += 1; + } else if (h > 1) { + h -= 1; + } + if ((h * 6) < 1) { + return p + (q - p) * h * 6; + } else if ((h * 2) < 1) { + return q; + } else if ((h * 3) < 2) { + return p + (q - p) * ((2 / 3) - h) * 6; + } else { + return p; + } + }, + HSLtoRGB: function(h, s, l, a) { + if (s < 0) { + s = 0; + } + var q; + if (l <= 0.5) { + q = l * (1 + s); + } else { + q = l + s - (l * s); + } + + var p = 2 * l - q; + + var tr = h + (1 / 3); + var tg = h; + var tb = h - (1 / 3); + + var r = Math.round(this.HueToRGB(p, q, tr) * 255); + var g = Math.round(this.HueToRGB(p, q, tg) * 255); + var b = Math.round(this.HueToRGB(p, q, tb) * 255); + return [r, g, b, this._sanitizeNumber(a)]; + }, + /** + * @param {String} strVal + * @returns {Object} Object containing h,s,b,a,format properties or FALSE if failed to parse + */ + parse: function(strVal) { + if (typeof strVal !== 'string') { + return this.fallbackValue; + } + if (arguments.length === 0) { + return false; + } + + var that = this, + result = false, + isAlias = (typeof this.colors[strVal] !== 'undefined'), + values, format; + + if (isAlias) { + strVal = this.colors[strVal].toLowerCase().trim(); + } + + $.each(this.stringParsers, function(i, parser) { + var match = parser.re.exec(strVal); + values = match && parser.parse.apply(that, [match]); + if (values) { + result = {}; + format = (isAlias ? 'alias' : (parser.format ? parser.format : that.getValidFallbackFormat())); + if (format.match(/hsla?/)) { + result = that.RGBtoHSB.apply(that, that.HSLtoRGB.apply(that, values)); + } else { + result = that.RGBtoHSB.apply(that, values); + } + if (result instanceof Object) { + result.format = format; + } + return false; // stop iterating + } + return true; + }); + return result; + }, + getValidFallbackFormat: function() { + var formats = [ + 'rgba', 'rgb', 'hex', 'hsla', 'hsl' + ]; + if (this.origFormat && (formats.indexOf(this.origFormat) !== -1)) { + return this.origFormat; + } + if (this.fallbackFormat && (formats.indexOf(this.fallbackFormat) !== -1)) { + return this.fallbackFormat; + } + + return 'rgba'; // By default, return a format that will not lose the alpha info + }, + /** + * + * @param {string} [format] (default: rgba) + * @param {boolean} [translateAlias] Return real color for pre-defined (non-standard) aliases (default: false) + * @param {boolean} [forceRawValue] Forces hashtag prefix when getting hex color (default: false) + * @returns {String} + */ + toString: function(forceRawValue, format, translateAlias) { + format = format || this.origFormat || this.fallbackFormat; + translateAlias = translateAlias || false; + + var c = false; + + switch (format) { + case 'rgb': + { + c = this.toRGB(); + if (this.rgbaIsTransparent(c)) { + return 'transparent'; + } + return 'rgb(' + c.r + ',' + c.g + ',' + c.b + ')'; + } + break; + case 'rgba': + { + c = this.toRGB(); + return 'rgba(' + c.r + ',' + c.g + ',' + c.b + ',' + c.a + ')'; + } + break; + case 'hsl': + { + c = this.toHSL(); + return 'hsl(' + Math.round(c.h * 360) + ',' + Math.round(c.s * 100) + '%,' + Math.round(c.l * 100) + '%)'; + } + break; + case 'hsla': + { + c = this.toHSL(); + return 'hsla(' + Math.round(c.h * 360) + ',' + Math.round(c.s * 100) + '%,' + Math.round(c.l * 100) + '%,' + c.a + ')'; + } + break; + case 'hex': + { + return this.toHex(forceRawValue); + } + break; + case 'alias': + { + c = this.toAlias(); + + if (c === false) { + return this.toString(forceRawValue, this.getValidFallbackFormat()); + } + + if (translateAlias && !(c in Color.webColors) && (c in this.predefinedColors)) { + return this.predefinedColors[c]; + } + + return c; + } + default: + { + return c; + } + break; + } + }, + // a set of RE's that can match strings and generate color tuples. + // from John Resig color plugin + // https://github.com/jquery/jquery-color/ + stringParsers: [{ + re: /rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*?\)/, + format: 'rgb', + parse: function(execResult) { + return [ + execResult[1], + execResult[2], + execResult[3], + 1 + ]; + } + }, { + re: /rgb\(\s*(\d*(?:\.\d+)?)\%\s*,\s*(\d*(?:\.\d+)?)\%\s*,\s*(\d*(?:\.\d+)?)\%\s*?\)/, + format: 'rgb', + parse: function(execResult) { + return [ + 2.55 * execResult[1], + 2.55 * execResult[2], + 2.55 * execResult[3], + 1 + ]; + } + }, { + re: /rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d*(?:\.\d+)?)\s*)?\)/, + format: 'rgba', + parse: function(execResult) { + return [ + execResult[1], + execResult[2], + execResult[3], + execResult[4] + ]; + } + }, { + re: /rgba\(\s*(\d*(?:\.\d+)?)\%\s*,\s*(\d*(?:\.\d+)?)\%\s*,\s*(\d*(?:\.\d+)?)\%\s*(?:,\s*(\d*(?:\.\d+)?)\s*)?\)/, + format: 'rgba', + parse: function(execResult) { + return [ + 2.55 * execResult[1], + 2.55 * execResult[2], + 2.55 * execResult[3], + execResult[4] + ]; + } + }, { + re: /hsl\(\s*(\d*(?:\.\d+)?)\s*,\s*(\d*(?:\.\d+)?)\%\s*,\s*(\d*(?:\.\d+)?)\%\s*?\)/, + format: 'hsl', + parse: function(execResult) { + return [ + execResult[1] / 360, + execResult[2] / 100, + execResult[3] / 100, + execResult[4] + ]; + } + }, { + re: /hsla\(\s*(\d*(?:\.\d+)?)\s*,\s*(\d*(?:\.\d+)?)\%\s*,\s*(\d*(?:\.\d+)?)\%\s*(?:,\s*(\d*(?:\.\d+)?)\s*)?\)/, + format: 'hsla', + parse: function(execResult) { + return [ + execResult[1] / 360, + execResult[2] / 100, + execResult[3] / 100, + execResult[4] + ]; + } + }, { + re: /#?([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/, + format: 'hex', + parse: function(execResult) { + return [ + parseInt(execResult[1], 16), + parseInt(execResult[2], 16), + parseInt(execResult[3], 16), + 1 + ]; + } + }, { + re: /#?([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/, + format: 'hex', + parse: function(execResult) { + return [ + parseInt(execResult[1] + execResult[1], 16), + parseInt(execResult[2] + execResult[2], 16), + parseInt(execResult[3] + execResult[3], 16), + 1 + ]; + } + }], + colorNameToHex: function(name) { + if (typeof this.colors[name.toLowerCase()] !== 'undefined') { + return this.colors[name.toLowerCase()]; + } + return false; + } + }; + + /* + * Default plugin options + */ + var defaults = { + horizontal: false, // horizontal mode layout ? + inline: false, //forces to show the colorpicker as an inline element + color: false, //forces a color + format: false, //forces a format + input: 'input', // children input selector + container: false, // container selector + component: '.add-on, .input-group-addon', // children component selector + fallbackColor: false, // fallback color value. null = keeps current color. + fallbackFormat: 'hex', // fallback color format + hexNumberSignPrefix: true, // put a '#' (number sign) before hex strings + sliders: { + saturation: { + maxLeft: 100, + maxTop: 100, + callLeft: 'setSaturation', + callTop: 'setBrightness' + }, + hue: { + maxLeft: 0, + maxTop: 100, + callLeft: false, + callTop: 'setHue' + }, + alpha: { + maxLeft: 0, + maxTop: 100, + callLeft: false, + callTop: 'setAlpha' + } + }, + slidersHorz: { + saturation: { + maxLeft: 100, + maxTop: 100, + callLeft: 'setSaturation', + callTop: 'setBrightness' + }, + hue: { + maxLeft: 100, + maxTop: 0, + callLeft: 'setHue', + callTop: false + }, + alpha: { + maxLeft: 100, + maxTop: 0, + callLeft: 'setAlpha', + callTop: false + } + }, + template: '