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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Vivek
erp5
Commits
0499415f
Commit
0499415f
authored
Nov 23, 2015
by
Vivek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gadget_interface_validator: moved interface based gadget rendering to router gadget.
parent
c677314d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
66 deletions
+63
-66
bt5/erp5_gadget_interface_validator/PathTemplateItem/web_page_module/gadget_interface_validator_page_form_js.xml
...b_page_module/gadget_interface_validator_page_form_js.xml
+7
-54
bt5/erp5_gadget_interface_validator/PathTemplateItem/web_page_module/gadget_interface_validator_router_html.xml
...eb_page_module/gadget_interface_validator_router_html.xml
+6
-3
bt5/erp5_gadget_interface_validator/PathTemplateItem/web_page_module/gadget_interface_validator_router_js.xml
.../web_page_module/gadget_interface_validator_router_js.xml
+50
-9
No files found.
bt5/erp5_gadget_interface_validator/PathTemplateItem/web_page_module/gadget_interface_validator_page_form_js.xml
View file @
0499415f
...
...
@@ -105,18 +105,6 @@
/*jslint nomen: true, indent: 2, maxerr: 3 */\n
(function (window, rJS, RSVP, Handlebars) {\n
"use strict";\n
\n
var INTERFACE_GADGET_SCOPE = "interface_gadget";\n
\n
function fetchPageType(gadget_url) {\n
var page_type = \'\',\n
key = \'_page_\';\n
if(gadget_url.indexOf(key) >
-1) {\n
page_type = gadget_url.substring(gadget_url.indexOf(key) + key.length,\n
gadget_url.lastIndexOf(\'.\'));\n
}\n
return page_type;\n
}\n
\n
/////////////////////////////////////////////////////////////////\n
// Handlebars\n
...
...
@@ -182,11 +170,7 @@
\n
.declareMethod("submitForm", function(options) {\n
var gadget = this,\n
interface_gadget,\n
appcache_url,\n
required_interface,\n
page_type,\n
gadget_source_url = \'gadget_interface_validator.appcache\';\n
appcache_url;\n
return new RSVP.Queue()\n
.push(function () {\n
gadget.props.content_element.querySelector("input[type=submit]")\n
...
...
@@ -195,41 +179,10 @@
})\n
.push(function(submit_url) {\n
appcache_url = submit_url;\n
return gadget.getDeclaredGadget(INTERFACE_GADGET_SCOPE);\n
})\n
.push(function(i_gadget) {\n
required_interface = \'gadget_interface_validator_interface_report.html\';\n
interface_gadget = i_gadget;\n
return interface_gadget.getGadgetListImplementingInterface(required_interface, gadget_source_url);\n
})\n
.push(function(gadget_list) {\n
if(gadget_list.length > 0) {\n
page_type = fetchPageType(gadget_list[0]);\n
return gadget.redirect({\n
page: page_type,\n
appcache_url: appcache_url\n
});\n
} else {\n
required_interface = \'gadget_interface_validator_interface_form.html\';\n
return new RSVP.Queue()\n
.push(function() {\n
return interface_gadget.getGadgetListImplementingInterface(required_interface, gadget_source_url);\n
})\n
.push(function(gadget_list) {\n
console.log("gadget_list");\n
if(gadget_list.length > 0) {\n
page_type = fetchPageType(gadget_list[0]);\n
return gadget.redirect({\n
page: page_type,\n
found: false\n
});\n
} else {\n
return gadget.redirect({\n
found: false\n
});\n
}\n
});\n
}\n
return gadget.redirect({\n
interface_type: \'report\',\n
appcache_url: appcache_url\n
});\n
});\n
})\n
\n
...
...
@@ -387,7 +340,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
947.1
1076.45303.33126
</string>
</value>
<value>
<string>
947.1
8869.9624.56115
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -405,7 +358,7 @@
</tuple>
<state>
<tuple>
<float>
144
7781632.75
</float>
<float>
144
8263988.6
</float>
<string>
GMT
</string>
</tuple>
</state>
...
...
bt5/erp5_gadget_interface_validator/PathTemplateItem/web_page_module/gadget_interface_validator_router_html.xml
View file @
0499415f
...
...
@@ -123,7 +123,10 @@
\n
</head>
\n
<body>
\n
<div
data-gadget-url=
"gadget_jio.html"
data-gadget-scope=
"jio_selection"
></div>
\n
<div
data-gadget-url=
"gadget_interface.html"
\n
data-gadget-scope=
"interface_gadget"
\n
data-gadget-sandbox=
"public"
></div>
\n
<div
data-gadget-url=
"gadget_jio.html"
data-gadget-scope=
"jio_selection"
></div>
\n
</body>
\n
</html>
...
...
@@ -262,7 +265,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
947.
9498.60930.4416
8
</string>
</value>
<value>
<string>
947.
14679.48387.890
8
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -280,7 +283,7 @@
</tuple>
<state>
<tuple>
<float>
144
7996304.28
</float>
<float>
144
8247105.54
</float>
<string>
GMT
</string>
</tuple>
</state>
...
...
bt5/erp5_gadget_interface_validator/PathTemplateItem/web_page_module/gadget_interface_validator_router_js.xml
View file @
0499415f
...
...
@@ -108,7 +108,9 @@
\n
var MAIN_PAGE_PREFIX = "gadget_interface_validator_",\n
DEFAULT_PAGE = "form",\n
REDIRECT_TIMEOUT = 5000;\n
DEFAULT_GADGET_SOURCE = \'gadget_interface_validator.appcache\',\n
REDIRECT_TIMEOUT = 30000,\n
INTERFACE_GADGET_SCOPE = "interface_gadget";\n
\n
function listenHashChange(gadget) {\n
function extractHashAndDispatch(evt) {\n
...
...
@@ -147,6 +149,16 @@
window.dispatchEvent(event);\n
return result;\n
}\n
\n
function fetchPageType(gadget_url) {\n
var page_type = \'\',\n
key = \'_page_\';\n
if(gadget_url.indexOf(key) >
-1) {\n
page_type = gadget_url.substring(gadget_url.indexOf(key) + key.length,\n
gadget_url.lastIndexOf(\'.\'));\n
}\n
return page_type;\n
}\n
\n
rJS(window)\n
.ready(function (gadget) {\n
...
...
@@ -184,13 +196,42 @@
.declareMethod(\'route\', function (options) {\n
var gadget = this,\n
args = options.args,\n
page;\n
page,\n
page_type = \'\',\n
interface_name = \'\',\n
gadget_source;\n
if (args.interface_type) {\n
interface_name = MAIN_PAGE_PREFIX + "interface_" + args.interface_type + ".html";\n
} else if(args.interface_name) {\n
interface_name = args.interface_name;\n
}\n
\n
page = args.page || DEFAULT_PAGE;\n
return {\n
url: MAIN_PAGE_PREFIX + "page_" + page + ".html",\n
options: args\n
};\n
if(interface_name) {\n
gadget_source = args.gadget_source || DEFAULT_GADGET_SOURCE;\n
return new RSVP.Queue()\n
.push(function() {\n
return gadget.getDeclaredGadget(INTERFACE_GADGET_SCOPE);\n
})\n
.push(function(interface_gadget) {\n
return interface_gadget.getGadgetListImplementingInterface(interface_name, gadget_source);\n
})\n
.push(function(gadget_list) {\n
if(gadget_list.length > 0) {\n
page_type = fetchPageType(gadget_list[0]);\n
}\n
page = page_type || DEFAULT_PAGE;\n
return ({\n
url: MAIN_PAGE_PREFIX + "page_" + page + ".html",\n
options: args\n
});\n
});\n
} else {\n
page = args.page || DEFAULT_PAGE;\n
return {\n
url: MAIN_PAGE_PREFIX + "page_" + page + ".html",\n
options: args\n
};\n
}\n
})\n
\n
.declareAcquiredMethod(\'renderApplication\', \'renderApplication\')\n
...
...
@@ -345,7 +386,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
947.1
4517.45318.16230
</string>
</value>
<value>
<string>
947.1
9086.45042.34679
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -363,7 +404,7 @@
</tuple>
<state>
<tuple>
<float>
144
7986581.85
</float>
<float>
144
8260821.21
</float>
<string>
GMT
</string>
</tuple>
</state>
...
...
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