Commit dc796546 authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_web_renderjs_ui: add a common gadget to render multi&relation field & no...

erp5_web_renderjs_ui: add a common gadget to render multi&relation field & no need to show "Create:X" string

/reviewed-on !140
parents 0aea5167 8bddeb7d
......@@ -205,6 +205,8 @@ gadget_erp5_pt_report_view.html\n
gadget_erp5_pt_report_view.js\n
gadget_erp5_router.html\n
gadget_erp5_router.js\n
gadget_erp5_relation_input.html\n
gadget_erp5_relation_input.js\n
gadget_erp5_search_editor.html\n
gadget_erp5_search_editor.js\n
gadget_erp5_searchfield.html\n
......@@ -358,7 +360,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>952.33119.51229.58811</string> </value>
<value> <string>952.33120.45206.6075</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -376,7 +378,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1468331561.38</float>
<float>1468331792.72</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -7,104 +7,10 @@
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<script src="URI.js" type="text/javascript"></script>
<script src="handlebars.js" type="text/javascript"></script>
<script src="gadget_global.js" type="text/javascript"></script>
<script src="gadget_erp5_field_multirelationstring.js" type="text/javascript"></script>
<script id="create-template" type="text/x-handlebars-template">
<div class="ui-controlgroup ui-controlgroup-horizontal ui-corner-all">
<div class="ui-controlgroup-controls">
<li class="ui-first-child ui-last-child ui-input-text">Create:{{text}}
</li>
</div>
</script>
<script id="single-input-template" type="text/x-handlebars-template">
<fieldset class='single_input add_after'>
<div class="ui-input-text ui-body-inherit ui-corner-all ui-shadow-inset ui-input-has-clear ui-input-has-icon">
<input type='text' autocomplete="off" data-enhanced="true" >
<a href="#" tabindex="-1" class="ui-hidden-accessible">&nbsp;</a>
<div class="ui-tag-list ui-tag-list-inset"></div>
<ul class="ui-listview ui-corner-all search_ul"></ul>
</div>
<a href='#' tabindex="-1" class="ui-btn ui-corner-all ui-btn-icon-notext ui-icon-plane ui-shadow-inset ui-btn-inline ui-disabled">Jump to this document</a>
</fieldset>
</script>
<script id="multi-input-template" type="text/x-handlebars-template">
<div class="container">
{{#each input}}
<fieldset class="single_input">
<div class="ui-input-text ui-body-inherit ui-corner-all ui-shadow-inset ui-input-has-clear ui-input-has-icon {{../readonly}}">
{{#if create_object}}
<input type='text' title="{{title}}" name="{{name}}" autocomplete="off" data-enhanced="true" value="{{value}}" data-create-object="{{create_object}}">
{{else}}
<input type='text' title="{{title}}" name="{{name}}" autocomplete="off" data-enhanced="true" value="{{value}}" >
{{/if}}
<a href="#" tabindex="-1" class="ui-hidden-accessible">&nbsp;</a>
<div class="ui-tag-list ui-tag-list-inset">
{{#if create_object}}
<div class="ui-controlgroup ui-controlgroup-horizontal ui-corner-all">
<div class="ui-controlgroup-controls">
<li class="ui-first-child ui-last-child ui-input-text">Create:{{create_object}}
</li>
</div>
</div>
{{/if}}
</div>
<ul class="ui-listview ui-corner-all search_ul"></ul>
</div>
{{#if create_object}}
<a href='#' tabindex="-1" class="ui-btn ui-corner-all ui-btn-icon-notext ui-icon-plus ui-shadow-inset ui-btn-inline ui-disabled" >Jump to this document</a>
{{else}}
{{#if error_text}}
<a href='#' tabindex="-1" class="ui-btn ui-corner-all ui-btn-icon-notext ui-icon-warning ui-shadow-inset ui-btn-inline ui-disabled">Jump to this document</a>
{{else}}
{{#if jump_unknown}}
<a href='#' tabindex="-1" class="ui-btn ui-corner-all ui-btn-icon-notext ui-icon-warning ui-shadow-inset ui-btn-inline ui-disabled">Jump to this document</a>
{{else}}
{{#if href}}
{{#if ../allow_jump}}
<a href={{href}} tabindex="-1" class="ui-btn ui-corner-all ui-btn-icon-notext ui-icon-plane ui-shadow-inset ui-btn-inline">Jump to this document</a>
{{else}}
<a href='#' tabindex="-1" class="ui-btn ui-corner-all ui-btn-icon-notext ui-icon-plane ui-shadow-inset ui-btn-inline ui-disabled">Jump to this document</a>
{{/if}}
{{else}}
<a href='#' tabindex="-1" class="ui-btn ui-corner-all ui-btn-icon-notext ui-icon-plane ui-shadow-inset ui-btn-inline ui-disabled">Jump to this document</a>
{{/if}}
{{/if}}
{{/if}}
{{/if}}
</fieldset>
{{/each}}
</div>
</script>
<script id="relation-listview-template" type="text/x-handlebars-template">
{{#if list.length}}
<li class="ui-autocomplete ui-li ui-li-divider ui-bar-inherit ui-first-child" role="heading">Select from the {{list.length}} Search Results</li>
{{#each list}}
<li class="ui-li-static ui-body-inherit ui-icon-mail-forward ui-btn-icon-right" data-relative-url={{id}} >{{value}}</li>
{{/each}}
{{#each type}}
<li class="ui-li-static ui-body-inherit ui-bar-inherit ui-icon-plus ui-btn-icon-right" data-create-object="{{this}}" name="{{this}}">Create New {{this}}: {{../value}}</li>
{{/each}}
{{else}}
<li class="ui-autocomplete ui-li ui-li-divider ui-bar-inherit ui-first-child" role="heading">No result</li>
{{#each type}}
<li class="ui-li-static ui-body-inherit ui-bar-inherit ui-icon-plus ui-btn-icon-right" data-create-object="{{this}}" name="{{this}}">Create New {{this}}: {{../value}}</li>
{{/each}}
{{/if}}
<li class="ui-li-static ui-body-inherit ui-last-child ui-bar-inherit ui-icon-search ui-btn-icon-right" data-explore=true >Explore the Search Result List</li>
</script>
</head>
<body>
<div class="container">
</div>
</body>
</html>
\ No newline at end of file
......@@ -234,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>952.27575.44504.22766</string> </value>
<value> <string>952.27591.27746.29798</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1467999805.39</float>
<float>1468331869.06</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>952.33012.3834.15974</string> </value>
<value> <string>952.33012.29157.25361</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1468325066.65</float>
<float>1468331865.64</float>
<string>UTC</string>
</tuple>
</state>
......
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<title>ERP5 Relationstringfield</title>
<script src="jquery.js"></script>
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<script src="URI.js" type="text/javascript"></script>
<script src="handlebars.js" type="text/javascript"></script>
<script src="gadget_global.js" type="text/javascript"></script>
<script src="gadget_erp5_relation_input.js" type="text/javascript"></script>
<script id="relation-input-template" type="text/x-handlebars-template">
<div class="ui-input-text ui-body-inherit ui-corner-all ui-shadow-inset ui-input-has-clear ui-input-has-icon {{readonly}}">
<input type='text' title="{{title}}" name="{{name}}" autocomplete="off" data-enhanced="true" value="{{value}}" >
<a href="#" tabindex="-1" class="ui-hidden-accessible">&nbsp;</a>
<ul class="ui-listview ui-corner-all search_ul"></ul>
</div>
<a href={{href}} tabindex="-1" class="{{class_name}}" >Jump to this document</a>
</script>
<script id="relation-listview-template" type="text/x-handlebars-template">
{{#if list.length}}
<li class="ui-autocomplete ui-li ui-li-divider ui-bar-inherit ui-first-child" role="heading">Select from the {{list.length}} Search Results</li>
{{#each list}}
<li class="ui-li-static ui-body-inherit ui-icon-mail-forward ui-btn-icon-right" data-relative-url={{id}} >{{value}}</li>
{{/each}}
{{#each type}}
<li class="ui-li-static ui-body-inherit ui-bar-inherit ui-icon-plus ui-btn-icon-right" data-create-object="{{this}}" name="{{this}}">Create New {{this}}: {{../value}}</li>
{{/each}}
{{else}}
<li class="ui-autocomplete ui-li ui-li-divider ui-bar-inherit ui-first-child" role="heading">No result</li>
{{#each type}}
<li class="ui-li-static ui-body-inherit ui-bar-inherit ui-icon-plus ui-btn-icon-right" data-create-object="{{this}}" name="{{this}}">Create New {{this}}: {{../value}}</li>
{{/each}}
{{/if}}
<li class="ui-li-static ui-body-inherit ui-last-child ui-bar-inherit ui-icon-search ui-btn-icon-right" data-explore=true >Explore the Search Result List</li>
</script>
</head>
<body>
</body>
</html>
\ No newline at end of file
......@@ -7,82 +7,11 @@
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<script src="URI.js" type="text/javascript"></script>
<script src="handlebars.js" type="text/javascript"></script>
<script src="gadget_global.js" type="text/javascript"></script>
<script src="gadget_erp5_field_relationstring.js" type="text/javascript"></script>
<script id="create-template" type="text/x-handlebars-template">
<div class="ui-controlgroup ui-controlgroup-horizontal ui-corner-all">
<div class="ui-controlgroup-controls">
<li class="ui-first-child ui-last-child ui-input-text">Create:{{text}}
</li>
</div>
</script>
<script id="relation-input-template" type="text/x-handlebars-template">
<div class="ui-input-text ui-body-inherit ui-corner-all ui-shadow-inset ui-input-has-clear ui-input-has-icon {{readonly}}">
<input type='text' title={{title}} name={{name}} autocomplete="off" data-enhanced="true" {{required}} value="{{value}}" >
<a href="#" tabindex="-1" class="ui-hidden-accessible">&nbsp;</a>
<div class="ui-tag-list ui-tag-list-inset">
{{#if create_object}}
<div class="ui-controlgroup ui-controlgroup-horizontal ui-corner-all">
<div class="ui-controlgroup-controls">
<li class="ui-first-child ui-last-child ui-input-text">Create:{{create_object}}
</li>
</div>
</div>
{{/if}}
</div>
<ul class="ui-listview ui-corner-all search_ul"></ul>
</div>
{{#if create_object}}
<a href='#' tabindex="-1" class="ui-btn ui-corner-all ui-btn-icon-notext ui-icon-plus ui-shadow-inset ui-btn-inline ui-disabled" >Jump to this document</a>
{{else}}
{{#if error_text}}
<a href='#' tabindex="-1" class="ui-btn ui-corner-all ui-btn-icon-notext ui-icon-warning ui-shadow-inset ui-btn-inline ui-disabled">Jump to this document</a>
{{else}}
{{#if jump_unknown}}
<a href='#' tabindex="-1" class="ui-btn ui-corner-all ui-btn-icon-notext ui-icon-warning ui-shadow-inset ui-btn-inline ui-disabled">Jump to this document</a>
{{else}}
{{#if href}}
{{#if allow_jump}}
<a href={{href}} tabindex="-1" class="ui-btn ui-corner-all ui-btn-icon-notext ui-icon-plane ui-shadow-inset ui-btn-inline" >Jump to this document</a>
{{else}}
<a href='#' tabindex="-1" class="ui-btn ui-corner-all ui-btn-icon-notext ui-icon-plane ui-shadow-inset ui-btn-inline ui-disabled">Jump to this document</a>
{{/if}}
{{else}}
<a href='#' tabindex="-1" class="ui-btn ui-corner-all ui-btn-icon-notext ui-icon-plane ui-shadow-inset ui-btn-inline ui-disabled">Jump to this document</a>
{{/if}}
{{/if}}
{{/if}}
{{/if}}
</script>
<script id="relation-listview-template" type="text/x-handlebars-template">
{{#if list.length}}
<li class="ui-autocomplete ui-li ui-li-divider ui-bar-inherit ui-first-child" role="heading">Select from the {{list.length}} Search Results</li>
{{#each list}}
<li class="ui-li-static ui-body-inherit ui-icon-mail-forward ui-btn-icon-right" data-relative-url={{id}} >{{value}}</li>
{{/each}}
{{#each type}}
<li class="ui-li-static ui-body-inherit ui-bar-inherit ui-icon-plus ui-btn-icon-right" data-create-object="{{this}}" name="{{this}}">Create New {{this}}: {{../value}}</li>
{{/each}}
{{else}}
<li class="ui-autocomplete ui-li ui-li-divider ui-bar-inherit ui-first-child" role="heading">No result</li>
{{#each type}}
<li class="ui-li-static ui-body-inherit ui-bar-inherit ui-icon-plus ui-btn-icon-right" data-create-object="{{this}}" name="{{this}}">Create New {{this}}: {{../value}}</li>
{{/each}}
{{/if}}
<li class="ui-li-static ui-body-inherit ui-last-child ui-bar-inherit ui-icon-search ui-btn-icon-right" data-explore=true >Explore the Search Result List</li>
</script>
</head>
<body>
<div data-gadget-url="gadget_erp5_relation_input.html"
data-gadget-scope="relation_input"
data-gadget-sandbox="public"></div>
</body>
</html>
\ No newline at end of file
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>952.27574.44571.31761</string> </value>
<value> <string>952.27574.48547.19899</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1467998804.4</float>
<float>1468331862.94</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>952.33013.1794.1928</string> </value>
<value> <string>952.33013.17443.54510</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1468325115.92</float>
<float>1468331859.64</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -3,7 +3,7 @@
(function (self, caches, fetch) {
"use strict";
var CACHE_NAME = 'Tue, 24 Jun 2016 16:00:00 GMT',
var CACHE_NAME = 'Thu, 12 July 2016 12:00:00 GMT',
// Files required to make this app work offline
REQUIRED_FILES = [
'./',
......@@ -100,6 +100,8 @@
'gadget_erp5_pt_report_view.js',
'gadget_erp5_router.html',
'gadget_erp5_router.js',
'gadget_erp5_relation_input.html',
'gadget_erp5_relation_input.js',
'gadget_erp5_search_editor.html',
'gadget_erp5_search_editor.js',
'gadget_erp5_searchfield.html',
......@@ -189,4 +191,4 @@
}(self, caches, fetch));
}(self, caches, fetch));
\ No newline at end of file
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>952.10297.29040.12014</string> </value>
<value> <string>952.33133.9116.24098</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1468327067.19</float>
<float>1468419919.07</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -160,12 +160,6 @@
</tr>
<tr>
<td>verifyText</td>
<td>//div[@data-gadget-scope='field_my_bar_category_title_list']//fieldset[1]//div[@class="ui-tag-list ui-tag-list-inset"]//li</td>
<td>Create:Foo</td>
</tr>
<tr>
......@@ -216,12 +210,6 @@
</tr>
<tr>
<td>verifyText</td>
<td>//div[@data-gadget-scope='field_my_bar_category_title_list']//fieldset[2]//div[@class="ui-tag-list ui-tag-list-inset"]//li</td>
<td>Create:Foo</td>
</tr>
<tr>
<td>verifyElementPresent</td>
<td>//div[@data-gadget-scope='field_my_bar_category_title_list']//fieldset[2]//a[contains(@class, "ui-icon-plus")]</td>
......
......@@ -175,11 +175,7 @@
</tr>
<tr>
<td>verifyText</td>
<td>//div[@data-gadget-scope='field_my_bar_category_title_list']//fieldset[1]//div[@class="ui-tag-list ui-tag-list-inset"]//li</td>
<td>Create:Foo</td>
</tr>
......@@ -326,11 +322,6 @@
</tr>
<tr>
<td>verifyText</td>
<td>//div[@data-gadget-scope='field_my_bar_category_title_list']//fieldset[1]//div[@class="ui-tag-list ui-tag-list-inset"]//li</td>
<td>Create:Foo</td>
</tr>
......
......@@ -137,11 +137,7 @@
</tr>
<tr>
<td>verifyText</td>
<td>//div[@data-gadget-scope='field_my_bar_category_title_list']//fieldset[1]//div[@class="ui-tag-list ui-tag-list-inset"]//li</td>
<td>Create:Foo</td>
</tr>
......@@ -195,11 +191,6 @@
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Create:Category</td>
<td></td>
</tr>
<tr>
<td>click</td>
......@@ -279,11 +270,7 @@
<td>//input[@name="field_my_foo_line_foo_category_title"]</td>
<td>TEST1</td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>Create:Category</td>
<td></td>
</tr>
<tr>
<td>assertChecked</td>
......@@ -305,11 +292,7 @@
</tr>
<tr>
<td>verifyText</td>
<td>//div[@data-gadget-scope='field_my_bar_category_title_list']//fieldset[1]//div[@class="ui-tag-list ui-tag-list-inset"]//li</td>
<td>Create:Foo</td>
</tr>
......@@ -462,11 +445,7 @@
<td>//input[@name="field_my_foo_line_foo_category_title"]</td>
<td>TEST1</td>
</tr>
<tr>
<td>verifyTextNotPresent</td>
<td>Create:Category</td>
<td></td>
</tr>
<tr>
<td>assertNotChecked</td>
......
......@@ -206,11 +206,7 @@
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Create:Category</td>
<td></td>
</tr>
<tr>
<td>click</td>
......@@ -334,11 +330,7 @@
<td>//input[@name="field_my_foo_big_category_title"]</td>
<td>TEST1</td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>Create:Category</td>
<td></td>
</tr>
<tr>
<td>assertChecked</td>
......@@ -488,11 +480,7 @@
<td>//input[@name="field_my_foo_big_category_title"]</td>
<td>TEST1</td>
</tr>
<tr>
<td>verifyTextNotPresent</td>
<td>Create:Category</td>
<td></td>
</tr>
<tr>
<td>assertNotChecked</td>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment