pixl-xyapp 2.1.25 → 2.1.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/js/page.js CHANGED
@@ -228,48 +228,7 @@ window.Page = class Page {
228
228
  }
229
229
 
230
230
  html += '<select multiple ' + compose_attribs(args) + '>';
231
- for (var idx = 0, len = opts.length; idx < len; idx++) {
232
- var item = opts[idx];
233
- var item_name = '';
234
- var item_value = '';
235
- var attribs = {};
236
-
237
- if (isa_hash(item)) {
238
- if (('label' in item) && ('data' in item)) {
239
- item_name = item.label;
240
- item_value = item.data;
241
- }
242
- else {
243
- item_name = item.title;
244
- item_value = item.id;
245
- }
246
- if (item.icon) attribs['data-icon'] = item.icon;
247
- if (item.abbrev) attribs['data-abbrev'] = item.abbrev;
248
- if (item.class) attribs['data-class'] = item.class;
249
- if (item.group) attribs['data-group'] = item.group;
250
- }
251
- else if (isa_array(item)) {
252
- item_value = item[0];
253
- item_name = item[1];
254
- }
255
- else {
256
- item_name = item_value = item;
257
- }
258
-
259
- attribs.value = item_value;
260
- if (find_in_array(values, item_value)) attribs.selected = 'selected';
261
- html += '<option ' + compose_attribs(attribs) + '>' + encode_entities(item_name) + '</option>';
262
- opt_values.push( item_value );
263
- } // foreach opt
264
-
265
- if (auto_add) {
266
- values.forEach( function(value) {
267
- if (!find_in_array(opt_values, value)) {
268
- html += '<option value="' + encode_attrib_entities(value) + '" selected="selected">' + encode_entities(value) + '</option>';
269
- }
270
- } );
271
- } // auto-add
272
-
231
+ html += render_menu_options( opts, values, auto_add );
273
232
  html += '</select>';
274
233
  return html;
275
234
  }
@@ -942,13 +901,13 @@ window.Page = class Page {
942
901
 
943
902
  app.api.post( 'user/resume_session', {}, function(resp) {
944
903
  if (resp.user) {
945
- Debug.trace("User Session Resume: " + resp.username);
904
+ Debug.trace('user', "User Session Resume: " + resp.username);
946
905
  Dialog.hideProgress();
947
906
  app.doUserLogin( resp );
948
907
  Nav.refresh();
949
908
  }
950
909
  else {
951
- Debug.trace("User cookie is invalid, redirecting to login page");
910
+ Debug.trace('user', "User cookie is invalid, redirecting to login page");
952
911
  app.setPref('username', '');
953
912
  setTimeout( function() { Nav.go('Login'); }, 1 );
954
913
  }
package/js/popover.js CHANGED
@@ -36,6 +36,11 @@ var Popover = {
36
36
  else {
37
37
  $box.css('top', '' + Math.floor( rect.bottom + 16 ) + 'px');
38
38
  $box.addClass('top');
39
+
40
+ if (rect.bottom + 16 + height > win.height) {
41
+ // off bottom of window, nudge back into bounds
42
+ $box.css('top', '' + Math.floor( (win.height - height) - 16 ) + 'px');
43
+ }
39
44
  }
40
45
 
41
46
  if (shrinkwrap) {
package/js/tools.js CHANGED
@@ -323,10 +323,13 @@ function pluralize(word, num) {
323
323
  else return word;
324
324
  }
325
325
 
326
- function render_menu_options(items, sel_value, auto_add) {
326
+ function render_menu_options(items, sel_values, auto_add) {
327
327
  // return HTML for menu options
328
328
  var html = '';
329
- var found = false;
329
+ var sel_map = {};
330
+
331
+ if (!sel_values) sel_values = [];
332
+ if (typeof(sel_values) == 'string') sel_values = [sel_values];
330
333
 
331
334
  for (var idx = 0, len = items.length; idx < len; idx++) {
332
335
  var item = items[idx];
@@ -337,8 +340,13 @@ function render_menu_options(items, sel_value, auto_add) {
337
340
  if (isa_hash(item)) {
338
341
  if (('label' in item) && ('items' in item)) {
339
342
  // optgroup, recurse for items within
343
+ var sub_items = deep_copy_object(item.items);
344
+ if (sub_items[0] && (typeof(sub_items[0]) == 'object')) {
345
+ sub_items[0].group = item.label;
346
+ }
347
+
340
348
  html += '<optgroup label="' + encode_attrib_entities(item.label) + '">';
341
- html += render_menu_options( item.items, sel_value, false );
349
+ html += render_menu_options( sub_items, sel_values, false );
342
350
  html += '</optgroup>';
343
351
  continue;
344
352
  }
@@ -351,6 +359,7 @@ function render_menu_options(items, sel_value, auto_add) {
351
359
  item_value = item.id;
352
360
  }
353
361
  if (item.icon) attribs['data-icon'] = item.icon;
362
+ if (item.abbrev) attribs['data-abbrev'] = item.abbrev;
354
363
  if (item.class) attribs['data-class'] = item.class;
355
364
  if (item.group) attribs['data-group'] = item.group;
356
365
  }
@@ -363,15 +372,19 @@ function render_menu_options(items, sel_value, auto_add) {
363
372
  }
364
373
 
365
374
  attribs.value = item_value;
366
- if (item_value == sel_value) attribs.selected = 'selected';
375
+ if (sel_values.includes(item_value)) {
376
+ attribs.selected = 'selected';
377
+ sel_map[item_value] = 1;
378
+ }
367
379
  html += '<option ' + compose_attribs(attribs) + '>' + encode_entities(item_name) + '</option>';
368
-
369
- if (item_value == sel_value) found = true;
370
380
  }
371
381
 
372
- if (!found && (str_value(sel_value) != '') && auto_add) {
373
- html += '<option value="' + encode_attrib_entities(sel_value) + '" selected="selected">' + encode_entities(sel_value) + '</option>';
374
- }
382
+ if (sel_values.length && auto_add) {
383
+ sel_values.forEach( function(sel_value) {
384
+ if (sel_map[sel_value]) return;
385
+ html += '<option value="' + encode_attrib_entities(sel_value) + '" selected="selected">' + encode_entities(sel_value) + '</option>';
386
+ } ); // foreach selected value
387
+ } // yes add
375
388
 
376
389
  return html;
377
390
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixl-xyapp",
3
- "version": "2.1.25",
3
+ "version": "2.1.27",
4
4
  "description": "Front-end web application and theme for xyOps.",
5
5
  "author": "Joseph Huckaby <jhuckaby@pixlcore.com>",
6
6
  "homepage": "https://github.com/pixlcore/pixl-xyapp",