Commit aade398e authored by Tristan Cavelier's avatar Tristan Cavelier

RELATIONERROR [erp5_web_renderjs_ui] jslint rjs_gadget_erp5_relation_input_js

parent 4c53cf66
...@@ -310,95 +310,98 @@ ...@@ -310,95 +310,98 @@
}) })
.push(function () { .push(function () {
translation_promise = gadget.getTranslationList([ translation_promise = gadget.getTranslationList([
'Create New', 'Create New',
'Explore the Search Result List' 'Explore the Search Result List'
]); ]);
return gadget.jio_allDocs({ return gadget.jio_allDocs({
query: Query.objectToSearchText(new ComplexQuery({ query: Query.objectToSearchText(new ComplexQuery({
operator: "AND", operator: "AND",
query_list: [ query_list: [
QueryFactory.create( QueryFactory.create(
new URI(gadget.state.query).query(true).query new URI(gadget.state.query).query(true).query
), ),
new SimpleQuery({ new SimpleQuery({
key: gadget.state.catalog_index, key: gadget.state.catalog_index,
value: value_text value: value_text
}) })
] ]
})), })),
limit: [0, 10], limit: [0, 10],
select_list: [gadget.state.catalog_index, "uid"], select_list: [gadget.state.catalog_index, "uid"],
sort_on: JSON.parse(gadget.state.sort_list_json) sort_on: JSON.parse(gadget.state.sort_list_json)
}) })
.push(function (result) { .push(function (result) {
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return RSVP.all([result, translation_promise]); return RSVP.all([result, translation_promise]);
}) })
.push(function (result_list) { .push(function (result_list) {
var i, var i,
row, row,
portal_type_list, portal_type_list,
translated_portal_type_list, translated_portal_type_list,
fragment_element = document.createDocumentFragment(), fragment_element = document.createDocumentFragment(),
li_element; 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}}" // <li class="ui-icon-sign-in ui-btn-icon-right" data-relative-url="{{id}}"
// data-uid="{{uid}}">{{value}}</li> // data-uid="{{uid}}">{{value}}</li>
for (i = 0; i < result_list[0].data.rows.length; i += 1) { for (i = 0; i < result_list[0].data.rows.length; i += 1) {
row = result_list[0].data.rows[i]; row = result_list[0].data.rows[i];
li_element = document.createElement('li'); li_element = document.createElement('li');
li_element.setAttribute('class', li_element.setAttribute('class',
'ui-icon-sign-in ui-btn-icon-right'); 'ui-icon-sign-in ui-btn-icon-right');
li_element.setAttribute('data-relative-url', row.id); li_element.setAttribute('data-relative-url', row.id);
li_element.setAttribute('data-uid', row.value.uid); li_element.setAttribute('data-uid', row.value.uid);
li_element.textContent = row.value[gadget.state.catalog_index]; li_element.textContent =
fragment_element.appendChild(li_element); row.value[gadget.state.catalog_index];
} fragment_element.appendChild(li_element);
}
// New documents
// New documents
// <li class="ui-icon-plus ui-btn-icon-right" data-i18n="Create New" // <li class="ui-icon-plus ui-btn-icon-right" data-i18n="Create New"
// data-create-object="{{value}}" name="{{name}}">Create New // data-create-object="{{value}}" name="{{name}}">Create New
// <span> {{name}}: {{../value}}</span></li> // <span> {{name}}: {{../value}}</span></li>
if (gadget.state.allow_creation) { if (gadget.state.allow_creation) {
portal_type_list = JSON.parse(gadget.state.portal_types); portal_type_list =
translated_portal_type_list = JSON.parse(gadget.state.portal_types);
JSON.parse(gadget.state.translated_portal_types); translated_portal_type_list =
for (i = 0; i < portal_type_list.length; i += 1) { JSON.parse(gadget.state.translated_portal_types);
li_element = document.createElement('li'); for (i = 0; i < portal_type_list.length; i += 1) {
li_element.setAttribute('class', li_element = document.createElement('li');
'ui-icon-plus ui-btn-icon-right'); li_element.setAttribute('class',
li_element.setAttribute('data-create-object', 'ui-icon-plus ui-btn-icon-right');
portal_type_list[i]); li_element.setAttribute('data-create-object',
li_element.setAttribute('name', portal_type_list[i]);
translated_portal_type_list[i]); li_element.setAttribute('name',
li_element.textContent = translated_portal_type_list[i]);
result_list[1][0] + ' ' + translated_portal_type_list[i] + li_element.textContent =
': ' + value_text; result_list[1][0] + ' ' +
fragment_element.appendChild(li_element); translated_portal_type_list[i] +
} ': ' + value_text;
} fragment_element.appendChild(li_element);
}
// Explore }
// Explore
// <li class="ui-icon-search ui-btn-icon-right" data-explore=true // <li class="ui-icon-search ui-btn-icon-right" data-explore=true
// data-i18n="Explore the Search Result List" ></li> // data-i18n="Explore the Search Result List" ></li>
li_element = document.createElement('li'); li_element = document.createElement('li');
li_element.setAttribute('class', li_element.setAttribute('class',
'ui-icon-search ui-btn-icon-right'); 'ui-icon-search ui-btn-icon-right');
li_element.setAttribute('data-explore', li_element.setAttribute('data-explore',
true); true);
li_element.textContent = result_list[1][1]; li_element.textContent = result_list[1][1];
fragment_element.appendChild(li_element); fragment_element.appendChild(li_element);
while (ul.firstChild) { while (ul.firstChild) {
ul.removeChild(ul.firstChild); ul.removeChild(ul.firstChild);
} }
ul.appendChild(fragment_element); ul.appendChild(fragment_element);
}); });
}, function (error) { }, function (error) {
if (error && error.hash && if (error && error.hash &&
error.hash.expected && error.hash.expected &&
...@@ -408,7 +411,7 @@ ...@@ -408,7 +411,7 @@
} }
throw error; throw error;
}); });
}); });
}); });
}) })
......
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