card 1.93.5 → 1.93.6

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.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/db/migrate_core_cards/data/1.12_stylesheets/classic_cards.scss +1 -1
  4. data/db/migrate_core_cards/data/1.12_stylesheets/traditional.scss +2 -1
  5. data/lib/card/format/nest.rb +4 -1
  6. data/lib/card/format/nest/mode.rb +11 -3
  7. data/lib/card/query.rb +6 -2
  8. data/lib/card/query/sorting.rb +21 -12
  9. data/lib/card/query/sql_statement.rb +1 -2
  10. data/lib/card/view/options.rb +17 -12
  11. data/mod/Modfile +1 -0
  12. data/mod/core/layout/simple_modal.html +3 -0
  13. data/mod/core/set/all/fetch_helper.rb +42 -30
  14. data/mod/core/spec/format/html_format_spec.rb +10 -17
  15. data/mod/core/spec/set/all/fetch_helper_spec.rb +48 -0
  16. data/mod/machines/file/all_script_machine_output/file.js +132 -18
  17. data/mod/machines/lib/javascript/decko.js.coffee +11 -2
  18. data/mod/machines/lib/javascript/decko_filter.js.coffee +116 -9
  19. data/mod/machines/lib/stylesheets/style_cards.scss +24 -3
  20. data/mod/pointer/lib/javascript/script_pointer_config.js.coffee +16 -6
  21. data/mod/pointer/set/abstract/00_paging_params.rb +17 -4
  22. data/mod/pointer/set/abstract/02_pointer/filtered.rb +48 -0
  23. data/mod/pointer/set/self/input_options.rb +1 -0
  24. data/mod/pointer/spec/set/self/input_options_spec.rb +1 -1
  25. data/mod/pointer/template/abstract/02_pointer/filtered/filter_items.haml +34 -0
  26. data/mod/pointer/template/abstract/02_pointer/filtered/filtered_list_input.haml +30 -0
  27. data/mod/search/lib/card/filter_query.rb +81 -0
  28. data/mod/search/set/abstract/00_filter_helper.rb +51 -0
  29. data/mod/search/set/abstract/01_filter_form_helper.rb +77 -0
  30. data/mod/search/set/abstract/01_search_params.rb +3 -11
  31. data/mod/search/set/abstract/02_filter_formgroups.rb +134 -0
  32. data/mod/search/set/abstract/03_filter.rb +117 -0
  33. data/mod/search/set/abstract/04_right_filter_form.rb +23 -0
  34. data/mod/search/set/abstract/search.rb +44 -10
  35. data/mod/search/set/abstract/wql_search.rb +22 -18
  36. data/mod/search/spec/set/{all → abstract}/filter_spec.rb +6 -5
  37. data/mod/search/template/{all/filter → abstract/03_filter}/_filter_input.haml +0 -0
  38. data/mod/search/template/{all/filter → abstract/03_filter}/filter_form.haml +9 -7
  39. data/mod/search/template/abstract/search/checkbox_item.haml +7 -0
  40. data/mod/search/template/abstract/search/select_item.haml +14 -0
  41. data/mod/standard/set/all/rich_html/editing.rb +4 -4
  42. data/mod/standard/set/all/rich_html/form_elements.rb +11 -2
  43. data/mod/standard/set/all/rich_html/modal.rb +26 -19
  44. data/mod/standard/set/all/rich_html/new.rb +8 -2
  45. data/mod/standard/set/all/rich_html/wrapper.rb +22 -18
  46. data/mod/standard/set/type/cardtype.rb +2 -2
  47. data/mod/standard/spec/set/all/rich_html/editing_spec.rb +0 -1
  48. data/mod/utility/set/abstract/utility.rb +13 -0
  49. data/mod/utility/spec/set/abstract/utility_spec.rb +16 -0
  50. metadata +21 -7
  51. data/mod/search/set/all/filter.rb +0 -9
@@ -6,7 +6,7 @@ return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeTyp
6
6
 
7
7
  //script: slot
