Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alain Takoudjou
erp5
Commits
70b18284
Commit
70b18284
authored
Jan 12, 2015
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rewrite Webscrip's JSLinter as a gadget field
parent
2b89b75e
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
246 additions
and
331 deletions
+246
-331
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebScript_checkSyntax.xml
...rtal_skins/erp5_web_renderjs_ui/WebScript_checkSyntax.xml
+1
-1
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebScript_checkSyntax/my_text_content.xml
...web_renderjs_ui/WebScript_checkSyntax/my_text_content.xml
+47
-111
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebScript_getTextContent.xml
...l_skins/erp5_web_renderjs_ui/WebScript_getTextContent.xml
+0
-67
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebScript_renderCheckSyntax.xml
...kins/erp5_web_renderjs_ui/WebScript_renderCheckSyntax.xml
+0
-75
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/check_code.js.xml
...eItem/portal_skins/erp5_web_renderjs_ui/check_code.js.xml
+0
-63
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/gadget_jslint.html.xml
.../portal_skins/erp5_web_renderjs_ui/gadget_jslint.html.xml
+85
-0
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/gadget_jslint.js.xml
...em/portal_skins/erp5_web_renderjs_ui/gadget_jslint.js.xml
+92
-0
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/jslint.js.xml
...plateItem/portal_skins/erp5_web_renderjs_ui/jslint.js.xml
+21
-14
No files found.
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebScript_checkSyntax.xml
View file @
70b18284
...
...
@@ -44,7 +44,7 @@
<key>
<string>
bottom
</string>
</key>
<value>
<list>
<string>
my_
syntax
</string>
<string>
my_
text_content
</string>
</list>
</value>
</item>
...
...
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebScript_checkSyntax/my_
syntax
.xml
→
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebScript_checkSyntax/my_
text_content
.xml
View file @
70b18284
This diff is collapsed.
Click to expand it.
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebScript_getTextContent.xml
deleted
100644 → 0
View file @
2b89b75e
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
return context.getTextContent()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
WebScript_getTextContent
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebScript_renderCheckSyntax.xml
deleted
100644 → 0
View file @
2b89b75e
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ZopePageTemplate"
module=
"Products.PageTemplates.ZopePageTemplate"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_text
</string>
</key>
<value>
<unicode
encoding=
"cdata"
>
<![CDATA[
<tal:block tal:define=\'site_root python: here.getWebSiteValue() or here.getPortalObject();\n
portal_url python: site_root.absolute_url();\n
\'>
\n
\n
<script
type=
"text/javascript"
\n
tal:attributes=
"src string:${portal_url}/jslint.js"
></script>
\n
<script
type=
"text/javascript"
\n
tal:attributes=
"src string:${portal_url}/check_code.js"
></script>
\n
\n
</tal:block>
]]>
</unicode>
</value>
</item>
<item>
<key>
<string>
content_type
</string>
</key>
<value>
<string>
text/html
</string>
</value>
</item>
<item>
<key>
<string>
expand
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
WebScript_renderCheckSyntax
</string>
</value>
</item>
<item>
<key>
<string>
output_encoding
</string>
</key>
<value>
<string>
utf-8
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<unicode></unicode>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/check_code.js.xml
deleted
100644 → 0
View file @
2b89b75e
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"DTMLDocument"
module=
"OFS.DTMLDocument"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
__name__
</string>
</key>
<value>
<string>
check_code.js
</string>
</value>
</item>
<item>
<key>
<string>
_vars
</string>
</key>
<value>
<dictionary/>
</value>
</item>
<item>
<key>
<string>
globals
</string>
</key>
<value>
<dictionary/>
</value>
</item>
<item>
<key>
<string>
raw
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
$(document).ready(function(){\n
var get_code_url = document.baseURI + \'WebScript_getTextContent\';\n
check_code = function (code_to_check) {\n
\n
var i, len, data, err, table_html;\n
\n
JSLINT(code_to_check, {});\n
data = JSLINT.data();\n
table_html = \'<div class="listbox-container">
<div
class=
"listbox-content maximal-width"
><div
class=
"listbox-body"
><table
class=
"listbox listbox-table"
><tbody>
\';\n
line_letter = "A";\n
for (i = 0, len = data.errors.length; i
< len
;
i
+=
1)
{\n
console.log("err",
err)\n
err =
data.errors[i];\n
if
(err
!==
null)
{\n
table_html =
table_html
+
\'<tr
class=
"Data\' + line_letter + \'"
><td
class=
"listbox-table-data-cell"
>
\' + \'line: \' + err.line + \': \' + err.character + \': \' + (err.evidence || \'\') + \'
</td><td
class=
"listbox-table-data-cell"
>
\' + err.reason + "
</td></tr>
";\n
line_letter = line_letter === "A" ? "B": "A";\n
}\n
} \n
table_html = table_html + "
</tbody></table></div></div></div>
";\n
document.getElementsByClassName("check_code")[0].innerHTML = table_html;\n
};\n
$.get(get_code_url,\n
check_code);\n
});
]]>
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/gadget_jslint.html.xml
0 → 100644
View file @
70b18284
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"File"
module=
"OFS.Image"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_Cacheable__manager_id
</string>
</key>
<value>
<string>
http_cache
</string>
</value>
</item>
<item>
<key>
<string>
_EtagSupport__etag
</string>
</key>
<value>
<string>
ts21077282.37
</string>
</value>
</item>
<item>
<key>
<string>
__name__
</string>
</key>
<value>
<string>
gadget_jslint.html
</string>
</value>
</item>
<item>
<key>
<string>
content_type
</string>
</key>
<value>
<string>
text/html
</string>
</value>
</item>
<item>
<key>
<string>
data
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
<!DOCTYPE html>
\n
<html>
\n
<head>
\n
<meta
http-equiv=
"Content-type"
content=
"text/html; charset=utf-8"
/>
\n
<meta
name=
"viewport"
content=
"width=device-width, user-scalable=no"
/>
\n
<script
src=
"handlebars.js"
type=
"text/javascript"
></script>
\n
<script
src=
"jslint.js"
type=
"text/javascript"
></script>
\n
\n
<script
id=
"jslint_template"
type=
"text/x-handlebars-template"
>
\n
{{#each error_list}}\n
{{#if this}}\n
<tr
class=
"Data{{this.line_letter}}"
>
\n
<td
class=
"listbox-table-data-cell"
>
line: {{this.line}}: {{this.character}}: {{this.evidence}}
</td>
\n
<td
class=
"listbox-table-data-cell"
>
{{this.reason}}
</td>
\n
</tr>
\n
{{/if}}\n
{{else}}\n
<tr
class=
"DataA"
><td>
No error!
</td></tr>
\n
{{/each}}\n
</script>
\n
\n
<script
src=
"rsvp.js"
type=
"text/javascript"
></script>
\n
<script
src=
"renderjs.js"
type=
"text/javascript"
></script>
\n
<script
src=
"gadget_jslint.js"
type=
"text/javascript"
></script>
\n
</head>
\n
<body>
\n
<div
class=
"listbox-container"
>
\n
<div
class=
"listbox-content maximal-width"
>
\n
<div
class=
"listbox-body"
>
\n
<table
class=
"listbox listbox-table"
>
\n
<tbody>
\n
</tbody>
\n
</table>
\n
</div>
\n
</div>
\n
</div>
\n
</body>
\n
</html>
]]>
</string>
</value>
</item>
<item>
<key>
<string>
precondition
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
size
</string>
</key>
<value>
<int>
1269
</int>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/gadget_jslint.js.xml
0 → 100644
View file @
70b18284
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"File"
module=
"OFS.Image"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_Cacheable__manager_id
</string>
</key>
<value>
<string>
http_cache
</string>
</value>
</item>
<item>
<key>
<string>
_EtagSupport__etag
</string>
</key>
<value>
<string>
ts21077825.13
</string>
</value>
</item>
<item>
<key>
<string>
__name__
</string>
</key>
<value>
<string>
gadget_jslint.js
</string>
</value>
</item>
<item>
<key>
<string>
content_type
</string>
</key>
<value>
<string>
application/javascript
</string>
</value>
</item>
<item>
<key>
<string>
data
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
/*global window, rJS, JSLINT, Handlebars */\n
/*jslint nomen: true, maxlen:80, indent:2*/\n
(function (rJS, Handlebars, JSLINT, window) {\n
"use strict";\n
var gk = rJS(window),\n
template_source = gk.__template_element\n
.getElementById(\'jslint_template\')\n
.innerHTML,\n
template = Handlebars.compile(template_source);\n
\n
rJS(window)\n
.ready(function (g) {\n
g.props = {};\n
})\n
.ready(function (g) {\n
return g.getElement().push(function (element) {\n
g.props.element = element;\n
});\n
})\n
\n
.declareMethod("render", function (options) {\n
var text_content = options.value,\n
data,\n
html_content,\n
i,\n
line_letter = "A",\n
len,\n
gadget = this;\n
JSLINT(text_content, {});\n
data = JSLINT.data();\n
\n
for (i = 0, len = data.errors.length; i < len; i += 1) {\n
if (data.errors[i] !== null) {\n
data.errors[i].line_letter = line_letter;\n
line_letter = line_letter === "A" ? "B" : "A";\n
}\n
}\n
html_content = template({\n
error_list: data.errors\n
});\n
\n
gadget.props.element.querySelector("tbody")\n
.innerHTML = html_content;\n
});\n
}(rJS, Handlebars, JSLINT, window));
]]>
</string>
</value>
</item>
<item>
<key>
<string>
precondition
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
size
</string>
</key>
<value>
<int>
1278
</int>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/jslint.js.xml
View file @
70b18284
...
...
@@ -2,28 +2,28 @@
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"
DTMLDocument"
module=
"OFS.DTMLDocument
"
/>
<global
name=
"
File"
module=
"OFS.Image
"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
__name__
</string>
</key>
<value>
<string>
jslint.js
</string>
</value>
<key>
<string>
_Cacheable__manager_id
</string>
</key>
<value>
<string>
http_cache
</string>
</value>
</item>
<item>
<key>
<string>
_EtagSupport__etag
</string>
</key>
<value>
<string>
ts21078299.16
</string>
</value>
</item>
<item>
<key>
<string>
_vars
</string>
</key>
<value>
<dictionary/>
</value>
<key>
<string>
__name__
</string>
</key>
<value>
<string>
jslint.js
</string>
</value>
</item>
<item>
<key>
<string>
globals
</string>
</key>
<value>
<dictionary/>
</value>
<key>
<string>
content_type
</string>
</key>
<value>
<string>
application/javascript
</string>
</value>
</item>
<item>
<key>
<string>
raw
</string>
</key>
<key>
<string>
data
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
// jslint.js\n
...
...
@@ -4303,11 +4303,18 @@ klass: do {\n
itself.edition =
\'2014-04-08\';\n
\n
return
itself;\n
}());\n
}());
]]
></string>
</value>
</item>
<item>
<key>
<string>
precondition
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
size
</string>
</key>
<value>
<int>
144477
</int>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment