effective_search 0.3.2 → 0.4.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cdff688df4f3ff9af7c692fd7f0d93fe50930516572f05713f437796d3e217b4
4
- data.tar.gz: 564d67a8426d0f4d33a3732e6aeca69b6cfa25523a231ae967c3778ebe8a3b8d
3
+ metadata.gz: 7bfa4a21057a6cd4cb527775c03d5e93519efdb983f4077b2af83de9c1045c10
4
+ data.tar.gz: 6a479c7e6c53a85eac7971cab1ec74781a643df4ef7ac899b2fb4aecdbafc3bb
5
5
  SHA512:
6
- metadata.gz: 9e31933471bc10e0468e73a6a77522d4389e24b0e7c957066bf6cfe93ec012af031dac21570ae07b9f0662d8e7daea3d692f2fb91a16339a7b3524dfc414a9ce
7
- data.tar.gz: 244590f2c1d6a07aab61d5de6c0d8d537b41639fba125e31d5b7dade17a699a05190e6795800b61f48b0143b919f592ac7ad91b53db7863022a2152c8e7e1a6b
6
+ metadata.gz: acb2120f14ed4e41e4b2273105a19456f1d5a09d0a6380c48c70cd58c2832e091aa9f434dbd03fd26a829eb0d1a8581838827179d024d33e14b6ae7f6e5e9cdb
7
+ data.tar.gz: b91e5e86ef6fe69f32f78376c59f2f2052aa7b77eab1708e61db59d4e1c420ca4e9fe300509b54e8691ff23bdb077ddbfaabea84387b6917e970b327321a6ca3
@@ -55,8 +55,20 @@ $(document).on('keydown keyup', "#effective-search-admin-modal form", function(e
55
55
  if(event.key === 'Enter') { event.preventDefault(); }
56
56
  });
57
57
 
58
+ // Open the search modal when "/" is pressed
59
+ $(document).on('keydown', function(event) {
60
+ if (event.key !== '/') return;
61
+
62
+ // Don't trigger when typing in an input, textarea, or contenteditable
63
+ var tag = event.target.tagName;
64
+ if (tag === 'input' || tag === 'textarea' || tag === 'select' || event.target.isContentEditable) return;
65
+
66
+ event.preventDefault();
67
+ $('#effective-search-admin-modal').modal('show');
68
+ });
69
+
58
70
  // Auto focus the search input when the modal is shown
59
71
  $(document).on('shown.bs.modal', '#effective-search-admin-modal', function () {
60
- $(".effective-search-admin").find('input[type="search"]').first().focus();
72
+ $(".effective-search-admin").find('#q_term').focus();
61
73
  });
62
74
 
@@ -1,14 +1,18 @@
1
- .effective-search-admin {
2
- #effective-search-results {
3
- a {
4
- display: block;
5
- color: inherit;
6
- text-decoration: none;
7
- }
1
+ #effective-search-results {
2
+ hr {
8
3
 
9
- span.badge {
10
- color: #1F2328;
11
- background-color: #EDEEEF;
12
- }
4
+ margin-left:-1rem;
5
+ margin-right:-1rem;
6
+ margin-top: 1.5rem;
7
+ margin-bottom: 1rem;
13
8
  }
14
9
  }
10
+
11
+ #effective-search-button {
12
+ display: inline-flex;
13
+ align-items: center;
14
+ border: solid 1px #D1D9E0;
15
+ border-radius: 0.25rem;
16
+ background: #f8f9fa;
17
+ padding: 0.25rem 0.5rem;
18
+ }
@@ -25,7 +25,7 @@ module EffectiveSearchAdminSearch
25
25
  end
26
26
 
27
27
  def per_page
28
- 3
28
+ 5
29
29
  end
30
30
 
31
31
  def present?
@@ -1,12 +1,8 @@
1
- %tr
2
- %td
3
- %a{href: effective_memberships.edit_admin_applicant_path(applicant), title: applicant}
4
- %span.badge.rounded-circle.p-2.mr-3.float-left= icon('clipboard')
5
- = applicant.owner
6
- %br
7
- %small.text-muted
8
- = applicant.summary_title
9
- = ' • '.html_safe
10
- = applicant.owner&.email
11
- = ' • '.html_safe
12
- = badge(applicant.status)
1
+ %a.list-group-item.list-group-item-action{href: effective_memberships.edit_admin_applicant_path(applicant), title: applicant}
2
+ %strong= applicant.owner
3
+ %small.text-muted
4
+ = applicant.summary_title
5
+ •
6
+ = applicant.owner&.email
7
+ •
8
+ = badge(applicant.status)
@@ -1,3 +1,5 @@
1
- %li.nav-item.effective-search-nav-item
2
- %a.nav-link{href: '#', data: { toggle: 'modal', target: '#effective-search-admin-modal' }, title: 'Search'}
3
- = icon('search')
1
+ .form-inline.ml-auto.mr-2
2
+ %button#effective-search-button{data: { toggle: 'modal', target: '#effective-search-admin-modal' }, title: 'Search'}
3
+ %span= icon('search')
4
+ %small.px-3 Quick search...
5
+ %small.px-2.border.bg-white /
@@ -1,8 +1,9 @@
1
- %div#effective-search-admin-modal.modal.fade{tabindex: '-1', role: 'dialog', 'data-turbolinks-permanent': true}
1
+ #effective-search-admin-modal.modal.fade{tabindex: '-1', role: 'dialog', 'data-turbolinks-permanent': true}
2
2
  .modal-dialog.modal-lg{role: 'document'}