8
8
  (function() {
9
- var addCaptcha, addCategoryOption, containerClass, detectMobileBrowser, doubleSidebar, filterAndSort, filterCategorySelected, hideFilterInputField, initCaptcha, navbox_results, navbox_select, navboxize, removeCategoryOption, reqIndex, setFilterInputWidth, showFilterInputField, sidebarToggle, singleSidebar, snakeCase, toggleButton, warn, wrapDeckoLayout, wrapSidebarToggle;
9
+ var addCaptcha, addCategoryOption, addSelectedButton, addSelectedButtonUrl, containerClass, deSelectAllLink, detectMobileBrowser, doubleSidebar, filterAndSort, filterBox, filterCategorySelected, hideFilterInputField, initCaptcha, navbox_results, navbox_select, navboxize, newFilteredListContent, removeCategoryOption, reqIndex, savedIds, selectFilteredItem, selectedBin, selectedData, selectedIds, selectedNames, setFilterInputWidth, showFilterInputField, sidebarToggle, singleSidebar, snakeCase, toggleButton, trackSelectedIds, updateFilterAfterSelection, warn, wrapDeckoLayout, wrapSidebarToggle;
10
10
 
11
11
  window.decko || (window.decko = {});
12
12
 
@@ -37,6 +37,9 @@ return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeTyp
37
37
  return item.find('input').val('');
38
38
  }
39
39
  });
40
+ $('body').on('click', '._filtered-list-item-delete', function() {
41
+ return $(this).closest('li').remove();
42
+ });
40
43
  $('body').on('show.bs.tab', 'a.load[data-toggle=tab][data-url]', function(e) {
41
44
  var tab_id, url;
42
45
  tab_id = $(e.target).attr('href');
@@ -514,17 +517,17 @@ return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeTyp
514
517
  });
515
518
 
