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
@@ -0,0 +1,7 @@
1
+
2
+ %table.search-checkbox-item._search-checkbox-item.w-100
3
+ %tr
4
+ %td.checkbox-side
5
+ = check_box_tag "checkbox-#{unique_id}", item_card.key
6
+ %td.item-view-side{ style: "background: #fff" }
7
+ = nest_item item_card
@@ -0,0 +1,14 @@
1
+ .card-header
2
+ %h5
3
+ Select Item
4
+ .badge.badge-secondary
5
+ = card.count
6
+ .p-3
7
+ %input#select-all._select-all{name: "", type: "checkbox", value: ""}
8
+ %label{for: "select-all"}
9
+ - if card.count > 0
10
+ select
11
+ %span._unselected-items
12
+ = search_with_params.size
13
+ following
14
+ = render :checkbox_list
@@ -31,9 +31,9 @@ format :html do
31
31
  submit_button class: "submit-button"
32
32
  end
33
33
 
34
- def standard_cancel_button href=nil
35
- href ||= path
36
- cancel_button class: "cancel-button", href: href
34
+ def standard_cancel_button args={}
35
+ args.reverse_merge! class: "cancel-button", href: path
36
+ cancel_button args
37
37
  end
38
38
 
39
39
  view :edit_name, perms: :update do
@@ -125,7 +125,7 @@ format :html do
125
125
  def edit_type_buttons
126
126
  cancel_path = path view: :edit
127
127
  button_formgroup do
128
- [standard_submit_button, standard_cancel_button(cancel_path)]
128
+ [standard_submit_button, standard_cancel_button(href: cancel_path)]
129
129
  end
130
130
  end
131
131
 
@@ -46,8 +46,17 @@ format :html do
46
46
  text = args.delete(:text) || "Cancel"
47
47
  args[:type] ||= "button"
48
48
  args[:situation] ||= "outline-secondary"
49
- add_class args, (args[:href] ? "slotter" : "redirecter")
50
- args[:href] ||= Card.path_setting("/*previous")
49
+ add_class args, cancel_strategy(args[:redirect], args[:href])
50
+ args[:href] ||= path_to_previous
51
51
  button_tag text, args
52
52
  end
53
+
54
+ def cancel_strategy redirect, href
55
+ redirect = href.blank? if redirect.nil?
56
+ redirect ? "redirecter" : "slotter"
57
+ end
58
+
59
+ def path_to_previous
60
+ Card.path_setting "/*previous"
61
+ end
53
62
  end
@@ -1,19 +1,23 @@
1
1
  format :html do
2
- view :modal_link do |args|
3
- opts = args[:link_opts] || {}
4
- opts[:path] ||= {}
5
- opts[:path][:layout] = :modal
6
- opts["data-target"] = "#modal-main-slot"
7
- opts["data-toggle"] = "modal"
2
+ view :modal_link, tags: :unknown_ok do |args|
3
+ opts = args[:link_opts]
4
+ opts[:path][:layout] ||= :modal
8
5
  text = args[:link_text] || _render_title(args)
9
6
  link_to text, opts
10
7
  end
11
8
 
9
+ def default_modal_link_args args
10
+ args[:link_opts] ||= {}
11
+ args[:link_opts].reverse_merge! path: {},
12
+ "data-target": "#modal-main-slot",
13
+ "data-toggle": "modal"
14
+ end
15
+
12
16
  view :modal_slot, tags: :unknown_ok do |args|
13
17
  id = "modal-#{args[:modal_id] || 'main-slot'}"
14
18
  dialog_args = { class: "modal-dialog" }
15
19
  add_class dialog_args, args[:dialog_class]
16
- wrap_with(:div, class: "modal fade", role: "dialog", id: id) do
20
+ wrap_with(:div, class: "modal fade _modal-slot", role: "dialog", id: id) do
17
21
  wrap_with(:div, dialog_args) do
18
22
  wrap_with :div, class: "modal-content" do
19
23
  ""
@@ -23,21 +27,24 @@ format :html do
23
27
  end
24
28
 
25
29
  view :modal_menu, tags: :unknown_ok do