3
3
  .modal-content
4
4
  .modal-body
5
5
  - search = EffectiveSearch.AdminSearch.new
6
6
  = render('admin/search/search', search: search, modal: true)
7
+
7
8
  .modal-footer.bg-light.p-1
8
- %small.text-muted Search by name, email, #{etd(EffectiveMemberships.Organization)}, or order number.
9
+ %small.text-muted Search by name, email, or order number. Quick open with /
@@ -1,16 +1,12 @@
1
- %tr
2
- %td
3
- - path = (EffectiveResources.authorized?(self, :edit, order) ? effective_orders.admin_edit_order_path(order) : effective_orders.admin_order_path(order))
1
+ - path = (EffectiveResources.authorized?(self, :edit, order) ? effective_orders.admin_edit_order_path(order) : effective_orders.admin_order_path(order))
4
2
 
5
- %a{href: path, title: order}
6
- %span.badge.rounded-circle.p-2.mr-3.float-left= icon('shopping-cart')
7
- = order.to_s
8
- %br
9
- %small.text-muted
10
- = order.billing_name
11
- = ' • '.html_safe
12
- = order.email
13
- = ' • '.html_safe
14
- = price_to_currency(order.total)
15
- = ' • '.html_safe
16
- = badge(order.status)
3
+ %a.list-group-item.list-group-item-action{href: path, title: order}
4
+ = order.to_s
5
+ %small.text-muted
6
+ = order.billing_name
7
+ •
8
+ = order.email
9
+ •
10
+ = price_to_currency(order.total)
11
+ •
12
+ = badge(order.status)
@@ -1,28 +1,24 @@
1
- %tr
2
- %td
3
- %a{href: effective_memberships.edit_admin_organization_path(organization), title: organization}
4
- %span.badge.rounded-circle.p-2.mr-3.float-left= icon('globe')
5
- = organization
6
- %br
7
- %small.text-muted
8
- - if organization.class.try(:effective_memberships_organization_owner?)
9
- - if (membership = organization.try(:membership)).present?
10
- = membership.statuses.to_sentence
11
- = membership.categories.to_sentence
12
- member
13
- - if membership.number.present?
14
- = ' #' + membership.number
15
- - elsif organization.membership_removed?
16
- Removed member
17
- - else
18
- Not a member
19
- = ' • '.html_safe
1
+ %a.list-group-item.list-group-item-action{href: effective_memberships.edit_admin_organization_path(organization), title: organization}
2
+ %p.mb-0= organization
3
+ %small.text-muted
4
+ - if organization.class.try(:effective_memberships_organization_owner?)
5
+ - if (membership = organization.try(:membership)).present?
6
+ = membership.statuses.to_sentence
7
+ = membership.categories.to_sentence
8
+ member
9
+ - if membership.number.present?
10
+ = ' #' + membership.number
11
+ - elsif organization.membership_removed?
12
+ Removed member
13
+ - else
14
+ Not a member
15
+ •
20
16
 
21
- = organization.email
17
+ = organization.email
22
18
 
23
- - if (principals = organization.representatives.select { |rep| rep.is_any?(:principal) }).present?
24
- = ' • '.html_safe
25
- = principals.to_sentence
19
+ - if (principals = organization.representatives.select { |rep| rep.is_any?(:principal) }).present?
20
+ •
21
+ = principals.to_sentence
26
22
 
27
- = ' • '.html_safe
28
- = pluralize(organization.representatives.count, 'representative')
23
+ •
24
+ = pluralize(organization.representatives.count, 'representative')
@@ -3,39 +3,36 @@
3
3
  = effective_form_with(scope: :q, model: search, method: :get, url: effective_search.admin_search_path) do |f|
4
4
  = hidden_field_tag :page, (params[:page] || 1)
5
5
 
6
- .d-flex.align-items-center
6
+ .d-flex.align-items-center.mb-3
7
7
  .flex-grow-1
8
- = f.search_field :term, placeholder: 'Search', label: false, autofocus: true, autocomplete: 'off',
8
+ = f.text_field :term, placeholder: 'Search users, companies, applicants, and orders', label: false, autofocus: true, autocomplete: 'off',
9
9
  'data-load-ajax-url': effective_search.admin_search_path,
