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
Hamza
erp5
Commits
705eec7b
Commit
705eec7b
authored
Jun 17, 2019
by
Tristan Cavelier
Committed by
Romain Courteaud
Jul 29, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_web_renderjs_ui] jslint rjs_gadget_erp5_relation_input_js
parent
9c751e8d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
72 deletions
+75
-72
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_relation_input_js.js
...Item/web_page_module/rjs_gadget_erp5_relation_input_js.js
+75
-72
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_relation_input_js.js
View file @
705eec7b
...
...
@@ -311,95 +311,98 @@
})
.
push
(
function
()
{
translation_promise
=
gadget
.
getTranslationList
([
'
Create New
'
,
'
Explore the Search Result List
'
'
Create New
'
,
'
Explore the Search Result List
'
]);
return
gadget
.
jio_allDocs
({
query
:
Query
.
objectToSearchText
(
new
ComplexQuery
({
operator
:
"
AND
"
,
query_list
:
[
QueryFactory
.
create
(
new
URI
(
gadget
.
state
.
query
).
query
(
true
).
query
),
new
SimpleQuery
({
key
:
gadget
.
state
.
catalog_index
,
value
:
value_text
})
]
})),
limit
:
[
0
,
10
],
select_list
:
[
gadget
.
state
.
catalog_index
,
"
uid
"
],
sort_on
:
JSON
.
parse
(
gadget
.
state
.
sort_list_json
)
query
:
Query
.
objectToSearchText
(
new
ComplexQuery
({
operator
:
"
AND
"
,
query_list
:
[
QueryFactory
.
create
(
new
URI
(
gadget
.
state
.
query
).
query
(
true
).
query
),
new
SimpleQuery
({
key
:
gadget
.
state
.
catalog_index
,
value
:
value_text
})
]
})),
limit
:
[
0
,
10
],
select_list
:
[
gadget
.
state
.
catalog_index
,
"
uid
"
],
sort_on
:
JSON
.
parse
(
gadget
.
state
.
sort_list_json
)
})
.
push
(
function
(
result
)
{
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
RSVP
.
all
([
result
,
translation_promise
]);
})
.
push
(
function
(
result_list
)
{
var
i
,
row
,
portal_type_list
,
translated_portal_type_list
,
fragment_element
=
document
.
createDocumentFragment
(),
li_element
;
.
push
(
function
(
result_list
)
{
var
i
,
row
,
portal_type_list
,
translated_portal_type_list
,
fragment_element
=
document
.
createDocumentFragment
(),
li_element
;
plane
.
className
=
JUMP_UNKNOWN_CLASS_STR
;
plane
.
className
=
JUMP_UNKNOWN_CLASS_STR
;
// Documents
// Documents
// <li class="ui-icon-sign-in ui-btn-icon-right" data-relative-url="{{id}}"
// data-uid="{{uid}}">{{value}}</li>
for
(
i
=
0
;
i
<
result_list
[
0
].
data
.
rows
.
length
;
i
+=
1
)
{
row
=
result_list
[
0
].
data
.
rows
[
i
];
li_element
=
document
.
createElement
(
'
li
'
);
li_element
.
setAttribute
(
'
class
'
,
'
ui-icon-sign-in ui-btn-icon-right
'
);
li_element
.
setAttribute
(
'
data-relative-url
'
,
row
.
id
);
li_element
.
setAttribute
(
'
data-uid
'
,
row
.
value
.
uid
);
li_element
.
textContent
=
row
.
value
[
gadget
.
state
.
catalog_index
];
fragment_element
.
appendChild
(
li_element
);
}
// New documents
for
(
i
=
0
;
i
<
result_list
[
0
].
data
.
rows
.
length
;
i
+=
1
)
{
row
=
result_list
[
0
].
data
.
rows
[
i
];
li_element
=
document
.
createElement
(
'
li
'
);
li_element
.
setAttribute
(
'
class
'
,
'
ui-icon-sign-in ui-btn-icon-right
'
);
li_element
.
setAttribute
(
'
data-relative-url
'
,
row
.
id
);
li_element
.
setAttribute
(
'
data-uid
'
,
row
.
value
.
uid
);
li_element
.
textContent
=
row
.
value
[
gadget
.
state
.
catalog_index
];
fragment_element
.
appendChild
(
li_element
);
}
// New documents
// <li class="ui-icon-plus ui-btn-icon-right" data-i18n="Create New"
// data-create-object="{{value}}" name="{{name}}">Create New
// <span> {{name}}: {{../value}}</span></li>
if
(
gadget
.
state
.
allow_creation
)
{
portal_type_list
=
JSON
.
parse
(
gadget
.
state
.
portal_types
);
translated_portal_type_list
=
JSON
.
parse
(
gadget
.
state
.
translated_portal_types
);
for
(
i
=
0
;
i
<
portal_type_list
.
length
;
i
+=
1
)
{
li_element
=
document
.
createElement
(
'
li
'
);
li_element
.
setAttribute
(
'
class
'
,
'
ui-icon-plus ui-btn-icon-right
'
);
li_element
.
setAttribute
(
'
data-create-object
'
,
portal_type_list
[
i
]);
li_element
.
setAttribute
(
'
name
'
,
translated_portal_type_list
[
i
]);
li_element
.
textContent
=
result_list
[
1
][
0
]
+
'
'
+
translated_portal_type_list
[
i
]
+
'
:
'
+
value_text
;
fragment_element
.
appendChild
(
li_element
);
}
}
// Explore
if
(
gadget
.
state
.
allow_creation
)
{
portal_type_list
=
JSON
.
parse
(
gadget
.
state
.
portal_types
);
translated_portal_type_list
=
JSON
.
parse
(
gadget
.
state
.
translated_portal_types
);
for
(
i
=
0
;
i
<
portal_type_list
.
length
;
i
+=
1
)
{
li_element
=
document
.
createElement
(
'
li
'
);
li_element
.
setAttribute
(
'
class
'
,
'
ui-icon-plus ui-btn-icon-right
'
);
li_element
.
setAttribute
(
'
data-create-object
'
,
portal_type_list
[
i
]);
li_element
.
setAttribute
(
'
name
'
,
translated_portal_type_list
[
i
]);
li_element
.
textContent
=
result_list
[
1
][
0
]
+
'
'
+
translated_portal_type_list
[
i
]
+
'
:
'
+
value_text
;
fragment_element
.
appendChild
(
li_element
);
}
}
// Explore
// <li class="ui-icon-search ui-btn-icon-right" data-explore=true
// data-i18n="Explore the Search Result List" ></li>
li_element
=
document
.
createElement
(
'
li
'
);
li_element
.
setAttribute
(
'
class
'
,
'
ui-icon-search ui-btn-icon-right
'
);
li_element
.
setAttribute
(
'
data-explore
'
,
true
);
li_element
.
textContent
=
result_list
[
1
][
1
];
fragment_element
.
appendChild
(
li_element
);
while
(
ul
.
firstChild
)
{
ul
.
removeChild
(
ul
.
firstChild
);
}
ul
.
appendChild
(
fragment_element
);
});
li_element
=
document
.
createElement
(
'
li
'
);
li_element
.
setAttribute
(
'
class
'
,
'
ui-icon-search ui-btn-icon-right
'
);
li_element
.
setAttribute
(
'
data-explore
'
,
true
);
li_element
.
textContent
=
result_list
[
1
][
1
];
fragment_element
.
appendChild
(
li_element
);
while
(
ul
.
firstChild
)
{
ul
.
removeChild
(
ul
.
firstChild
);
}
ul
.
appendChild
(
fragment_element
);
});
},
function
(
error
)
{
if
(
error
instanceof
Error
&&
error
.
hash
&&
...
...
@@ -415,7 +418,7 @@
}
throw
error
;
});
});
});
});
})
...
...
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