26
- popout_params = {}
27
- popout_params[:view] = params[:view] if params[:view]
30
+ wrap_with :div, class: "modal-menu w-100" do
31
+ [close_modal_window, popop_out_modal_window]
32
+ end
33
+ end
34
+
35
+ def close_modal_window
36
+ link_to icon_tag(:close), path: "",
37
+ class: "close-modal float-right close",
38
+ "data-dismiss": "modal"
39
+ end
40
+
41
+ def popop_out_modal_window
28
42
  # we probably want to pass on a lot more params than just view,
29
43
  # but not all of them
30
44
  # (eg we don't want layout, id, controller...)
31
- wrap_with :div, class: "modal-menu" do
32
- [
33
- link_to(glyphicon("remove"),
34
- path: "", class: "close-modal float-right close",
35
- "data-dismiss" => "modal"),
36
- link_to(glyphicon("new-window"),
37
- path: popout_params,
38
- class: "pop-out-modal float-right close ")
39
- ]
40
- end
45
+ popout_params = params[:view] ? { view: params[:view] } : {}
46
+ link_to icon_tag :new_window, path: popout_params,
47
+ class: "pop-out-modal float-right close "
41
48
  end
42
49
 
43
50
  view :modal_footer, tags: :unknown_ok do
@@ -1,3 +1,5 @@
1
+
2
+
1
3
  format :html do
2
4
  view :new, perms: :create, tags: :unknown_ok, cache: :never do
3
5
  with_nest_mode :edit do
@@ -97,12 +99,16 @@ format :html do
97
99
  end
98
100
 
99
101
  view :new_buttons do
100
- cancel_path = !main? && path(view: :missing)
101
102
  button_formgroup do
102
- [standard_create_button, standard_cancel_button(cancel_path)]
103
+ [standard_create_button, standard_cancel_button(cancel_button_new_args)]
103
104
  end
104
105
  end
105
106
 
107
+ # path to redirect to after canceling a new form
108
+ def cancel_button_new_args
109
+ { href: (main? ? path_to_previous : path(view: :missing)) }
110
+ end
111
+
106
112
  def standard_create_button
107
113
  submit_button class: "submit-button create-submit-button"
108
114
  end
@@ -3,30 +3,34 @@ format :html do
3
3
  # (1) gives CSS classes for styling and
4
4
  # (2) adds card data for javascript - including the "card-slot" class,
5
5
  # which in principle is not supposed to be in styles
6
- def wrap slot=true
6
+ def wrap slot=true, &block
7
+ method_wrap :wrap_with, slot, &block
8
+ end
9
+
10
+ def haml_wrap slot=true, &block
11
+ method_wrap :haml_tag, slot, &block
12
+ end
13
+
14
+ def method_wrap method, slot, &block
7
15
  @slot_view = @current_view
8
16
  debug_slot do
9
- wrap_with :div, yield, id: card.name.url_key,
10
- class: wrap_classes(slot),
11
- data: wrap_data
17
+ attribs = { id: card.name.url_key,
18
+ class: wrap_classes(slot),
19
+ data: wrap_data }
20
+ send method, :div, attribs, &block
12
21
  end
13
22
  end
14
23
 
15
- def haml_wrap slot=true
16
- @slot_view = @current_view
17
- debug_slot do
18
- haml_tag :div, id: card.name.url_key,
19
- class: wrap_classes(slot),
20
- data: wrap_data do
21
- yield
22
- end
24
+ def wrap_data slot=true
25
+ with_slot_data slot do
26
+ { "card-id": card.id, "card-name": h(card.name) }
23
27
  end
24
28
  end
25
29
 
26
- def wrap_data
27
- { "card-id" => card.id,
28
- "card-name" => h(card.name),
29
- "slot" => slot_options }
30
+ def with_slot_data slot
31
+ hash = yield
32
+ hash[:slot] = slot_options if slot
33
+ hash
30
34
  end
31
35
 
32
36
  def slot_options_json
@@ -34,7 +38,7 @@ format :html do
34
38
  end
35
39
 
36
40
  def slot_options
37
- options = voo.slot_options
41
+ options = voo ? voo.slot_options : {}
38
42
  name_context_slot_option options
39
43
  options
40
44
  end
