rails-contact 0.1.11 → 0.1.13
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/app/controllers/rails/contact/contacts_controller.rb +1 -1
- data/app/views/rails/contact/_google_sync_panel.html.erb +27 -19
- data/app/views/rails/contact/index.html.erb +16 -0
- data/lib/generators/rails/contact/templates/create_rails_contact_contacts.rb.tt +3 -0
- data/lib/rails/contact/search/backends/database.rb +21 -0
- data/lib/rails/contact/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8f494c5d67c2e057d1e12c490eadf40a64137f3fa801a5654b405c642b13e70e
|
|
4
|
+
data.tar.gz: 5543c60122860c18d71c90428f0d74eabee77d64e8b95270367b707b9ca0d26d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9da8786e7cb36fff8eaa83399d41dd8ed517892dd9ecc2859ab3ef7d964f27f643798dc7bc39ee33f5b73ceef7b72354a5cf1ab5f65d75f9e6bb8edbbfb6e64f
|
|
7
|
+
data.tar.gz: afa7e5ea14872cd7cd16229d60ada9baac2f2d638c79a16bd18a81831f307d2f3d24a68b25fb4c640fb7f607659d25e8bba727e13d1fddb6f1c69203d9b0fa5e
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.12
|
|
4
|
+
|
|
5
|
+
- `_google_sync_panel`: render the card whenever `google_sync_ui_on_index`; if `google_sync_enabled` is false, show short instructions instead of hiding the section entirely.
|
|
6
|
+
|
|
3
7
|
## 0.1.11
|
|
4
8
|
|
|
5
9
|
- Default **Google sync panel** back on the engine index via `_google_sync_panel` when `google_sync_enabled` and `google_sync_ui_on_index` (default true). Host apps can override the partial or disable with `google_sync_ui_on_index = false`.
|
|
@@ -127,7 +127,7 @@ module Rails
|
|
|
127
127
|
end
|
|
128
128
|
|
|
129
129
|
def filter_params
|
|
130
|
-
params.permit(:city, :region, :sync_eligible, :starred)
|
|
130
|
+
params.permit(:city, :region, :sync_eligible, :starred, :travel_date_start, :travel_date_end, :contact_created_at_start, :contact_created_at_end, :csv_import_id)
|
|
131
131
|
end
|
|
132
132
|
|
|
133
133
|
def google_pending_sync_count
|
|
@@ -1,27 +1,35 @@
|
|
|
1
|
-
<% if Rails::Contact.configuration.
|
|
1
|
+
<% if Rails::Contact.configuration.google_sync_ui_on_index %>
|
|
2
2
|
<div class="rounded-xl border border-gray-200 bg-white p-4 shadow-sm space-y-4">
|
|
3
3
|
<h2 class="text-sm font-semibold text-gray-900">Google Contacts</h2>
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
<%=
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
<p class="mt-2 text-xs text-gray-500">
|
|
12
|
-
Pushes the most recently updated contacts (up to your configured limit) to Google—new rows and changes to names, emails, phones, etc.
|
|
13
|
-
</p>
|
|
14
|
-
</div>
|
|
15
|
-
|
|
16
|
-
<% if @google_contacts_pending_sync.to_i.positive? %>
|
|
17
|
-
<div class="border-t border-gray-100 pt-4">
|
|
18
|
-
<%= form_with url: google_sync_unsynced_contacts_path, method: :post, local: true, class: "flex flex-wrap items-center gap-3" do %>
|
|
19
|
-
<%= submit_tag "Sync #{@google_contacts_pending_sync} contact#{'s' if @google_contacts_pending_sync != 1} with no Google link yet (any age)",
|
|
20
|
-
class: "inline-flex rounded-md border border-emerald-700 bg-white px-4 py-2 text-sm font-semibold text-emerald-800 hover:bg-emerald-50",
|
|
21
|
-
data: { confirm: "Queue Google sync for #{@google_contacts_pending_sync} contact(s) that are not linked yet? This runs in the background." } %>
|
|
5
|
+
<% if Rails::Contact.configuration.google_sync_enabled %>
|
|
6
|
+
<div>
|
|
7
|
+
<%= form_with url: google_sync_rolling_window_contacts_path, method: :post, local: true, class: "flex flex-wrap items-center gap-3" do %>
|
|
8
|
+
<%= submit_tag "Re-sync recent contacts with Google",
|
|
9
|
+
class: "inline-flex rounded-md bg-emerald-600 px-4 py-2 text-sm font-semibold text-white hover:bg-emerald-700",
|
|
10
|
+
data: { confirm: "Queue Google sync for the recent contact window? This updates contacts already in Google and creates any that are missing. Runs in the background." } %>
|
|
22
11
|
<% end %>
|
|
23
|
-
<p class="mt-2 text-xs text-gray-500">
|
|
12
|
+
<p class="mt-2 text-xs text-gray-500">
|
|
13
|
+
Pushes the most recently updated contacts (up to your configured limit) to Google—new rows and changes to names, emails, phones, etc.
|
|
14
|
+
</p>
|
|
24
15
|
</div>
|
|
16
|
+
|
|
17
|
+
<% if @google_contacts_pending_sync.to_i.positive? %>
|
|
18
|
+
<div class="border-t border-gray-100 pt-4">
|
|
19
|
+
<%= form_with url: google_sync_unsynced_contacts_path, method: :post, local: true, class: "flex flex-wrap items-center gap-3" do %>
|
|
20
|
+
<%= submit_tag "Sync #{@google_contacts_pending_sync} contact#{'s' if @google_contacts_pending_sync != 1} with no Google link yet (any age)",
|
|
21
|
+
class: "inline-flex rounded-md border border-emerald-700 bg-white px-4 py-2 text-sm font-semibold text-emerald-800 hover:bg-emerald-50",
|
|
22
|
+
data: { confirm: "Queue Google sync for #{@google_contacts_pending_sync} contact(s) that are not linked yet? This runs in the background." } %>
|
|
23
|
+
<% end %>
|
|
24
|
+
<p class="mt-2 text-xs text-gray-500">For contacts outside the recent window or older imports that never received a Google <code class="rounded bg-gray-100 px-1">resourceName</code>.</p>
|
|
25
|
+
</div>
|
|
26
|
+
<% end %>
|
|
27
|
+
<% else %>
|
|
28
|
+
<p class="text-sm text-gray-600">
|
|
29
|
+
Google sync is turned off. Set environment variable
|
|
30
|
+
<code class="rounded bg-gray-100 px-1">RAILS_CONTACT_GOOGLE_SYNC_ENABLED=true</code>
|
|
31
|
+
(and OAuth client + token path in <code class="rounded bg-gray-100 px-1">rails_contact</code> initializer), then restart the server.
|
|
32
|
+
</p>
|
|
25
33
|
<% end %>
|
|
26
34
|
</div>
|
|
27
35
|
<% end %>
|
|
@@ -19,6 +19,22 @@
|
|
|
19
19
|
<%= f.label :region, "Interested Region", class: "mb-1 block text-sm font-medium text-gray-700" %>
|
|
20
20
|
<%= f.text_field :region, value: params[:region], class: "w-full rounded-md border border-gray-300 px-3 py-2 text-sm" %>
|
|
21
21
|
</div>
|
|
22
|
+
<div>
|
|
23
|
+
<%= f.label :travel_date_start, "Travel Start", class: "mb-1 block text-sm font-medium text-gray-700" %>
|
|
24
|
+
<%= f.date_field :travel_date_start, value: params[:travel_date_start], class: "w-full rounded-md border border-gray-300 px-3 py-2 text-sm" %>
|
|
25
|
+
</div>
|
|
26
|
+
<div>
|
|
27
|
+
<%= f.label :travel_date_end, "Travel End", class: "mb-1 block text-sm font-medium text-gray-700" %>
|
|
28
|
+
<%= f.date_field :travel_date_end, value: params[:travel_date_end], class: "w-full rounded-md border border-gray-300 px-3 py-2 text-sm" %>
|
|
29
|
+
</div>
|
|
30
|
+
<div>
|
|
31
|
+
<%= f.label :contact_created_at_start, "Created Start", class: "mb-1 block text-sm font-medium text-gray-700" %>
|
|
32
|
+
<%= f.date_field :contact_created_at_start, value: params[:contact_created_at_start], class: "w-full rounded-md border border-gray-300 px-3 py-2 text-sm" %>
|
|
33
|
+
</div>
|
|
34
|
+
<div>
|
|
35
|
+
<%= f.label :contact_created_at_end, "Created End", class: "mb-1 block text-sm font-medium text-gray-700" %>
|
|
36
|
+
<%= f.date_field :contact_created_at_end, value: params[:contact_created_at_end], class: "w-full rounded-md border border-gray-300 px-3 py-2 text-sm" %>
|
|
37
|
+
</div>
|
|
22
38
|
<div class="flex gap-2">
|
|
23
39
|
<%= f.submit "Filter", class: "inline-flex rounded-md bg-gray-900 px-4 py-2 text-sm font-medium text-white hover:bg-gray-700" %>
|
|
24
40
|
<%= link_to "Reset", contacts_path, class: "inline-flex rounded-md border border-gray-300 px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50" %>
|
|
@@ -22,5 +22,8 @@ class CreateRailsContactContacts < ActiveRecord::Migration[7.1]
|
|
|
22
22
|
add_index :rails_contact_contacts, :updated_at
|
|
23
23
|
add_index :rails_contact_contacts, :sync_eligible
|
|
24
24
|
add_index :rails_contact_contacts, :google_resource_name, unique: true
|
|
25
|
+
add_index :rails_contact_contacts, "(metadata->>'travel_date')", name: 'idx_contacts_travel_date'
|
|
26
|
+
add_index :rails_contact_contacts, "(metadata->>'contact_created_at')", name: 'idx_contacts_contact_created_at'
|
|
27
|
+
add_index :rails_contact_contacts, "(metadata->>'csv_import_id')", name: 'idx_contacts_csv_import_id'
|
|
25
28
|
end
|
|
26
29
|
end
|
|
@@ -41,6 +41,27 @@ module Rails
|
|
|
41
41
|
if filters["sync_eligible"].present?
|
|
42
42
|
scoped = scoped.where(sync_eligible: ActiveModel::Type::Boolean.new.cast(filters["sync_eligible"]))
|
|
43
43
|
end
|
|
44
|
+
|
|
45
|
+
if filters["travel_date_start"].present?
|
|
46
|
+
scoped = scoped.where("metadata->>'travel_date' >= ?", filters["travel_date_start"])
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
if filters["travel_date_end"].present?
|
|
50
|
+
scoped = scoped.where("metadata->>'travel_date' <= ?", filters["travel_date_end"])
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
if filters["contact_created_at_start"].present?
|
|
54
|
+
scoped = scoped.where("metadata->>'contact_created_at' >= ?", filters["contact_created_at_start"])
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
if filters["contact_created_at_end"].present?
|
|
58
|
+
scoped = scoped.where("metadata->>'contact_created_at' <= ?", filters["contact_created_at_end"])
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
if filters["csv_import_id"].present?
|
|
62
|
+
scoped = scoped.where("metadata->>'csv_import_id' = ?", filters["csv_import_id"].to_s)
|
|
63
|
+
end
|
|
64
|
+
|
|
44
65
|
scoped
|
|
45
66
|
end
|
|
46
67
|
end
|