10
10
  'data-load-ajax-div': '#effective-search-results',
11
- 'data-load-ajax-all': true
11
+ 'data-load-ajax-all': true,
12
+ wrapper: { class: 'form-group mb-0' }
12
13
 
13
14
  - if modal
14
15
  %div
15
- = link_to 'Clear', '#', class: 'btn-link', style: "position: absolute; top: 1.5rem; right: 4rem; z-index: 10;", 'data-effective-search-clear': true
16
-
17
- %div.ml-4.mb-3
18
- %button.close{type: 'button', data: { dismiss: 'modal' }, 'aria-label': 'Close'}
19
- %span{'aria-hidden': 'true'} ×
16
+ %button.btn.btn-sm.btn-light.ml-3.border{type: 'button', data: { dismiss: 'modal' }, 'aria-label': 'Close'}
17
+ %span{'aria-hidden': 'true'} ESC
20
18
 
21
19
  #effective-search-results
22
20
  - if search.present?
23
- - # Users
24
- %p Users (#{search.users.count})
25
- %table.table.table-hover
26
- %tbody= render(collection: search.user_results, partial: 'admin/search/user')
27
-
28
- - # Organizations
29
- %p #{ets(search.organizations)} (#{search.organizations.count})
30
- %table.table.table-hover
31
- %tbody= render(collection: search.organization_results, partial: 'admin/search/organization')
32
-
33
- - # Applicants
34
- %p Applicants (#{search.applicants.count})
35
- %table.table.table-hover
36
- %tbody= render(collection: search.applicant_results, partial: 'admin/search/applicant')
37
-
38
- - # Orders
39
- %p Orders (#{search.orders.count})
40
- %table.table.table-hover
41
- %tbody= render(collection: search.order_results, partial: 'admin/search/order')
21
+ - if search.order_results.present?
22
+ %small.font-weight-bold Orders (#{search.orders.count})
23
+ .list-group.list-group-flush= render(collection: search.order_results, partial: 'admin/search/order')
24
+ %hr
25
+
26
+ - if search.user_results.present?
27
+ %small.font-weight-bold Users (#{search.users.count})
28
+ .list-group.list-group-flush= render(collection: search.user_results, partial: 'admin/search/user')
29
+ %hr
30
+
31
+ - if search.organization_results.present?
32
+ %small.font-weight-bold #{ets(search.organizations)} (#{search.organizations.count})
33
+ .list-group.list-group-flush= render(collection: search.organization_results, partial: 'admin/search/organization')
34
+ %hr
35
+
36
+ - if search.applicant_results.present?
37
+ %small.font-weight-bold Applicants (#{search.applicants.count})
38
+ .list-group.list-group-flush= render(collection: search.applicant_results, partial: 'admin/search/applicant')
@@ -1,25 +1,20 @@
1
- %tr
2
- %td
3
- %a{href: edit_admin_user_path(user), title: user}
4
- %span.badge.rounded-circle.p-2.mr-3.float-left= icon('user')
5
- = user.to_s
6
- %br
7
- %small.text-muted
8
- - if user.class.try(:effective_memberships_owner?)
9
- - if(membership = user.try(:membership) || user.try(:organizations).try(:first).try(:membership)).present?
10
- = membership.statuses.to_sentence
11
- = membership.categories.to_sentence
12
- member
13
- - if membership.number.present?
14
- = ' #' + membership.number
15
- - elsif user.membership_removed?
16
- Removed member
17
- - else
18
- Not a member
19
- = ' • '.html_safe
1
+ %a.list-group-item.list-group-item-action{href: edit_admin_user_path(user), title: user}
2
+ %strong= user.to_s
3
+ %small.text-muted
4
+ - if user.class.try(:effective_memberships_owner?)
5
+ - if(membership = user.try(:membership) || user.try(:organizations).try(:first).try(:membership)).present?
6
+ = membership.statuses.to_sentence
7
+ = membership.categories.to_sentence
8
+ - if membership.number.present?
9
+ = ' #' + membership.number
10
+ - elsif user.membership_removed?
11
+ Removed member
12
+ - else
13
+ Not a member
14
+ •
20
15
 
21
- = user.email
16
+ = user.email
22
17
 
23
- - if user.try(:representatives).present?
24
- = ' • '.html_safe
25
- = user.representatives.map(&:organization).to_sentence
18
+ - if user.try(:representatives).present?
19
+ •
20
+ = user.representatives.map(&:organization).to_sentence
@@ -1,3 +1,3 @@
1
1
  module EffectiveSearch
2
- VERSION = '0.3.2'.freeze
2
+ VERSION = '0.4.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_search
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-02-09 00:00:00.000000000 Z
11
+ date: 2026-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails