Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-compiled Coffee-Scripts with version 1.12.7 #842

Merged
merged 3 commits into from
May 23, 2018

Conversation

ramonski
Copy link
Contributor

Description of the issue/feature this PR addresses

We can not use Coffee Script versions >= 2to compile our coffee script files
The reason is that newer CS version compile template strings into ES compatible templatesliterals:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals

But these Template Literals are not cached correctly in Plone's portal_javascripts and it comes to failures with the global jQuery $ variable.

Please see here the differences between compiling code with CoffeeScript version 2.2.3 (the code removed -) and CoffeeScript version
1.12.7 (the code added +)

+    AnalysisServiceEditView.prototype.add_select_option = function(select, name, value) {

-    add_select_option(select, name, value) {
-      var option;
       /**
        * Adds an option to the select
        */
+      var option;
       if (value) {
-        option = `<option value='${value}'>${this._(name)}</option>`;
+        option = "<option value='" + value + "'>" + (this._(name)) + "</option>";
       } else {
-        // empty option (selected by default)
-        option = `<option selected='selected' value=''>${this._("None")}</option>`;
+        option = "<option selected='selected' value=''>" + (this._("None")) + "</option>";
       }
       return $(select).append(option);
-    }
+    };

Therefore, ensure you have CoffeeScript version 1.12.7 installed on your system
npm list -g | grep coffeescript
Install it like this:
npm install -g "coffeescript@<2"
Ensure you have it like this:

coffee --version
CoffeeScript version 1.12.7

Current behavior before PR

Analysis Category Expansion fails in Production Mode with this Error:
Uncaught SyntaxError: Unexpected identifier

Desired behavior after PR is merged

JS logic works fine in Production Mode

--
I confirm I have tested this PR thoroughly and coded it according to PEP8
and Plone's Python styleguide standards.

@xispa xispa merged commit a658b80 into master May 23, 2018
@xispa xispa deleted the fix-as-category-expansion branch May 23, 2018 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants