Commit 8e270f17 authored by Romain Courteaud's avatar Romain Courteaud

Revert "[erp5_web_renderjs_ui] RelationField: drop JQM dependency"

This reverts commit 9916f6fd.
parent d75e0953
/*jslint indent: 2, maxerr: 3, nomen: true */ /*jslint indent: 2, maxerr: 3, nomen: true */
/*global window, rJS, RSVP, URI, loopEventListener, Handlebars, Event, document, /*global window, rJS, RSVP, document */
SimpleQuery, ComplexQuery, Query, QueryFactory, promiseEventListener*/ (function (window, rJS, RSVP, document) {
(function (window, rJS, RSVP, URI, loopEventListener, promiseEventListener, document,
SimpleQuery, ComplexQuery, Query, QueryFactory, Handlebars, Event) {
"use strict"; "use strict";
var gadget_klass = rJS(window),
single_input_source = gadget_klass.__template_element
.getElementById("single-input-template")
.innerHTML,
single_input_template = Handlebars.compile(single_input_source),
relation_listview_source = gadget_klass.__template_element
.getElementById("relation-listview-template")
.innerHTML,
relation_listview_template = Handlebars.compile(relation_listview_source),
multi_input_source = gadget_klass.__template_element
.getElementById("multi-input-template")
.innerHTML,
multi_input_template = Handlebars.compile(multi_input_source),
create_source = gadget_klass.__template_element
.getElementById("create-template")
.innerHTML,
create_template = Handlebars.compile(create_source),
searching = "ui-btn ui-corner-all ui-btn-icon-notext" +
" ui-input-clear ui-icon-spinner ui-icon-spin",
searched = "ui-hidden-accessible",
jump_on = "ui-btn ui-corner-all ui-btn-icon-notext " +
"ui-icon-plane ui-shadow-inset ui-btn-inline",
jump_off = "ui-btn ui-corner-all ui-btn-icon-notext " +
"ui-icon-plane ui-shadow-inset ui-btn-inline ui-disabled",
jump_add = "ui-btn ui-corner-all ui-btn-icon-notext " +
"ui-icon-plus ui-shadow-inset ui-btn-inline ui-disabled",
jump_unknown = "ui-btn ui-corner-all ui-btn-icon-notext " +
"ui-icon-warning ui-shadow-inset ui-btn-inline ui-disabled";
function listenToInput(gadget, index) {
var props = gadget.props,
div = gadget.props.element.querySelectorAll('.single_input')[index],
input = div.querySelector('input'),
search_query,
simple_query,
plane = div.querySelector('.ui-btn'),
field_json = props.field_json,
spinner = div.querySelector('.ui-hidden-accessible'),
create_div = div.querySelector(".ui-tag-list"),
ul = div.querySelector(".search_ul");
function generateList(event) {
var catalog_index = field_json.catalog_index,
begin_from = props.begin_from || 0,
lines = field_json.lines || 10,
my_value = event.target.value;
ul.innerHTML = "";
create_div.innerHTML = "";
plane.className = jump_off;
props.jump_url[index] = "";
if (my_value === "") {
spinner.className = searched;
return;
}
simple_query = new SimpleQuery({
key: catalog_index,
value: my_value
});
spinner.className = searching;
search_query = Query.objectToSearchText(new ComplexQuery({
operator: "AND",
query_list: [gadget.props.query, simple_query]
}));
return new RSVP.Queue()
.push(function () {
return gadget.jio_allDocs({
"query": search_query,
"limit": [begin_from, begin_from + lines],
"select_list": [catalog_index]
});
})
.push(function (result) {
var list = [],
i,
type = field_json.allow_creation ? field_json.portal_types : [],
html;
for (i = 0; i < result.data.rows.length; i += 1) {
list.push({
id: result.data.rows[i].id,
value: result.data.rows[i].value[catalog_index]
});
}
spinner.className = searched;
html = relation_listview_template({
list: list,
type: type,
value: my_value
});
ul.innerHTML = html;
});
}
function setSelectedElement(event) {
var element = event.target,
jump_url = element.getAttribute("data-relative-url"),
create_object_type = element.getAttribute("data-create-object"),
explore = element.getAttribute("data-explore"),
tmp;
ul.innerHTML = "";
if (index === gadget.props.last_index - 1 && !explore) {
props.jump_url[gadget.props.last_index] = "";
tmp = document.createElement("fieldset");
tmp.innerHTML = single_input_template();
gadget.props.container.appendChild(tmp);
gadget.props.input_list.push({
"title": field_json.key,
"name": field_json.key,
"value": "",
"href": "",
"create_object": ""
});
gadget.props.last_index += 1;
gadget.props.element.dispatchEvent(new Event('add_relation_input'));
}
if (jump_url) {
props.jump_url[index] = jump_url;
input.value = element.textContent;
return gadget.getUrlFor({
command: 'index',
options: {
jio_key: jump_url
}
}).push(function (url) {
if (field_json.allow_jump) {
plane.href = url;
plane.className = jump_on;
}
});
}
if (create_object_type) {
input.setAttribute("data-create-object", create_object_type);
plane.className = jump_add;
create_div.innerHTML = create_template({'text': create_object_type});
return;
}
if (explore) {
return gadget.getFormContent({
format: "json"
})
.push(function (content) {
return gadget.redirect({
command: 'index',
options: {
page: "relation_search",
url: gadget.props.field_json.url,
extended_search: Query.objectToSearchText(simple_query),
view: gadget.props.field_json.view,
back_field: gadget.props.field_json.key,
target_index: index
},
form_content: content
});
});
}
plane.className = jump_unknown;
}
return RSVP.all([
loopEventListener(input, 'input', false, generateList),
loopEventListener(input, 'blur', false, function () {
return new RSVP.Queue()
.push(function () {
return RSVP.any([
RSVP.delay(200),
promiseEventListener(ul, "click", true)
]);
})
.push(function (event) {
var tmp;
if (event) {
return setSelectedElement(event);
}
if (ul.innerHTML) {
ul.innerHTML = "";
plane.className = jump_unknown;
if (index === gadget.props.last_index - 1) {
props.jump_url[gadget.props.last_index] = "";
tmp = document.createElement("fieldset");
tmp.innerHTML = single_input_template();
gadget.props.container.appendChild(tmp);
gadget.props.input_list.push({
"title": field_json.key,
"name": field_json.key,
"value": "",
"href": "",
"create_object": ""
});
gadget.props.last_index += 1;
gadget.props.element.dispatchEvent(new Event('add_relation_input'));
}
}
});
})]
);
}
rJS(window) rJS(window)
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
...@@ -225,17 +16,35 @@ ...@@ -225,17 +16,35 @@
gadget.props.element = element; gadget.props.element = element;
}); });
}) })
.allowPublicAcquisition("addRelationInput", function () {
///////////////////////////////////////////////////////////////// var fieldset = document.createElement("fieldset"),
// acquired methods gadget = this,
///////////////////////////////////////////////////////////////// container = gadget.props.element.querySelector('.container');
.declareAcquiredMethod("notifyInvalid", "notifyInvalid") return gadget.declareGadget('gadget_erp5_relation_input.html', {
.declareAcquiredMethod("notifyChange", "notifyChange") element: fieldset
.declareAcquiredMethod("jio_allDocs", "jio_allDocs") })
.declareAcquiredMethod("translateHtml", "translateHtml") .push(function (relation_input) {
.declareAcquiredMethod("getUrlFor", "getUrlFor") var field_json = gadget.props.field_json,
.declareAcquiredMethod("redirect", "redirect") index;
.declareAcquiredMethod("getFormContent", "getFormContent") if (field_json.default.value) {
index = field_json.default.relation_item_relative_url.length;
field_json.default.relation_item_relative_url.push('');
field_json.default.value.push('');
} else {
index = field_json.relation_item_relative_url.length;
field_json.relation_item_relative_url.push('');
field_json.default.push('');
}
gadget.props.gadget_list.push(relation_input);
return relation_input.render({field_json: gadget.props.field_json}, {
index: index,
addRelationInput: true
});
})
.push(function () {
container.appendChild(fieldset);
});
})
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// declared methods // declared methods
...@@ -243,172 +52,91 @@ ...@@ -243,172 +52,91 @@
.declareMethod('render', function (options) { .declareMethod('render', function (options) {
var gadget = this, var gadget = this,
i, i,
field_json = options.field_json || {},
target_url_list = [],
list = [], list = [],
input = [], fieldset,
create_object, container = gadget.props.element.querySelector('.container'),
unknown, field_json = options.field_json || {},
uid, relation_item_relative_url;
relation_item_relative_url, gadget.props.field_json = field_json;
value_list; if (field_json.default.value) {
if (field_json.default.format === "json") { if (field_json.default.relation_item_relative_url[field_json.default.relation_item_relative_url.length - 1]) {
create_object = field_json.default.create_object || []; //return form listbox
unknown = field_json.default.jump_unknown || []; field_json.default.value.push("");
uid = field_json.default.uid; field_json.default.relation_item_relative_url.push("");
}
relation_item_relative_url = field_json.default.relation_item_relative_url; relation_item_relative_url = field_json.default.relation_item_relative_url;
value_list = field_json.default.value || [];
} else { } else {
create_object = field_json.create_object || []; field_json.relation_item_relative_url.push('');
unknown = field_json.jump_unknown || []; field_json.default.push('');
uid = field_json.uid;
relation_item_relative_url = field_json.relation_item_relative_url; relation_item_relative_url = field_json.relation_item_relative_url;
value_list = field_json.default || [];
} }
if (relation_item_relative_url) { for (i = 0; i < relation_item_relative_url.length; i += 1) {
target_url_list = relation_item_relative_url; fieldset = document.createElement("fieldset");
container.appendChild(fieldset);
list.push(gadget.declareGadget('gadget_erp5_relation_input.html', {
element: fieldset
}));
} }
gadget.props.field_json = field_json;
gadget.props.jump_url = [];
gadget.props.query = QueryFactory.create(new URI(field_json.query).query(true).query);
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
for (i = 0; i < value_list.length; i += 1) { return RSVP.all(list);
if (!value_list[i]) {
if (uid) {
return gadget.jio_allDocs({
query: Query.objectToSearchText(new SimpleQuery({
key: "catalog.uid",
value: uid
})),
limit: [0, 1],
select_list: [field_json.catalog_index]
});
}
}
}
}) })
.push(function (result) { .push(function (gadget_list) {
var non_empty_input = true;
list = []; list = [];
if (result) { gadget.props.gadget_list = gadget_list;
value_list[i] = result.data.rows[0].value[field_json.catalog_index]; for (i = 0; i < gadget_list.length; i += 1) {
} list.push(gadget_list[i].render(options, {
for (i = 0; i < target_url_list.length; i += 1) { index: i,
if (target_url_list[i]) { addRelationInput: (i === gadget_list.length - 1)
gadget.props.jump_url.push(target_url_list[i]); }));
list.push(gadget.getUrlFor({
command: 'index',
options: {
jio_key: target_url_list[i]
}
}));
} else {
if (!create_object[i]) {
//non jump url nor create onject
non_empty_input = false;
}
gadget.props.jump_url.push("");
list.push("");
}
}
if (non_empty_input) {
value_list.push("");
list.push("");
gadget.props.jump_url.push("");
} }
return RSVP.all(list); return RSVP.all(list);
})
.push(function (href_list) {
for (i = 0; i < value_list.length; i += 1) {
input.push({
"create_object": create_object[i],
"title": field_json.key,
"name": field_json.key,
"value": value_list[i],
"href": href_list[i],
"jump_unknown": unknown[i],
"error_text": field_json.error_text
});
}
gadget.props.input_list = input;
gadget.props.default_index = input.length;
gadget.props.last_index = input.length;
return gadget.translateHtml(multi_input_template({
input: input,
allow_jump: field_json.allow_jump,
readonly: field_json.editable ? "" : "ui-state-readonly"
}));
})
.push(function (html) {
gadget.props.element.innerHTML = html;
gadget.props.container = gadget.props.element.querySelector(".container");
}); });
}) })
.declareMethod('getContent', function (options) { .declareMethod('getContent', function (options) {
var list = this.props.element.querySelectorAll('.single_input'), var list = [],
result = {},
i, i,
input,
value_list = [],
plane,
tmp = {},
field_json = this.props.field_json;
if (options.format === "erp5") {
for (i = 0; i < list.length - 1; i += 1) {
plane = list[i].querySelector('.ui-btn');
input = list[i].querySelector('input');
if (plane.className === jump_add) {
result[field_json.relation_field_id + "_" + i] = "_newContent_" + input.getAttribute("data-create-object");
}
value_list.push(input.value);
}
result[field_json.key] = value_list;
return result;
}
tmp.format = "json";
tmp.value = [];
tmp.create_object = [];
tmp.jump_unknown = [];
for (i = 0; i < list.length; i += 1) {
plane = list[i].querySelector('.ui-btn');
input = list[i].querySelector('input');
tmp.value[i] = input.value;
tmp.jump_unknown[i] = "";
tmp.create_object[i] = "";
if (plane.className === jump_add) {
tmp.create_object[i] = input.getAttribute("data-create-object");
} else {
if (plane.className === jump_unknown) {
tmp.jump_unknown[i] = true;
}
}
}
tmp.relation_item_relative_url = this.props.jump_url;
result[field_json.key] = tmp;
return result;
})
.declareService(function () {
var i,
gadget = this, gadget = this,
list = []; length = gadget.props.gadget_list.length;
if (options.format === 'erp5') {
for (i = 0; i < gadget.props.last_index; i += 1) { length -= 1;
list.push(listenToInput(gadget, i));
} }
return RSVP.all(list); for (i = 0; i < length; i += 1) {
}) list.push(gadget.props.gadget_list[i].getContent(options, {"type": "MultiRelationField"}));
.declareService(function () { }
var gadget = this; return new RSVP.Queue()
return loopEventListener(gadget.props.element, 'add_relation_input', false, function () { .push(function () {
var list = [], return RSVP.all(list);
i; })
for (i = gadget.props.default_index; i < gadget.props.last_index; i += 1) { .push(function (result) {
list.push(listenToInput(gadget, i)); var tmp = {},
} key,
return RSVP.all(list); key1;
}); for (i = 0; i < result.length; i += 1) {
for (key in result[i]) {
if (result[i].hasOwnProperty(key)) {
if (options.format === 'erp5') {
if (tmp[key] === undefined) {
tmp[key] = [];
}
tmp[key].push(result[i][key]);
} else {
if (tmp[key] === undefined) {
tmp[key] = {};
}
for (key1 in result[i][key]) {
if (result[i][key].hasOwnProperty(key1)) {
if (tmp[key][key1] === undefined) {
tmp[key][key1] = [];
}
tmp[key][key1].push(result[i][key][key1][0]);
}
}
}
}
}
}
return tmp;
});
}); });
}(window, rJS, RSVP, URI, loopEventListener, promiseEventListener, document, }(window, rJS, RSVP, document));
SimpleQuery, ComplexQuery, Query, QueryFactory, Handlebars, Event)); \ No newline at end of file
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>952.22772.44488.1757</string> </value> <value> <string>952.33012.29157.25361</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1467710697.76</float> <float>1468331865.64</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*jslint indent: 2, maxerr: 3, nomen: true */ /*jslint indent: 2, maxerr: 3, nomen: true */
/*global window, rJS, RSVP, URI, loopEventListener, Handlebars, /*global window, rJS */
SimpleQuery, ComplexQuery, Query, QueryFactory, promiseEventListener*/ (function (window, rJS) {
(function (window, rJS, RSVP, URI, loopEventListener, promiseEventListener,
SimpleQuery, ComplexQuery, Query, QueryFactory, Handlebars) {
"use strict"; "use strict";
var gadget_klass = rJS(window),
relation_input_source = gadget_klass.__template_element
.getElementById("relation-input-template")
.innerHTML,
relation_input_template = Handlebars.compile(relation_input_source),
relation_listview_source = gadget_klass.__template_element
.getElementById("relation-listview-template")
.innerHTML,
relation_listview_template = Handlebars.compile(relation_listview_source),
create_source = gadget_klass.__template_element
.getElementById("create-template")
.innerHTML,
create_template = Handlebars.compile(create_source),
searching = "ui-btn ui-corner-all ui-btn-icon-notext" +
" ui-input-clear ui-icon-spinner ui-icon-spin",
searched = "ui-hidden-accessible",
jump_on = "ui-btn ui-corner-all ui-btn-icon-notext " +
"ui-icon-plane ui-shadow-inset ui-btn-inline",
jump_off = "ui-btn ui-corner-all ui-btn-icon-notext " +
"ui-icon-plane ui-shadow-inset ui-btn-inline ui-disabled",
jump_add = "ui-btn ui-corner-all ui-btn-icon-notext " +
"ui-icon-plus ui-shadow-inset ui-btn-inline ui-disabled",
jump_unknown = "ui-btn ui-corner-all ui-btn-icon-notext " +
"ui-icon-warning ui-shadow-inset ui-btn-inline ui-disabled";
rJS(window) rJS(window)
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
...@@ -46,305 +15,25 @@ ...@@ -46,305 +15,25 @@
return my_gadget.getElement() return my_gadget.getElement()
.push(function (element) { .push(function (element) {
my_gadget.props.element = element; my_gadget.props.element = element;
return my_gadget.getDeclaredGadget("relation_input");
})
.push(function (relation_input_gadget) {
my_gadget.props.relation_input_gadget = relation_input_gadget;
}); });
}) })
.allowPublicAcquisition("addRelationInput", function () {
///////////////////////////////////////////////////////////////// return;
// acquired methods })
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("notifyInvalid", "notifyInvalid")
.declareAcquiredMethod("notifyChange", "notifyChange")
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("getFormContent", "getFormContent")
.declareAcquiredMethod("translateHtml", "translateHtml")
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// declared methods // declared methods
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
.declareMethod('render', function (options) { .declareMethod('render', function (options) {
var gadget = this, return this.props.relation_input_gadget.render(options, {
field_json = options.field_json || {}, index: 0
target_url, });
queue = new RSVP.Queue(),
create_object,
unknown,
relation_item_relative_url,
uid,
value = "";
if (field_json.default.format === "json") {
//load non saved value
create_object = field_json.default.create_object;
unknown = field_json.default.jump_unknown;
relation_item_relative_url = field_json.default.relation_item_relative_url;
uid = field_json.default.uid;
value = field_json.default.value[0] || "";
} else {
create_object = field_json.create_object;
unknown = field_json.jump_unknown;
relation_item_relative_url = field_json.relation_item_relative_url;
uid = field_json.uid;
value = field_json.default[0] || "";
}
gadget.props.jump_url = relation_item_relative_url;
if (relation_item_relative_url) {
target_url = relation_item_relative_url[0];
}
gadget.props.field_json = field_json;
gadget.props.query = QueryFactory.create(new URI(field_json.query).query(true).query);
if (!value && target_url && uid) {
//return from listbox
queue
.push(function () {
return gadget.jio_allDocs({
"query": Query.objectToSearchText(new SimpleQuery({
key: "catalog.uid",
value: uid,
limit: [0, 1]
})),
"select_list": [field_json.catalog_index]
});
})
.push(function (result) {
value = result.data.rows[0].value[field_json.catalog_index];
});
}
if (target_url) {
queue
.push(function () {
return gadget.getUrlFor({
command: 'index',
options: {
jio_key: target_url
}
});
});
}
queue
.push(function (href) {
return gadget.translateHtml(relation_input_template({
href: href,
readonly: field_json.editable ? "" : "ui-state-readonly",
required: field_json.required ? "required" : "",
value: value,
title: field_json.title,
name: field_json.key,
create_object: create_object,
allow_jump: field_json.allow_jump ? true : undefined,
error_text: field_json.error_text,
jump_unknown: unknown
}));
})
.push(function (html) {
gadget.props.element.innerHTML = html;
gadget.props.input =
gadget.props.element.querySelector("input");
gadget.props.new_tag_div = gadget.props.element.querySelector(".new_tag");
gadget.props.spinner = gadget.props.element.querySelector("a");
gadget.props.plane = gadget.props.element.querySelectorAll("a")[1];
});
return queue;
}) })
.declareMethod('getContent', function (options) { .declareMethod('getContent', function (options) {
var element = this.props.element.querySelector('input'), return this.props.relation_input_gadget.getContent(options);
result = {},
tmp = {},
field_json = this.props.field_json;
if (options.format === "erp5") {
if (this.props.plane.className === jump_add) {
result[field_json.relation_field_id] = "_newContent_" + this.props.create_object_type;
}
result[element.getAttribute('name')] = element.value;
return result;
}
tmp.format = "json";
tmp.value = [element.value];
if (this.props.plane.className === jump_add) {
tmp.create_object = this.props.create_object_type;
} else {
if (this.props.plane.className === jump_unknown) {
tmp.jump_unknown = true;
} else {
tmp.relation_item_relative_url = this.props.jump_url;
}
}
result[element.getAttribute('name')] = tmp;
return result;
})
/////////////////////////////////////////////////////////////////
// declared services
/////////////////////////////////////////////////////////////////
.declareService(function () {
var gadget = this,
props = gadget.props,
input = gadget.props.element.querySelector('input'),
search_query,
simple_query,
field_json = props.field_json,
create_div = props.element.querySelector(".ui-tag-list"),
ul = gadget.props.element.querySelector(".search_ul");
function generateList(event) {
var index = field_json.catalog_index,
begin_from = props.begin_from || 0,
lines = field_json.lines || 10,
my_value = event.target.value;
ul.innerHTML = "";
create_div.innerHTML = "";
props.plane.className = jump_off;
props.jump_url = [];
if (my_value === "") {
props.spinner.className = searched;
return;
}
simple_query = new SimpleQuery({
key: index,
value: my_value
});
props.spinner.className = searching;
search_query = Query.objectToSearchText(new ComplexQuery({
operator: "AND",
query_list: [gadget.props.query, simple_query]
}));
return new RSVP.Queue()
.push(function () {
return gadget.jio_allDocs({
"query": search_query,
"limit": [begin_from, begin_from + lines],
"select_list": [index]
});
})
.push(function (result) {
var list = [],
i,
type = field_json.allow_creation ? field_json.portal_types : [],
html;
for (i = 0; i < result.data.rows.length; i += 1) {
list.push({
id: result.data.rows[i].id,
value: result.data.rows[i].value[index]
});
}
props.spinner.className = searched;
html = relation_listview_template({
list: list,
type: type,
value: my_value
});
ul.innerHTML = html;
});
}
function setSelectedElement(event) {
var element = event.target,
jump_url = element.getAttribute("data-relative-url"),
create_object_type = element.getAttribute("data-create-object"),
explore = element.getAttribute("data-explore");
ul.innerHTML = "";
if (jump_url) {
props.input.value = element.textContent;
props.jump_url = [jump_url];
return gadget.getUrlFor({
command: 'index',
options: {
jio_key: jump_url
}
}).push(function (url) {
if (field_json.allow_jump) {
props.plane.href = url;
props.plane.className = jump_on;
}
});
}
if (create_object_type) {
gadget.props.create_object_type = create_object_type;
props.plane.className = jump_add;
create_div.innerHTML = create_template({'text': create_object_type});
return;
}
if (explore) {
return gadget.getFormContent({
format: "json"
})
.push(function (content) {
return gadget.redirect({
command: 'index',
options: {
page: "relation_search",
url: gadget.props.field_json.url,
extended_search: Query.objectToSearchText(simple_query),
view: gadget.props.field_json.view,
back_field: gadget.props.field_json.key,
target_index: 0
},
form_content: content
});
});
}
props.plane.className = jump_unknown;
}
return RSVP.all([
loopEventListener(input, 'input', false, generateList),
loopEventListener(input, 'blur', false, function () {
return new RSVP.Queue()
.push(function () {
return RSVP.any([
RSVP.delay(200),
promiseEventListener(ul, "click", true)
]);
})
.push(function (event) {
if (event) {
return setSelectedElement(event);
}
if (ul.innerHTML) {
ul.innerHTML = "";
props.plane.className = jump_unknown;
}
});
})]
);
})
.declareService(function () {
var gadget = this;
function notifyInvalid(evt) {
return gadget.notifyInvalid(evt.target.validationMessage);
}
// Listen to input change
return loopEventListener(
gadget.props.element.querySelector('input'),
'invalid',
false,
notifyInvalid
);
})
.declareService(function () {
////////////////////////////////////
// Check field validity when the value changes
////////////////////////////////////
var gadget = this;
function notifyChange() {
return gadget.notifyChange();
}
return loopEventListener(
gadget.props.element.querySelector('input'),
'change',
false,
notifyChange
);
}); });
}(window, rJS, RSVP, URI, loopEventListener, promiseEventListener, }(window, rJS));
SimpleQuery, ComplexQuery, Query, QueryFactory, Handlebars)); \ No newline at end of file
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>952.22746.50500.24354</string> </value> <value> <string>952.33013.17443.54510</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1467710574.65</float> <float>1468331859.64</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
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