516
519
  $(window).ready(function() {
517
- $('body').on("change", "._filter-input input, ._filter-input select, ._filter-sort", function() {
520
+ $("body").on("change", "._filter-input input, ._filter-input select, ._filter-sort", function() {
518
521
  return filterAndSort(this);
519
522
  });
520
- $('body').on("click", "._filter-category-select", function() {
523
+ $("body").on("click", "._filter-category-select", function() {
521
524
  var addFilterDropdown, category, label;
522
525
  addFilterDropdown = $(this).closest("._add-filter-dropdown");
523
526
  category = $(this).data("category");
524
527
  label = $(this).data("label");
525
528
  return filterCategorySelected(addFilterDropdown, category, label);
526
529
  });
527
- return $('body').on("click", "._delete-filter-input", function() {
530
+ $("body").on("click", "._delete-filter-input", function() {
528
531
  var category, form, input;
529
532
  form = $(this).closest("._filter-form");
530
533
  input = $(this).closest("._filter-input");
@@ -533,8 +536,118 @@ return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeTyp
533
536
  hideFilterInputField(input);
534
537
  return form.submit();
535
538
  });
539
+ $("body").on("click", "._filter-items ._unselected ._search-checkbox-item input", function() {
540
+ selectFilteredItem($(this));
541
+ return updateFilterAfterSelection($(this));
542
+ });
543
+ $("body").on("click", "._filter-items ._selected ._search-checkbox-item input", function() {
544
+ var bin;
545
+ bin = selectedBin($(this));
546
+ $(this).slot().remove();
547
+ return updateFilterAfterSelection(bin);
548
+ });
549
+ $("body").on("click", "._filter-items ._add-selected", function() {
550
+ var btn, content;
551
+ btn = $(this);
552
+ content = newFilteredListContent(btn);
553
+ return btn.attr("href", addSelectedButtonUrl(btn, content));
554
+ });
555
+ $("body").on("click", "._select-all", function() {
556
+ filterBox($(this)).find("._unselected ._search-checkbox-item input").each(function() {
557
+ return selectFilteredItem($(this));
558
+ });
559
+ return updateFilterAfterSelection($(this));
560
+ });
561
+ return $("body").on("click", "._deselect-all", function() {
562
+ var bin;
563
+ bin = selectedBin($(this));
564
+ filterBox($(this)).find("._selected ._search-checkbox-item input").each(function() {
565
+ return $(this).slot().remove();
566
+ });
567
+ return updateFilterAfterSelection(bin);
568
+ });
536
569
  });
537
570
 
571
+ newFilteredListContent = function(el) {
572
+ var newContent, oldContent;
573
+ oldContent = el.slot().find(".d0-card-content").val();
574
+ newContent = decko.pointerContent(selectedNames(el));
575
+ if (!oldContent) {
576
+ return newContent;
577
+ }
578
+ return oldContent + "\n" + newContent;
579
+ };
580
+
581
+ addSelectedButtonUrl = function(btn, content) {
582
+ var query, url_base, view;
583
+ view = btn.slot().data("slot")["view"];
584
+ query = {
585
+ "card[content]": content,
586
+ "assign": true,
587
+ "view": view
588
+ };
589
+ url_base = btn.attr("href") + "?" + $.param(query);
590
+ return decko.prepUrl(url_base, btn.slot());
591
+ };
592
+
593
+ updateFilterAfterSelection = function(el) {
594
+ trackSelectedIds(el);
595
+ return filterAndSort(filterBox(el).find("._filter-form"));
596
+ };
597
+
598
+ selectFilteredItem = function(checkbox) {
599
+ checkbox.prop("checked", true);
600
+ return selectedBin(checkbox).append(checkbox.slot());
601
+ };
602
+
603
+ selectedBin = function(el) {
604
+ return filterBox(el).find("._selected-bin");
605
+ };
606
+
607
+ filterBox = function(el) {
608
+ return el.closest("._filter-items");
609
+ };
610
+
611
+ savedIds = function(el) {
612
+ var filteredList;
613
+ filteredList = addSelectedButton($(el)).slot().find("._pointer-filtered-list");
614
+ return filteredList.children().map(function() {
615
+ return $(this).data("cardId");
616
+ }).toArray();
617
+ };
618
+
619
+ addSelectedButton = function(el) {
620
+ return filterBox(el).find("._add-selected");
621
+ };
622
+
623
+ deSelectAllLink = function(el) {
624
+ return filterBox(el).find("._deselect-all");
625
+ };
626
+
627
+ selectedIds = function(el) {
628
+ return selectedData(el, "cardId");
629
+ };
630
+
631
+ selectedNames = function(el) {
632
+ return selectedData(el, "cardName");
633
+ };
634
+
635
+ selectedData = function(el, field) {
636
+ var slots;
637
+ slots = selectedBin(el).children();
638
+ return slots.map(function() {
639
+ return $(this).data(field);
640
+ }).toArray();
641
+ };
642
+
643
+ trackSelectedIds = function(el) {
644
+ var box, ids;
645
+ ids = savedIds(el).concat(selectedIds(el));
646
+ box = filterBox(el);
647
+ box.find("._not-ids").val(ids.toString());
648
+ return addSelectedButton(el).attr("disabled", ids.length === 0);
649
+ };
650
+
538
651
  filterCategorySelected = function(addFilterDropdown, selectedCategory, label) {
539
652
  var widget;
540
653
  widget = addFilterDropdown.closest("._filter-widget");
@@ -548,12 +661,12 @@ return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeTyp
548
661
  $inputField = $(widget.find(selector)[0]);
549
662
  $(widget.find("._add-filter-dropdown")).before($inputField);
550
663
  setFilterInputWidth($inputField);
551
- decko.initAutoCardPlete($inputField.find('input'));
664
+ decko.initAutoCardPlete($inputField.find("input"));
552
665
  return $inputField.find("input, select").focus();
553
666
  };
554
667
 
555
668
  setFilterInputWidth = function($inputField) {
556
- return $inputField.find('select:not([multiple])').select2({
669
+ return $inputField.find("select:not([multiple])").select2({
557
670
  dropdownAutoWidth: "true"
558
671
  });
559
672
  };
@@ -18457,11 +18570,9 @@ $.extend( proto, {
18457
18570
  return $(this).val();
18458
18571
  }));
18459
18572
  },
18460
- '.pointer-mixed': function() {
18461
- var element;
18462
- element = '.pointer-checkbox-sublist input:checked,.pointer-sublist-ul input';
18463
- return pointerContent(this.find(element).map(function() {
18464
- return $(this).val();
18573
+ '._pointer-filtered-list': function() {
18574
+ return pointerContent(this.find('._filtered-list-item').map(function() {
18575
+ return $(this).data('cardname');
18465
18576
  }));
18466
18577
  },
18467
18578
  '.perm-editor': function() {
@@ -18491,17 +18602,20 @@ $.extend( proto, {
18491
18602
  return input.autocomplete({
18492
18603
  source: decko.prepUrl(url)
18493
18604
  });
18605
+ },
18606
+ pointerContent: function(vals) {
18607
+ var list;
18608
+ list = $.map($.makeArray(vals), function(v) {
18609
+ if (v) {
18610
+ return '[[' + v + ']]';
18611
+ }
18612
+ });
18613
+ return $.makeArray(list).join("\n");
18494
18614
  }
18495
18615
  });
18496
18616
 
18497
18617
  pointerContent = function(vals) {
18498
- var list;
18499
- list = $.map($.makeArray(vals), function(v) {
18500
- if (v) {
18501
- return '[[' + v + ']]';
18502
- }
18503
- });
18504
- return $.makeArray(list).join("\n");
18618
+ return decko.pointerContent(vals);
18505
18619
  };
18506
18620
 
18507
18621
  permissionsContent = function(ed) {
@@ -267,8 +267,6 @@ $(window).ready ->
267
267
  confirmer.show 'blind'
268
268
  false
269
269
 
270
-
271
-
272
270
  $('body').on 'click', '.follow-updater', ->
273
271
  $(this).closest('form').find('#card_update_all_users').val 'true'
274
272
 
@@ -412,3 +410,14 @@ decko.slotReady (slot) ->
412
410
  #new_slot.trigger('slotReady')
413
411
  2000
414
412
  )
413
+
414
+ # this finds ._modal-slots and moves them to the end of the body
415
+ # this allows us to render modal slots inside slots that call them and yet
416
+ # avoid associated problems (eg nested forms and unintentional styling)
417
+ # note: it deletes duplicate modal slots
418
+ slot.find('._modal-slot').each ->
419
+ mslot = $(this)
420
+ if $.find("body #" + mslot.attr("id")).length > 1
421
+ mslot.remove()
422
+ else
423
+ $("body").append mslot
@@ -1,14 +1,14 @@
1
1
  $(window).ready ->
2
- $('body').on "change", "._filter-input input, ._filter-input select, ._filter-sort", ->
2
+ $("body").on "change", "._filter-input input, ._filter-input select, ._filter-sort", ->
3
3
  filterAndSort this
4
4
 
5
- $('body').on "click", "._filter-category-select", ->
5
+ $("body").on "click", "._filter-category-select", ->
6
6
  addFilterDropdown = $(this).closest("._add-filter-dropdown")
7
7
  category = $(this).data("category")
8
8
  label = $(this).data("label")
9
9
  filterCategorySelected(addFilterDropdown, category, label)
10
10
 
11
- $('body').on "click", "._delete-filter-input", ->
11
+ $("body").on "click", "._delete-filter-input", ->
12
12
  form = $(this).closest("._filter-form")
13
13
  input = $(this).closest("._filter-input")
14
14
  category = input.data("category")
@@ -17,9 +17,115 @@ $(window).ready ->
17
17
  hideFilterInputField(input)
18
18
  form.submit()
19
19
 
20
+ $("body").on "click", "._filter-items ._unselected ._search-checkbox-item input", ->
21
+ selectFilteredItem $(this)
22
+ updateAfterSelection $(this)
23
+
24
+ $("body").on "click", "._filter-items ._selected ._search-checkbox-item input", ->
25
+ bin = selectedBin $(this)
26
+ $(this).slot().remove()
27
+ updateAfterSelection bin
28
+
29
+ $("body").on "click", "._filter-items ._add-selected", ->
30
+ btn = $(this)
31
+ content = newFilteredListContent btn
32
+ btn.attr "href", addSelectedButtonUrl(btn, content)
33
+
34
+ $("body").on "click", "._select-all", ->
35
+ filterBox($(this)).find("._unselected ._search-checkbox-item input").each ->
36
+ selectFilteredItem $(this)
37
+ $(this).prop "checked", false
38
+ updateAfterSelection $(this)
39
+
40
+ $("body").on "click", "._deselect-all", ->
41
+ filterBox($(this)).find("._selected ._search-checkbox-item input").each ->
42
+ $(this).slot().remove()
43
+ $(this).prop "checked", true
44
+ updateAfterSelection $(this)
45
+
46
+ $('body').on 'click', '._filtered-list-item-delete', ->
47
+ $(this).closest('li').remove()
48
+
49
+ newFilteredListContent = (el) ->
50
+ oldContent = el.slot().find(".d0-card-content").val()
51
+ newContent = decko.pointerContent selectedNames(el)
52
+ return newContent if !oldContent
53
+ oldContent + "\n" + newContent
54
+
55
+ addSelectedButtonUrl = (btn, content) ->
56
+ view = btn.slot().data("slot")["view"]
57
+ card_args = { content: content, type: "Pointer" }
58
+ query = { assign: true, view: view, card: card_args }
59
+ url_base = decko.rootPath + btn.attr("href") + "&" + $.param(query)
60
+ decko.prepUrl url_base, btn.slot()
61
+
62
+ updateAfterSelection = (el) ->
63
+ trackSelectedIds el
64
+ filterAndSort filterBox(el).find "._filter-form"
65
+ updateSelectedCount el
66
+ updateUnselectedCount el
67
+
68
+ updateSelectedCount = (el) ->
69
+ count = selectedBin(el).children().length
70
+ filterBox(el).find("._selected-items").html count
71
+ deselectAllLink(el).attr "disabled", count == 0
72
+ addSelectedButton(el).attr "disabled", count == 0
73
+ updateSelectedSectionVisibility el, count > 0
74
+
75
+ updateSelectedSectionVisibility = (el, items_present) ->
76
+ box = filterBox el
77
+ selected_items = box.find "._selected-item-list"
78
+ help_text = box.find "._filter-help"
79
+ if items_present
80
+ selected_items.show()
81
+ help_text.hide()
82
+ else
83
+ selected_items.hide()
84
+ help_text.show()
85
+
86
+ updateUnselectedCount = (el) ->
87
+ box = filterBox(el)
88
+ count = box.find("._search-checkbox-list").children().length
89
+ box.find("._unselected-items").html count
90
+ box.find("._select-all").attr "disabled", count > 0
91
+
92
+ selectFilteredItem = (checkbox) ->
93
+ checkbox.prop "checked", true
94
+ selectedBin(checkbox).append checkbox.slot()
95
+
96
+ selectedBin = (el) ->
97
+ filterBox(el).find "._selected-bin"
98
+
99
+ filterBox = (el) ->
100
+ el.closest "._filter-items"
101
+
102
+ savedIds = (el) ->
103
+ filteredList = addSelectedButton($(el)).slot().find "._pointer-filtered-list"
104
+ filteredList.children().map( -> $(this).data "cardId" ).toArray()
105
+
106
+ addSelectedButton = (el) ->
107
+ filterBox(el).find("._add-selected")
108
+
109
+ deselectAllLink = (el) ->
110
+ filterBox(el).find("._deselect-all")
111
+
112
+ selectedIds = (el) ->
113
+ selectedData el, "cardId"
114
+
115
+ selectedNames = (el) ->
116
+ selectedData el, "cardName"
117
+
118
+ selectedData = (el, field) ->
119
+ slots = selectedBin(el).children()
120
+ slots.map( -> $(this).data field ).toArray()
121
+
122
+ trackSelectedIds = (el) ->
123
+ ids = savedIds(el).concat selectedIds(el)
124
+ box = filterBox el
125
+ box.find("._not-ids").val ids.toString()
126
+
20
127
  filterCategorySelected = (addFilterDropdown, selectedCategory, label) ->
21
128
  widget = addFilterDropdown.closest("._filter-widget")
22
-
23
129
  removeCategoryOption(addFilterDropdown, selectedCategory)
24
130
  showFilterInputField(selectedCategory, widget)
25
131
 
@@ -29,13 +135,13 @@ showFilterInputField = (category, widget) ->
29
135
 
30
136
  $(widget.find("._add-filter-dropdown")).before($inputField)
31
137
  setFilterInputWidth $inputField
32
- decko.initAutoCardPlete($inputField.find('input')) # only has effect if there is a data-options-card value
138
+ decko.initAutoCardPlete($inputField.find("input")) # only has effect if there is a data-options-card value
33
139
  $inputField.find("input, select").focus()
34
140
 
35
141
  setFilterInputWidth = ($inputField) ->
36
142
  # multiple select fields are skipped because it the importance filter on wikirate
37
143
  # with preselected options got too much height because of this
38
- $inputField.find('select:not([multiple])').select2(
144
+ $inputField.find("select:not([multiple])").select2(
39
145
  dropdownAutoWidth: "true"
40
146
  )
41
147
 
@@ -43,7 +149,7 @@ hideFilterInputField = (input) ->
43
149
  widget = input.closest("._filter-widget")
44
150
  category = input.data("category")
45
151
  $hiddenInputSlot = $(widget.find("._filter-input-field-prototypes > ._filter-input-field.#{category}")[0])
46
- $hiddenInputSlot.append(input)
152
+ $hiddenInputSlot.append input
47
153
 
48
154
  addCategoryOption = (form, option) ->
49
155
  form.find("._filter-category-select[data-category='#{option}']").show()
@@ -52,5 +158,6 @@ removeCategoryOption = (el, option) ->
52
158
  el.find("._filter-category-select[data-category='#{option}']").hide()
53
159
 
54
160
  filterAndSort = (el)->
55
- form = $(el).closest("._filter-form")
56
- form.submit()
161
+ form = $(el).closest("._filter-form")
162
+ form.submit()
163
+
@@ -1,10 +1,10 @@
1
1
  /*!
2
- * Wagn: [[http://wagn.org]]
2
+ * Decko: [[http://wagn.org]]
3
3
  * Copyright 2015 Grass Commons and other contributors; Licensed GPL
4
4
  */
5
5
 
6
6
  /*
7
- This minimal CSS is needed for basic Wagn functionality.
7
+ This minimal CSS is needed for basic Decko functionality.
8
8
 
9
9
  Without the following, menus will be barely usable, "closed" view will not appear on one line,
10
10
  and certain hidden information will show up.
@@ -292,7 +292,7 @@ pre,
292
292
 
293
293
 
294
294
  /*
295
- The below provides styles for aspects of wagn sites not usually prioritized by skin designers.
295
+ The below provides styles for aspects of decks not usually prioritized by skin designers.
296
296
 
297
297
  It includes basic styling for:
298
298
 
@@ -464,6 +464,27 @@ textarea {
464
464
  }
465
465
  }
466
466
 
467
+ ._filter-widget {
468
+ .input-group.sort-input-group, ._filter-container > .input-group {
469
+ width: auto !important;
470
+ }
471
+ select {
472
+ min-width: 30%;
473
+ max-width: 100%;
474
+ }
475
+ }
476
+
477
+ .search-checkbox-item {
478
+ .checkbox-side {
479
+ width: 32px;
480
+ padding: 10px;
481
+ }
482
+
483
+ .item-view-side {
484
+ max-width: 550px;
485
+ }
486
+ }
487
+
467
488
  .new-account-link {
468
489
  text-align: center;
469
490
  }