- Mailing Lists
- web
- Re: [OCA/web] [ADD] web_widget_switchcase (#1064)
web mailing list archives
web@odoo-community.org
Browse archives
- By thread
- 
                            By date
                            - October 2025 1
- September 2025 9
- August 2025 6
- July 2025 5
- June 2025 4
- March 2025 1
- January 2025 1
- December 2024 2
- October 2024 2
- September 2024 5
- August 2024 1
- July 2024 1
- June 2024 2
- May 2024 7
- April 2024 4
- March 2024 3
- February 2024 2
- January 2024 1
- November 2023 3
- September 2023 5
- August 2023 4
- July 2023 3
- June 2023 1
- April 2023 1
- March 2023 7
- January 2023 2
- December 2022 1
- November 2022 3
- June 2022 2
- May 2022 2
- March 2022 1
- February 2022 2
- December 2021 1
- November 2021 8
- October 2021 2
- September 2021 1
- August 2021 12
- July 2021 9
- June 2021 8
- May 2021 20
- April 2021 31
- March 2021 7
- February 2021 1
- January 2021 6
- December 2020 12
- November 2020 29
- October 2020 5
- August 2020 1
- July 2020 28
- June 2020 14
- May 2020 7
- April 2020 10
- February 2020 9
- January 2020 5
- November 2019 1
- September 2019 2
- July 2019 5
- March 2019 4
- December 2018 6
- October 2018 38
- September 2018 20
- August 2018 19
- April 2018 1
- March 2018 1
- January 2018 1
- December 2017 1
- August 2017 1
- April 2017 1
- December 2016 2
- October 2016 1
- September 2016 1
 
Re: [OCA/web] [ADD] web_widget_switchcase (#1064)
by Simone Orsi <notifications@github.com> - 10/10/2018 14:07:24@simahawk requested changes on this pull request.
In web_widget_char_switchcase/__manifest__.py:
> @@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Copyright 2018 Simone Rubino - Agile Business Group
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
+{
+    "name": "Web Char Switchcase Widget",
+    "version": "10.0.1.0.0",
+    "author": "Agile Business Group, "
+              "Odoo Community Association (OCA)",
+    "license": "AGPL-3",
+    "category": "Web",
+    "website": "https://github.com/OCA/web/tree/"
https://github.com/OCA/web is enough (and you won't have to update the URL)
In web_widget_char_switchcase/static/src/js/web_widget_char_switchcase.js:
> +        init: function (field_manager, node) {
+            this._super(field_manager, node);
+            this.options = _.defaults(this.options, {
+                transform: this.transformations[0]
+            });
+            this.current_transformation = this.options['transform'];
+            if (!_.contains(this.transformations, this.current_transformation))
+                console.error(this.current_transformation + ' case unknown');
+        },
+        initialize_content: function() {
+            var res = this._super();
+            var self = this;
+            if(this.$input) {
+                this.$input.keyup(function(){
+                    var old_val = self.$input.val();
+                    var new_val = self.transform(old_val);
I'd set a transform_handler at init, so that you won't have to switch at each char typed
—
You are receiving this because you are on a team that was mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.