@@ -61,7 +65,7 @@ format :html do
61
65
  def wrap_classes slot
62
66
  list = slot ? ["card-slot"] : []
63
67
  list += ["#{@current_view}-view", card.safe_set_keys]
64
- list << "STRUCTURE-#{voo.structure.to_name.key}" if voo.structure
68
+ list << "STRUCTURE-#{voo.structure.to_name.key}" if voo&.structure
65
69
  classy list
66
70
  end
67
71
 
@@ -10,11 +10,11 @@ format :html do
10
10
  super args
11
11
  end
12
12
 
13
- view :type_formgroup do |args|
13
+ view :type_formgroup do
14
14
  if card.cards_of_type_exist?
15
15
  wrap_with :div, tr(:cards_exist, cardname: card.name)
16
16
  else
17
- super args
17
+ super()
18
18
  end
19
19
  end
20
20
 
@@ -20,7 +20,6 @@ describe Card::Set::All::RichHtml::Editing do
20
20
  it "shows editors for both absolute and relative nests" do
21
21
  mycard.content = "{{absolute}} AND {{+relative}}"
22
22
  view = myformat.render :edit_nests
23
- puts view
24
23
  expect(view).to have_tag "div.SELF-a" do
25
24
  with_tag "div.card-editor", with: { card_name: "absolute" }
26
25
  with_tag "div.card-editor", with: { card_name: "A+relative" }
@@ -0,0 +1,13 @@
1
+
2
+ def fetch_params params
3
+ Env.params.select { |key, val| val && params.include?(key) }
4
+ .with_indifferent_access
5
+ end
6
+
7
+ def param_to_i key, default
8
+ if (value = Env.params[key])
9
+ value.to_i
10
+ else
11
+ default
12
+ end
13
+ end
@@ -0,0 +1,16 @@
1
+ describe Card::Set::Abstract::Utility do
2
+ describe "#params_to_i" do
3
+ subject do
4
+ Card["A"].with_set(described_class).param_to_i "offset", 0
5
+ end
6
+
7
+ it "returns value from params" do
8
+ Card::Env.params["offset"] = "5"
9
+ is_expected.to eq(5)
10
+ end
11
+
12
+ it "returns default" do
13
+ is_expected.to eq(0)
14
+ end
15
+ end
16
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: card
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.93.5
4
+ version: 1.93.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan McCutchen
@@ -19,14 +19,14 @@ dependencies:
19
19
  requirements:
20
20
  - - '='
21
21
  - !ruby/object:Gem::Version
22
- version: 0.3.5
22
+ version: 0.3.6
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - '='
28
28
  - !ruby/object:Gem::Version
29
- version: 0.3.5
29
+ version: 0.3.6
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: haml
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -3294,6 +3294,7 @@ files:
3294
3294
  - mod/core/layout/noside.html
3295
3295
  - mod/core/layout/pre.html
3296
3296
  - mod/core/layout/simple.html
3297
+ - mod/core/layout/simple_modal.html
3297
3298
  - mod/core/set/abstract/code_file.rb
3298
3299
  - mod/core/set/abstract/haml_file.rb
3299
3300
  - mod/core/set/abstract/lock.rb
@@ -3355,6 +3356,7 @@ files:
3355
3356
  - mod/core/spec/set/all/content_spec.rb
3356
3357
  - mod/core/spec/set/all/event_conditions_spec.rb
3357
3358
  - mod/core/spec/set/all/export_spec.rb
3359
+ - mod/core/spec/set/all/fetch_helper_spec.rb
3358
3360
  - mod/core/spec/set/all/fetch_spec.rb
3359
3361
  - mod/core/spec/set/all/i18n_spec.rb
3360
3362
  - mod/core/spec/set/all/initialize_spec.rb
@@ -3494,6 +3496,7 @@ files:
3494
3496
  - mod/pointer/set/abstract/01_paging/paging_links.rb
3495
3497
  - mod/pointer/set/abstract/02_pointer.rb
3496
3498
  - mod/pointer/set/abstract/02_pointer/edit.rb
3499
+ - mod/pointer/set/abstract/02_pointer/filtered.rb
3497
3500
  - mod/pointer/set/abstract/02_pointer/item.rb
3498
3501
  - mod/pointer/set/abstract/02_pointer/options.rb
3499
3502
  - mod/pointer/set/abstract/code_pointer.rb
@@ -3508,26 +3511,35 @@ files:
3508
3511
  - mod/pointer/template/abstract/02_pointer/edit/autocomplete_input.haml
3509
3512
  - mod/pointer/template/abstract/02_pointer/edit/list_input.haml
3510
3513
  - mod/pointer/template/abstract/02_pointer/edit/list_item.haml
3514
+ - mod/pointer/template/abstract/02_pointer/filtered/filter_items.haml
3515
+ - mod/pointer/template/abstract/02_pointer/filtered/filtered_list_input.haml
3511
3516
  - mod/prosemirror_editor/db/migrate_cards/20160804112547_add_prosemirror_cards.rb
3512
3517
  - mod/prosemirror_editor/lib/javascript/script_prosemirror.js
3513
3518
  - mod/prosemirror_editor/lib/javascript/script_prosemirror_config.js.coffee
3514
3519
  - mod/prosemirror_editor/set/abstract/prosemirror_editor.rb
3515
3520
  - mod/prosemirror_editor/set/self/script_prosemirror.rb
3516
3521
  - mod/prosemirror_editor/set/self/script_prosemirror_config.rb
3522
+ - mod/search/lib/card/filter_query.rb
3523
+ - mod/search/set/abstract/00_filter_helper.rb
3524
+ - mod/search/set/abstract/01_filter_form_helper.rb
3517
3525
  - mod/search/set/abstract/01_search_params.rb
3526
+ - mod/search/set/abstract/02_filter_formgroups.rb
3527
+ - mod/search/set/abstract/03_filter.rb
3528
+ - mod/search/set/abstract/04_right_filter_form.rb
3518
3529
  - mod/search/set/abstract/search.rb
3519
3530
  - mod/search/set/abstract/wql_search.rb
3520
- - mod/search/set/all/filter.rb
3521
3531
  - mod/search/set/self/navbox.rb
3522
3532
  - mod/search/set/self/recent.rb
3523
3533
  - mod/search/set/self/search.rb
3524
3534
  - mod/search/set/type/search_type.rb
3525
- - mod/search/spec/set/all/filter_spec.rb
3535
+ - mod/search/spec/set/abstract/filter_spec.rb
3526
3536
  - mod/search/spec/set/self/navbox_spec.rb
3527
3537
  - mod/search/spec/set/self/recent_spec.rb
3528
3538
  - mod/search/spec/set/self/search_spec.rb
3529
- - mod/search/template/all/filter/_filter_input.haml
3530
- - mod/search/template/all/filter/filter_form.haml
3539
+ - mod/search/template/abstract/03_filter/_filter_input.haml
3540
+ - mod/search/template/abstract/03_filter/filter_form.haml
3541
+ - mod/search/template/abstract/search/checkbox_item.haml
3542
+ - mod/search/template/abstract/search/select_item.haml
3531
3543
  - mod/settings/lib/card/setting.rb
3532
3544
  - mod/settings/set/abstract/permission.rb
3533
3545
  - mod/settings/set/right/add_help.rb
@@ -3693,6 +3705,8 @@ files:
3693
3705
  - mod/twitter/Gemfile
3694
3706
  - mod/twitter/db/migrate_cards/20170305112346_add_twitter_cards.rb
3695
3707
  - mod/twitter/set/type/twitter_template.rb
3708
+ - mod/utility/set/abstract/utility.rb
3709
+ - mod/utility/spec/set/abstract/utility_spec.rb
3696
3710
  - tmpsets/set/mod001-admin/self/admin.rb
3697
3711
  - tmpsets/set/mod001-admin/self/admin_info.rb
3698
3712
  - tmpsets/set/mod001-admin/self/version.rb
@@ -1,9 +0,0 @@
1
- format :html do
2
- # @param data [Hash] the filter categories. The hash needs for every category
3
- # a hash with a label and a input_field entry.
4
- def filter_form data={}, sort_input_field=nil, form_args={}
5
- haml :filter_form, categories: data,
6
- sort_input_field: sort_input_field,
7
- form_args: form_args
8
- end
9
- end