ahoy_captain 0.8 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +25 -13
- data/app/assets/javascript/ahoy_captain/application.js +4 -4
- data/app/assets/javascript/ahoy_captain/controllers/active_links_controller.js +30 -0
- data/app/assets/javascript/ahoy_captain/controllers/application.js +5 -5
- data/app/assets/javascript/ahoy_captain/controllers/application_controller.js +16 -9
- data/app/assets/javascript/ahoy_captain/controllers/combobox_controller.js +341 -0
- data/app/assets/javascript/ahoy_captain/controllers/details_modal_controller.js +5 -5
- data/app/assets/javascript/ahoy_captain/controllers/dropdown_label_controller.js +2 -2
- data/app/assets/javascript/ahoy_captain/controllers/filter/item_controller.js +12 -0
- data/app/assets/javascript/ahoy_captain/controllers/filter_form_controller.js +13 -0
- data/app/assets/javascript/ahoy_captain/controllers/filter_modal_controller.js +45 -0
- data/app/assets/javascript/ahoy_captain/controllers/funnel_chart_controller.js +116 -104
- data/app/assets/javascript/ahoy_captain/controllers/index.js +4 -3
- data/app/assets/javascript/ahoy_captain/controllers/interval_controller.js +8 -3
- data/app/assets/javascript/ahoy_captain/controllers/line_chart_controller.js +188 -0
- data/app/assets/javascript/ahoy_captain/controllers/predicate_select_controller.js +9 -0
- data/app/assets/javascript/ahoy_captain/controllers/properties_controller.js +8 -0
- data/app/assets/javascript/ahoy_captain/controllers/property_filter_controller.js +46 -0
- data/app/assets/javascript/ahoy_captain/controllers/realtime_controller.js +12 -9
- data/app/assets/javascript/ahoy_captain/controllers/tile_controller.js +9 -0
- data/app/assets/javascript/ahoy_captain/controllers/toggle_controller.js +17 -0
- data/app/assets/javascript/ahoy_captain/helpers/chart_utils.js +156 -0
- data/app/assets/javascript/ahoy_captain/helpers/number_formatters.js +55 -0
- data/app/components/ahoy_captain/combobox_component.html.erb +33 -0
- data/app/components/ahoy_captain/combobox_component.rb +13 -0
- data/app/components/ahoy_captain/comparison_link_component.rb +40 -0
- data/app/components/ahoy_captain/dropdown_button_component.html.erb +5 -5
- data/app/components/ahoy_captain/dropdown_link_component.html.erb +5 -5
- data/app/components/ahoy_captain/filter/dropdown_component.html.erb +50 -0
- data/app/components/ahoy_captain/filter/dropdown_component.rb +51 -0
- data/app/components/ahoy_captain/filter/modal_component.html.erb +12 -9
- data/app/components/ahoy_captain/filter/select_component.html.erb +23 -19
- data/app/components/ahoy_captain/filter/select_component.rb +41 -9
- data/app/components/ahoy_captain/filter/tag_component.html.erb +8 -4
- data/app/components/ahoy_captain/filter/tag_component.rb +6 -30
- data/app/components/ahoy_captain/filter/tag_container_component.html.erb +2 -3
- data/app/components/ahoy_captain/filter/tag_container_component.rb +1 -8
- data/app/components/ahoy_captain/stats/comparable_container_component.html.erb +25 -0
- data/app/components/ahoy_captain/stats/comparable_container_component.rb +86 -0
- data/app/components/ahoy_captain/stats/container_component.html.erb +15 -0
- data/app/components/ahoy_captain/stats/container_component.rb +26 -0
- data/app/components/ahoy_captain/sticky_nav_component.html.erb +13 -22
- data/app/components/ahoy_captain/sticky_nav_component.rb +11 -0
- data/app/components/ahoy_captain/table_component.html.erb +4 -37
- data/app/components/ahoy_captain/table_component.rb +25 -5
- data/app/components/ahoy_captain/tables/devices_table_component.rb +11 -0
- data/app/components/ahoy_captain/tables/dynamic_table.rb +13 -0
- data/app/components/ahoy_captain/tables/dynamic_table_component.rb +204 -0
- data/app/components/ahoy_captain/tables/goals_table_component.rb +17 -0
- data/app/components/ahoy_captain/tables/header_component.html.erb +5 -0
- data/app/components/ahoy_captain/tables/header_component.rb +18 -0
- data/app/components/ahoy_captain/tables/headers/header_component.html.erb +5 -0
- data/app/components/ahoy_captain/tables/headers/header_component.rb +16 -0
- data/app/components/ahoy_captain/tables/properties_table_component.rb +27 -0
- data/app/components/ahoy_captain/tables/row_component.html.erb +4 -0
- data/app/components/ahoy_captain/tables/rows/row_component.html.erb +6 -0
- data/app/components/ahoy_captain/tables/rows/row_component.rb +40 -0
- data/app/components/ahoy_captain/tile_component.html.erb +21 -10
- data/app/components/ahoy_captain/tile_component.rb +3 -2
- data/app/components/ahoy_captain/tooltip_component.html.erb +2 -2
- data/app/controllers/ahoy_captain/application_controller.rb +19 -29
- data/app/controllers/ahoy_captain/campaigns_controller.rb +2 -10
- data/app/controllers/ahoy_captain/cities_controller.rb +2 -6
- data/app/controllers/ahoy_captain/countries_controller.rb +2 -6
- data/app/controllers/ahoy_captain/devices_controller.rb +3 -6
- data/app/controllers/ahoy_captain/entry_pages_controller.rb +2 -4
- data/app/controllers/ahoy_captain/exit_pages_controller.rb +3 -4
- data/app/controllers/ahoy_captain/exports_controller.rb +14 -0
- data/app/controllers/ahoy_captain/filters/base_controller.rb +1 -3
- data/app/controllers/ahoy_captain/filters/goals_controller.rb +9 -0
- data/app/controllers/ahoy_captain/filters/pages/actions_controller.rb +1 -1
- data/app/controllers/ahoy_captain/filters/pages/entry_pages_controller.rb +3 -3
- data/app/controllers/ahoy_captain/filters/pages/exit_pages_controller.rb +2 -3
- data/app/controllers/ahoy_captain/filters/properties/names_controller.rb +11 -0
- data/app/controllers/ahoy_captain/filters/properties/values_controller.rb +15 -0
- data/app/controllers/ahoy_captain/filters/sources_controller.rb +1 -1
- data/app/controllers/ahoy_captain/filters/utms_controller.rb +1 -1
- data/app/controllers/ahoy_captain/properties_controller.rb +41 -0
- data/app/controllers/ahoy_captain/regions_controller.rb +3 -7
- data/app/controllers/ahoy_captain/sources_controller.rb +2 -5
- data/app/controllers/ahoy_captain/stats/base_controller.rb +86 -5
- data/app/controllers/ahoy_captain/stats/bounce_rates_controller.rb +2 -1
- data/app/controllers/ahoy_captain/stats/total_pageviews_controller.rb +2 -1
- data/app/controllers/ahoy_captain/stats/total_visits_controller.rb +2 -1
- data/app/controllers/ahoy_captain/stats/unique_visitors_controller.rb +3 -1
- data/app/controllers/ahoy_captain/stats/views_per_visits_controller.rb +3 -11
- data/app/controllers/ahoy_captain/stats/visit_durations_controller.rb +2 -1
- data/app/controllers/ahoy_captain/top_pages_controller.rb +2 -8
- data/app/decorators/ahoy_captain/application_decorator.rb +27 -3
- data/app/decorators/ahoy_captain/campaign_decorator.rb +8 -0
- data/app/decorators/ahoy_captain/city_decorator.rb +12 -0
- data/app/decorators/ahoy_captain/country_decorator.rb +10 -0
- data/app/decorators/ahoy_captain/device_decorator.rb +13 -2
- data/app/decorators/ahoy_captain/page_decorator.rb +11 -0
- data/app/decorators/ahoy_captain/region_decorator.rb +16 -0
- data/app/decorators/ahoy_captain/source_decorator.rb +7 -0
- data/app/helpers/ahoy_captain/application_helper.rb +62 -3
- data/app/models/ahoy_captain/comparison_mode.rb +72 -0
- data/app/models/ahoy_captain/export.rb +48 -0
- data/app/models/ahoy_captain/filter_parser.rb +82 -0
- data/app/models/ahoy_captain/range_from_params.rb +75 -0
- data/app/models/ahoy_captain/rangeable.rb +0 -3
- data/app/models/concerns/ahoy_captain/compare_mode.rb +19 -0
- data/app/models/concerns/ahoy_captain/limitable.rb +17 -0
- data/app/models/concerns/ahoy_captain/range_options.rb +1 -14
- data/app/presenters/ahoy_captain/dashboard_presenter.rb +18 -49
- data/app/presenters/ahoy_captain/goals_presenter.rb +3 -2
- data/app/queries/ahoy_captain/application_query.rb +78 -13
- data/app/queries/ahoy_captain/campaign_query.rb +14 -0
- data/app/queries/ahoy_captain/city_query.rb +11 -0
- data/app/queries/ahoy_captain/country_query.rb +10 -0
- data/app/queries/ahoy_captain/device_query.rb +10 -0
- data/app/queries/ahoy_captain/entry_pages_query.rb +3 -2
- data/app/queries/ahoy_captain/event_query.rb +20 -13
- data/app/queries/ahoy_captain/exit_pages_query.rb +6 -4
- data/app/queries/ahoy_captain/region_query.rb +11 -0
- data/app/queries/ahoy_captain/source_query.rb +10 -0
- data/app/queries/ahoy_captain/stats/average_views_per_visit_query.rb +11 -4
- data/app/queries/ahoy_captain/stats/average_visit_duration_query.rb +14 -2
- data/app/queries/ahoy_captain/stats/base_query.rb +18 -0
- data/app/queries/ahoy_captain/stats/bounce_rates_query.rb +15 -1
- data/app/queries/ahoy_captain/stats/total_pageviews_query.rb +2 -2
- data/app/queries/ahoy_captain/stats/total_visitors_query.rb +1 -1
- data/app/queries/ahoy_captain/stats/unique_visitors_query.rb +1 -1
- data/app/queries/ahoy_captain/stats/views_per_visit_query.rb +1 -1
- data/app/queries/ahoy_captain/stats/visit_duration_query.rb +3 -3
- data/app/queries/ahoy_captain/top_page_query.rb +13 -0
- data/app/queries/ahoy_captain/visit_query.rb +2 -3
- data/app/queries/concerns/ahoy_captain/comparable_queries.rb +25 -0
- data/app/queries/concerns/ahoy_captain/comparable_query.rb +138 -0
- data/app/queries/concerns/ahoy_captain/lazy_comparable_query.rb +42 -0
- data/app/views/ahoy_captain/devices/_table.html.erb +2 -0
- data/app/views/ahoy_captain/devices/index.html+details.erb +1 -1
- data/app/views/ahoy_captain/devices/index.html.erb +2 -2
- data/app/views/ahoy_captain/funnels/show.html.erb +5 -2
- data/app/views/ahoy_captain/goals/index.html.erb +2 -37
- data/app/views/ahoy_captain/layouts/application.html.erb +3 -4
- data/app/views/ahoy_captain/properties/_form.html.erb +6 -0
- data/app/views/ahoy_captain/properties/index.html.erb +3 -0
- data/app/views/ahoy_captain/properties/show.html.erb +6 -0
- data/app/views/ahoy_captain/realtimes/show.html.erb +1 -1
- data/app/views/ahoy_captain/roots/_filters.html.erb +80 -0
- data/app/views/ahoy_captain/roots/show.html.erb +76 -109
- data/app/views/ahoy_captain/stats/base/index.html.erb +34 -9
- data/app/views/ahoy_captain/stats/show.html.erb +8 -55
- data/config/routes.rb +9 -0
- data/lib/ahoy_captain/ahoy/event_methods.rb +35 -74
- data/lib/ahoy_captain/ahoy/visit_methods.rb +1 -1
- data/lib/ahoy_captain/configuration.rb +18 -7
- data/lib/ahoy_captain/engine.rb +22 -0
- data/lib/ahoy_captain/filter_configuration/filter.rb +16 -0
- data/lib/ahoy_captain/filter_configuration/filter_collection.rb +48 -0
- data/lib/ahoy_captain/filters_configuration.rb +77 -0
- data/lib/ahoy_captain/goals.rb +10 -2
- data/lib/ahoy_captain/period_collection.rb +1 -1
- data/lib/ahoy_captain/predicate_label.rb +7 -0
- data/lib/ahoy_captain/version.rb +1 -1
- data/lib/ahoy_captain.rb +7 -1
- data/lib/generators/ahoy_captain/templates/config.rb.tt +32 -0
- metadata +80 -21
- data/app/assets/javascript/ahoy_captain/controllers/filter_controller.js +0 -145
- data/app/assets/javascript/ahoy_captain/controllers/filter_tag_controller.js +0 -17
- data/app/assets/javascript/ahoy_captain/controllers/link_controller.js +0 -43
- data/app/assets/javascript/ahoy_captain/controllers/navigation_controller.js +0 -25
- data/app/models/ahoy_captain/current.rb +0 -9
- data/app/models/ahoy_captain/url_helpers.rb +0 -6
@@ -1,173 +1,140 @@
|
|
1
|
-
<main class='
|
1
|
+
<main class='min-h-screen pb-4 max-w-6xl mx-auto' data-controller="application" data-action="combobox:init@window->application#comboboxInit">
|
2
2
|
<%= render AhoyCaptain::StickyNavComponent.new do |nav| %>
|
3
3
|
<% nav.with_realtime_update do %>
|
4
|
-
<%= turbo_frame_tag :realtime, src: realtime_path, data: { controller: "realtime" }, loading: :lazy %>
|
4
|
+
<%= turbo_frame_tag :realtime, src: realtime_path, data: { controller: "realtime", "realtime-interval-value" => AhoyCaptain.config.realtime_interval.to_i }, loading: :lazy %>
|
5
5
|
<% end %>
|
6
6
|
<% end %>
|
7
7
|
|
8
8
|
<div class="grid grid-cols-1 lg:grid-cols-2 grid-flow-row gap-4">
|
9
|
-
<%= render AhoyCaptain::TileComponent.new(wide: true) do |component| %>
|
9
|
+
<%= render AhoyCaptain::TileComponent.new(wide: true, classes: "p-4 m-2") do |component| %>
|
10
10
|
<% component.with_statistic_display do %>
|
11
11
|
<%= turbo_frame_tag :stats, src: stats_path(search_params), loading: :lazy %>
|
12
|
+
|
13
|
+
<%= turbo_frame_tag :chart, src: stats_unique_visitors_path(search_params) do %>
|
14
|
+
<% end %>
|
12
15
|
<% end %>
|
16
|
+
|
13
17
|
<% end %>
|
14
18
|
|
15
19
|
<%= render AhoyCaptain::TileComponent.new(title: 'Top Sources') do |component| %>
|
16
20
|
<% component.with_display_links do %>
|
17
|
-
<div data-controller=
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
21
|
+
<div data-controller="active-links">
|
22
|
+
<a href="<%= sources_path(search_params) %>" data-turbo-frame="sources" class="" data-active-links-target="link">All</a>
|
23
|
+
<%= render AhoyCaptain::DropdownLinkComponent.new(title: "Campaign") do |dropdown| %>
|
24
|
+
<% %w{utm_source utm_medium utm_term utm_content utm_campaign}.each do |source| %>
|
25
|
+
<% dropdown.with_option do %>
|
26
|
+
<a href="<%= public_send("campaign_#{source}_path".to_sym, **search_params) %>" class=""
|
27
|
+
data-turbo-frame="sources"
|
28
|
+
data-active-links-target="link">
|
29
|
+
<%= source.titleize.gsub("Utm", "UTM") %>
|
30
|
+
</a>
|
31
|
+
<% end %>
|
25
32
|
<% end %>
|
26
33
|
<% end %>
|
27
|
-
<% end %>
|
28
34
|
</div>
|
29
35
|
<% end %>
|
30
36
|
<% component.with_statistic_display do %>
|
31
37
|
<%= turbo_frame_tag :sources, src: sources_path(search_params), loading: :lazy %>
|
32
38
|
<% end %>
|
33
39
|
<% component.with_details_cta do %>
|
34
|
-
<button data-action="click->details-modal#openModal" data-controller="details-modal" data-details-modal-target-value="#sources" class="link no-underline">Details</button>
|
40
|
+
<button data-action="click->details-modal#openModal" data-controller="details-modal" data-details-modal-target-value="#sources" class="link no-underline ">Details</button>
|
35
41
|
<% end %>
|
36
42
|
<% end %>
|
37
43
|
|
38
44
|
<%= render AhoyCaptain::TileComponent.new(title: 'Top Pages') do |component| %>
|
39
45
|
<% component.with_display_links do %>
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
46
|
+
<div class="flex text-xs font-medium text-gray-400 space-x-2">
|
47
|
+
<div class="relative inline-block text-left" data-controller="active-links"><div>
|
48
|
+
<a href="<%= top_pages_path(search_params) %>"
|
49
|
+
data-turbo-frame="pages"
|
50
|
+
class="inline-block h-5 font-semibold"
|
51
|
+
data-active-links-target="link"
|
52
|
+
data-action="click->tile#setTitle">Top Pages</a>
|
53
|
+
<a href="<%= entry_pages_path(search_params) %>" data-turbo-frame="pages" class="inline-block h-5 font-semibold" data-active-links-target="link" data-action="click->tile#setTitle">Entry Pages</a>
|
54
|
+
<a href="<%= exit_pages_path(search_params) %>" data-turbo-frame="pages" class="inline-block h-5 font-semibold" data-active-links-target="link" data-action="click->tile#setTitle">Exit Pages</a>
|
55
|
+
</div>
|
56
|
+
</div>
|
57
|
+
</div>
|
58
|
+
|
45
59
|
<% end %>
|
46
60
|
<% component.with_statistic_display do %>
|
47
61
|
<%= turbo_frame_tag :pages, src: top_pages_path(search_params), loading: :lazy %>
|
48
62
|
<% end %>
|
49
63
|
<% component.with_details_cta do %>
|
50
|
-
<button data-action="click->details-modal#openModal" data-controller="details-modal"
|
64
|
+
<button data-action="click->details-modal#openModal" data-controller="details-modal" data-details-modal-target-value="#pages" class="link no-underline ">Details</button>
|
51
65
|
<% end %>
|
52
66
|
<% end %>
|
53
67
|
|
54
68
|
<%= render AhoyCaptain::TileComponent.new(title: 'Countries') do |component| %>
|
55
69
|
<% component.with_display_links do %>
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
70
|
+
<div class="flex text-xs font-medium text-gray-400 space-x-2">
|
71
|
+
<div class="relative inline-block text-left" data-controller="active-links">
|
72
|
+
|
73
|
+
<a href="<%= countries_path(search_params) %>" data-turbo-frame="geography" class="inline-block h-5 font-semibold" data-active-links-target="link" data-action="click->tile#setTitle">Countries</a>
|
74
|
+
<a href="<%= regions_path(search_params) %>" data-turbo-frame="geography" class="inline-block h-5 font-semibold" data-active-links-target="link" data-action="click->tile#setTitle">Regions</a>
|
75
|
+
<a href="<%= cities_path(search_params) %>" data-turbo-frame="geography" class="inline-block h-5 font-semibold" data-active-links-target="link" data-action="click->tile#setTitle">Cities</a>
|
76
|
+
</div>
|
77
|
+
</div>
|
61
78
|
<% end %>
|
62
79
|
<% component.with_statistic_display do %>
|
63
80
|
<%= turbo_frame_tag :geography, src: countries_path(search_params), loading: :lazy %>
|
64
81
|
<% end %>
|
65
82
|
<% component.with_details_cta do %>
|
66
|
-
<button data-action="click->details-modal#openModal" data-controller="details-modal"
|
83
|
+
<button data-action="click->details-modal#openModal" data-controller="details-modal" data-details-modal-target-value="#geography" class="link no-underline ">Details</button>
|
67
84
|
<% end %>
|
68
85
|
<% end %>
|
69
86
|
|
70
87
|
<%= render AhoyCaptain::TileComponent.new(title: 'Devices') do |component| %>
|
71
88
|
<% component.with_display_links do %>
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
89
|
+
<div class="flex text-xs font-medium text-gray-400 space-x-2">
|
90
|
+
<div class="relative inline-block text-left" data-controller="active-links">
|
91
|
+
|
92
|
+
<a href="<%= devices_browsers_path(search_params) %>" data-turbo-frame="devices" class=" inline-block h-5 font-semibold" data-active-links-target="link">Browser</a>
|
93
|
+
<a href="<%= devices_operating_systems_path(search_params) %>" data-turbo-frame="devices" class="inline-block h-5 font-semibold" data-active-links-target="link">OS</a>
|
94
|
+
<a href="<%= devices_device_types_path(search_params) %>" data-turbo-frame="devices" class="inline-block h-5 font-semibold" data-active-links-target="link">Size</a>
|
95
|
+
</div>
|
96
|
+
</div>
|
77
97
|
<% end %>
|
78
98
|
<% component.with_statistic_display do %>
|
79
99
|
<%= turbo_frame_tag :devices, src: devices_browsers_path(search_params), loading: :lazy %>
|
80
100
|
<% end %>
|
81
101
|
<% component.with_details_cta do %>
|
82
|
-
<button data-action="click->details-modal#openModal" data-controller="details-modal" data-details-modal-target-value="#devices" class="link no-underline">Details</button>
|
102
|
+
<button data-action="click->details-modal#openModal" data-controller="details-modal" data-details-modal-target-value="#devices" class="link no-underline ">Details</button>
|
83
103
|
<% end %>
|
84
104
|
<% end %>
|
85
|
-
<%= render AhoyCaptain::TileComponent.new(wide: true) do |component| %>
|
105
|
+
<%= render AhoyCaptain::TileComponent.new(title: "Goals and Funnels", wide: true, classes: "p-4 m-2") do |component| %>
|
86
106
|
<% component.with_display_links do %>
|
87
|
-
<
|
88
|
-
|
89
|
-
</a>
|
90
|
-
<%= render AhoyCaptain::DropdownLinkComponent.new(title: "Funnels") do |dropdown| %>
|
91
|
-
<% AhoyCaptain.config.funnels.each do |id, funnel| %>
|
92
|
-
<% dropdown.with_option do %>
|
93
|
-
<a href="<%= funnel_path(id, search_params) %>" data-turbo-frame="goals" class="link link-primary">
|
94
|
-
<%= funnel.title %>
|
95
|
-
</a>
|
96
|
-
<% end %>
|
97
|
-
<% end %>
|
98
|
-
<% end %>
|
107
|
+
<div>
|
108
|
+
<div data-controller="active-links">
|
99
109
|
|
110
|
+
<a href="<%= goals_path(search_params) %>" data-turbo-frame="goals" class="link ">
|
111
|
+
Goals
|
112
|
+
</a>
|
113
|
+
<a href="<%= properties_path(search_params) %>" data-turbo-frame="goals" class="link ">
|
114
|
+
Properties
|
115
|
+
</a>
|
116
|
+
<%= render AhoyCaptain::DropdownLinkComponent.new(title: "Funnels") do |dropdown| %>
|
117
|
+
<% AhoyCaptain.config.funnels.each do |id, funnel| %>
|
118
|
+
<% dropdown.with_option do %>
|
119
|
+
<a href="<%= funnel_path(id, search_params) %>" data-turbo-frame="goals" class="link ">
|
120
|
+
<%= funnel.title %>
|
121
|
+
</a>
|
122
|
+
<% end %>
|
123
|
+
<% end %>
|
124
|
+
<% end %>
|
125
|
+
</div>
|
126
|
+
</div>
|
100
127
|
<% end %>
|
101
|
-
|
102
|
-
|
128
|
+
<% component.with_statistic_display do %>
|
129
|
+
<div class="p-4">
|
130
|
+
<%= turbo_frame_tag :goals, src: goals_path(search_params), loading: :lazy %>
|
131
|
+
</div>
|
103
132
|
<% end %>
|
104
133
|
<% end %>
|
105
134
|
</div>
|
106
135
|
</main>
|
107
136
|
|
108
|
-
<%= render
|
109
|
-
<% modal.with_modal_display do %>
|
110
|
-
<%= render AhoyCaptain::Filter::SelectComponent.new(label: "Action", column: :route, url: filters_actions_path, predicates: [:in, :not_in]) %>
|
111
|
-
<%= render AhoyCaptain::Filter::SelectComponent.new(label: "Entry page", column: :entry_page, url: filters_entry_pages_path, predicates: [:in, :not_in]) %>
|
112
|
-
<%= render AhoyCaptain::Filter::SelectComponent.new(label: "Exit page", column: :exit_page, url: filters_exit_pages_path, predicates: [:in, :not_in]) %>
|
113
|
-
<% end %>
|
114
|
-
<% end %>
|
115
|
-
|
116
|
-
<%= render AhoyCaptain::Filter::ModalComponent.new(title: "Filter by Country", id: "countryModal") do |modal| %>
|
117
|
-
<% modal.with_modal_display do %>
|
118
|
-
<%= render AhoyCaptain::Filter::SelectComponent.new(label: "Country", column: :country, url: filters_locations_countries_path, predicates: [:in, :not_in]) %>
|
119
|
-
<%= render AhoyCaptain::Filter::SelectComponent.new(label: "Region", column: :region, url: filters_locations_regions_path, predicates: [:in, :not_in]) %>
|
120
|
-
<%= render AhoyCaptain::Filter::SelectComponent.new(label: "City", column: :city, url: filters_locations_cities_path, predicates: [:in, :not_in]) %>
|
121
|
-
<% end %>
|
122
|
-
<% end %>
|
123
|
-
|
124
|
-
<%= render AhoyCaptain::Filter::ModalComponent.new(title: "Filter by Source", id: "sourceModal") do |modal| %>
|
125
|
-
<% modal.with_modal_display do %>
|
126
|
-
<%= render AhoyCaptain::Filter::SelectComponent.new(label: "Source", column: :referring_domain, url: filters_sources_path, predicates: [:in, :not_in]) %>
|
127
|
-
<% end %>
|
128
|
-
<% end %>
|
129
|
-
|
130
|
-
<%= render AhoyCaptain::Filter::ModalComponent.new(title: "Filter by Screen size", id: "screenModal") do |modal| %>
|
131
|
-
<% modal.with_modal_display do %>
|
132
|
-
<%= render AhoyCaptain::Filter::SelectComponent.new(label: "Screen size", column: :device_type, url: filters_screens_path, predicates: [:in, :not_in]) %>
|
133
|
-
<% end %>
|
134
|
-
<% end %>
|
135
|
-
|
136
|
-
<%= render AhoyCaptain::Filter::ModalComponent.new(title: "Filter by Browser", id: "osModal") do |modal| %>
|
137
|
-
<% modal.with_modal_display do %>
|
138
|
-
<%= render AhoyCaptain::Filter::SelectComponent.new(label: "Operating System", column: :os, url: filters_names_path, predicates: [:in, :not_in]) %>
|
139
|
-
<%= render AhoyCaptain::Filter::SelectComponent.new(label: "Operating System Version", column: :os_version, url: filters_versions_path, predicates: [:in, :not_in]) %>
|
140
|
-
<% end %>
|
141
|
-
<% end %>
|
142
|
-
|
143
|
-
<%= render AhoyCaptain::Filter::ModalComponent.new(title: "Filter by Campaign", id: "utmModal") do |modal| %>
|
144
|
-
<% modal.with_modal_display do %>
|
145
|
-
<%= render AhoyCaptain::Filter::SelectComponent.new(label: "UTM Medium", column: :utm_medium, url: filters_utm_mediums_path, predicates: [:in, :not_in]) %>
|
146
|
-
<%= render AhoyCaptain::Filter::SelectComponent.new(label: "UTM Source", column: :utm_source, url: filters_utm_sources_path, predicates: [:in, :not_in]) %>
|
147
|
-
<%= render AhoyCaptain::Filter::SelectComponent.new(label: "UTM Campaign", column: :utm_campaign, url: filters_utm_campaigns_path, predicates: [:in, :not_in]) %>
|
148
|
-
<%= render AhoyCaptain::Filter::SelectComponent.new(label: "UTM Term", column: :utm_term, url: filters_utm_terms_path, predicates: [:in, :not_in]) %>
|
149
|
-
<%= render AhoyCaptain::Filter::SelectComponent.new(label: "UTM Content", column: :utm_content, url: filters_utm_contents_path, predicates: [:in, :not_in]) %>
|
150
|
-
<% end %>
|
151
|
-
<% end %>
|
152
|
-
|
153
|
-
<%= render AhoyCaptain::Filter::ModalComponent.new(title: "Custom Range", id: "customRangeModal") do |modal| %>
|
154
|
-
<% modal.with_modal_display do %>
|
155
|
-
<div class="flex gap-2 w-full">
|
156
|
-
<div class="form-control w-full max-w-xs">
|
157
|
-
<label class="label">
|
158
|
-
<span class="label-text">Start Date</span>
|
159
|
-
</label>
|
160
|
-
<input type="datetime-local" name="start_date" class="input input-bordered w-full" value="<%= params[:start_date] %>" />
|
161
|
-
</div>
|
162
|
-
<div class="form-control w-full max-w-xs">
|
163
|
-
<label class="label">
|
164
|
-
<span class="label-text">End Date</span>
|
165
|
-
</label>
|
166
|
-
<input type="datetime-local" name="end_date" class="input input-bordered w-full" value="<%= params[:end_date] %>" />
|
167
|
-
</div>
|
168
|
-
</div>
|
169
|
-
<% end %>
|
170
|
-
<% end %>
|
137
|
+
<%= render 'ahoy_captain/roots/filters' %>
|
171
138
|
|
172
139
|
<dialog id="detailsModal" class="modal">
|
173
140
|
<div class="modal-box w-11/12 max-w-5xl">
|
@@ -1,14 +1,39 @@
|
|
1
1
|
<%= turbo_frame_tag :chart do %>
|
2
|
-
<div class="
|
3
|
-
|
4
|
-
<%=
|
5
|
-
|
2
|
+
<div class="p-4">
|
3
|
+
<div class="flex justify-end gap-3 items-center ">
|
4
|
+
<a href="<%= export_path(request.query_parameters) %>" class="link text-sm" target="_blank" data-turbo-frame="false">Download</a>
|
5
|
+
<%= form_with url: url_for(params.permit!), method: :get, data: { controller: "interval" } do %>
|
6
|
+
<%= select_tag :interval, options_for_select(available_intervals.collect { |interval| [interval.titleize, interval] }, selected: selected_interval), class: "select text-accent select-sm w-full max-w-sm", 'data-action': "change->interval#handleChange" %>
|
7
|
+
<% end %>
|
8
|
+
</div>
|
9
|
+
<div>
|
6
10
|
|
11
|
+
<% if compare_mode? %>
|
12
|
+
<canvas class="h-[300px] w-full"
|
13
|
+
data-controller="line-chart"
|
14
|
+
data-line-chart-label-value="<%= @label %>"
|
15
|
+
data-line-chart-interval-value="<%= selected_interval %>"
|
16
|
+
data-line-chart-current-value="<%= @stats.current.to_json %>"
|
17
|
+
data-line-chart-comparison-value="<%= params[:comparison] %>"
|
18
|
+
data-line-chart-compared-to-value="<%= @stats.compared_to.to_json %>"
|
19
|
+
data-line-chart-metric-value="<%= metric_type(@stats) %>"
|
20
|
+
data-action="resize@window->line-chart#resize"
|
21
|
+
data-action="mouseenter->line-chart#hover"
|
22
|
+
data-action="mouseleave->line-chart#hover"
|
23
|
+
></canvas>
|
24
|
+
<% else %>
|
25
|
+
<canvas class="h-[300px] w-full"
|
26
|
+
data-controller="line-chart"
|
27
|
+
data-line-chart-label-value="<%= @label %>"
|
28
|
+
data-line-chart-interval-value="<%= selected_interval %>"
|
29
|
+
data-line-chart-current-value="<%= @stats.to_json %>"
|
30
|
+
data-line-chart-metric-value="<%= metric_type(@stats) %>"
|
31
|
+
data-action="resize@window->line-chart#resize"
|
32
|
+
data-action="mouseenter->line-chart#hover"
|
33
|
+
data-action="mouseleave->line-chart#hover"
|
34
|
+
></canvas>
|
35
|
+
<% end %>
|
36
|
+
</div>
|
7
37
|
</div>
|
8
38
|
|
9
|
-
<div>
|
10
|
-
|
11
|
-
|
12
|
-
<%= line_chart @stats %>
|
13
|
-
</div>
|
14
39
|
<% end %>
|
@@ -1,57 +1,10 @@
|
|
1
|
-
<%= turbo_frame_tag :stats do %>
|
2
|
-
<dl class="grid grid-cols-1 divide-y divide-base-200 overflow-hidden rounded-lg grid-cols-2 md:grid-cols-6 md:divide-y-0 -
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
</dd>
|
10
|
-
</a>
|
11
|
-
<a href="<%= stats_total_visits_path(search_params) %>" data-turbo-frame="chart">
|
12
|
-
<dt class="text-base font-normal text-base-content">Total Visits</dt>
|
13
|
-
<dd class="mt-1 flex items-baseline justify-between md:block lg:flex">
|
14
|
-
<div class="flex items-baseline text-2xl font-semibold text-accent-content">
|
15
|
-
<%= number_with_delimiter @presenter.total_visits %>
|
16
|
-
</div>
|
17
|
-
</dd>
|
18
|
-
</a>
|
19
|
-
<a href="<%= stats_total_pageviews_path(search_params) %>" data-turbo-frame="chart">
|
20
|
-
<dt class="text-base font-normal text-base-content">Total Pageviews</dt>
|
21
|
-
<dd class="mt-1 flex items-baseline justify-between md:block lg:flex">
|
22
|
-
<div class="flex items-baseline text-2xl font-semibold text-accent-content">
|
23
|
-
<%= number_with_delimiter @presenter.total_pageviews %>
|
24
|
-
</div>
|
25
|
-
</dd>
|
26
|
-
</a>
|
27
|
-
<a href="<%= stats_views_per_visits_path(search_params) %>" data-turbo-frame="chart">
|
28
|
-
|
29
|
-
<dt class="text-base font-normal text-base-content">Views per visit</dt>
|
30
|
-
<dd class="mt-1 flex items-baseline justify-between md:block lg:flex">
|
31
|
-
<div class="flex items-baseline text-2xl font-semibold text-accent-content">
|
32
|
-
<%= number_with_delimiter @presenter.views_per_visit %>
|
33
|
-
</div>
|
34
|
-
</dd>
|
35
|
-
</a>
|
36
|
-
<a href="<%= stats_bounce_rates_path(search_params) %>" data-turbo-frame="chart">
|
37
|
-
|
38
|
-
<dt class="text-base font-normal text-base-content">Bounce rate</dt>
|
39
|
-
<dd class="mt-1 flex items-baseline justify-between md:block lg:flex">
|
40
|
-
<div class="flex items-baseline text-2xl font-semibold text-accent-content">
|
41
|
-
<%= number_with_delimiter @presenter.bounce_rate %>%
|
42
|
-
</div>
|
43
|
-
</dd>
|
44
|
-
</a>
|
45
|
-
<a href="<%= stats_visit_durations_path(search_params) %>" data-turbo-frame="chart">
|
46
|
-
|
47
|
-
<dt class="text-base font-normal text-base-content">Visit duration</dt>
|
48
|
-
<dd class="mt-1 flex items-baseline justify-between md:block lg:flex">
|
49
|
-
<div class="flex items-baseline text-2xl font-semibold text-accent-content">
|
50
|
-
<%= @presenter.visit_duration %>
|
51
|
-
</div>
|
52
|
-
</dd>
|
53
|
-
</a>
|
1
|
+
<%= turbo_frame_tag :stats, data: { controller: "active-frame-link" } do %>
|
2
|
+
<dl class="grid grid-cols-1 divide-y divide-base-200 overflow-hidden rounded-lg grid-cols-2 md:grid-cols-6 md:divide-y-0" data-controller="active-links" data-active-links-classes-value='["text-primary"]'>
|
3
|
+
<%= render stats_container(@presenter.unique_visitors, stats_unique_visitors_url(search_params), "Unique Visits", :number_with_delimiter, true) %>
|
4
|
+
<%= render stats_container(@presenter.total_visits, stats_total_visits_path(search_params), "Total Visits", :number_with_delimiter) %>
|
5
|
+
<%= render stats_container(@presenter.total_pageviews, stats_total_pageviews_path(search_params), "Total Pageviews", :number_with_delimiter) %>
|
6
|
+
<%= render stats_container(@presenter.views_per_visit, stats_views_per_visits_path(search_params), "Views per Visit", :number_with_delimiter) %>
|
7
|
+
<%= render stats_container(@presenter.bounce_rate, stats_bounce_rates_path(search_params), "Bounce Rate", :number_with_delimiter) %>
|
8
|
+
<%= render stats_container(@presenter.visit_duration, stats_visit_durations_url(search_params), "Visit Duration", :number_to_duration) %>
|
54
9
|
</dl>
|
55
|
-
<%= turbo_frame_tag :chart, src: stats_unique_visitors_path(search_params) do %>
|
56
|
-
<% end %>
|
57
10
|
<% end %>
|
data/config/routes.rb
CHANGED
@@ -12,6 +12,8 @@ AhoyCaptain::Engine.routes.draw do
|
|
12
12
|
get "/devices/#{k}" => 'devices#index', defaults: { devices_type: v }, as: "devices_#{k}"
|
13
13
|
end
|
14
14
|
|
15
|
+
resources :properties, only: [:index, :show]
|
16
|
+
resource :export, only: [:show]
|
15
17
|
resource :realtime, only: [:show]
|
16
18
|
resources :funnels, only: [:show]
|
17
19
|
resources :goals, only: [:index]
|
@@ -41,6 +43,13 @@ AhoyCaptain::Engine.routes.draw do
|
|
41
43
|
%w{country region city}.each do |type|
|
42
44
|
get "locations/#{type.pluralize}" => "locations#index", defaults: { type: type }
|
43
45
|
end
|
46
|
+
|
47
|
+
namespace :properties do
|
48
|
+
resources :names, only: [:index]
|
49
|
+
resources :values, only: [:index]
|
50
|
+
end
|
51
|
+
|
52
|
+
resources :goals, only: [:index]
|
44
53
|
resources :sources, only: [:index]
|
45
54
|
resources :screens, only: [:index]
|
46
55
|
scope :operating_systems, module: :operating_systems do
|
@@ -4,104 +4,65 @@ module AhoyCaptain
|
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
|
6
6
|
included do
|
7
|
-
|
7
|
+
scope :page_view, -> { where("name = '#{AhoyCaptain.config.event[:view_name]}'") }
|
8
|
+
|
9
|
+
ransacker :route do |_parent|
|
8
10
|
Arel.sql(AhoyCaptain.config.event[:url_column])
|
9
11
|
end
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
select(Arel.sql("#{AhoyCaptain.config.event.url_column} AS url"))
|
15
|
-
}
|
16
|
-
|
17
|
-
scope :distinct_url, -> {
|
18
|
-
distinct(Arel.sql("#{AhoyCaptain.config.event.url_column}"))
|
19
|
-
}
|
20
|
-
|
21
|
-
scope :url_in, ->(*args) {
|
22
|
-
where("#{AhoyCaptain.config.event.url_column} IN (?)", args)
|
23
|
-
}
|
24
|
-
|
25
|
-
scope :url_eq, ->(arg) {
|
26
|
-
if arg.is_a?(Array)
|
27
|
-
arg = arg[0]
|
28
|
-
end
|
29
|
-
where("#{AhoyCaptain.config.event.url_column} = ?", arg)
|
30
|
-
}
|
31
|
-
|
32
|
-
scope :url_not_in, ->(*args) {
|
33
|
-
where("#{AhoyCaptain.config.event.url_column} NOT IN (?)", args)
|
34
|
-
}
|
35
|
-
|
36
|
-
scope :url_i_cont, ->(arg) {
|
37
|
-
where("#{AhoyCaptain.config.event.url_column} ILIKE ?", "%#{arg}%")
|
38
|
-
}
|
39
|
-
|
40
|
-
scope :route_eq, ->(arg) {
|
41
|
-
url_eq(arg)
|
42
|
-
}
|
43
|
-
|
44
|
-
scope :route_in, ->(*args) {
|
45
|
-
url_in(*args)
|
46
|
-
}
|
13
|
+
ransacker :entry_page do |parent|
|
14
|
+
Arel.sql("entry_pages.url")
|
15
|
+
end
|
47
16
|
|
48
|
-
|
49
|
-
|
50
|
-
|
17
|
+
ransacker :exit_page do |parent|
|
18
|
+
Arel.sql("exit_pages.url")
|
19
|
+
end
|
51
20
|
|
52
|
-
scope :
|
53
|
-
|
21
|
+
scope :with_entry_pages, -> {
|
22
|
+
with(entry_pages: self.select("MIN(#{table_name}.id) as min_id, #{Arel.sql("#{AhoyCaptain.config.event.url_column} AS url")}").where(name: AhoyCaptain.config.event[:view_name]).group("#{table_name}.properties")).joins("INNER JOIN entry_pages ON entry_pages.min_id = #{table_name}.id")
|
54
23
|
}
|
55
24
|
|
56
|
-
scope :
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
joins("INNER JOIN (#{subquery.to_sql}) #{table_alias} ON #{::AhoyCaptain.event.table_name}.id = #{table_alias}.min_id")
|
25
|
+
scope :with_exit_pages, -> {
|
26
|
+
with(exit_pages: self.select("MAX(#{table_name}.id) as max_id, #{Arel.sql("#{AhoyCaptain.config.event.url_column} AS url")}")
|
27
|
+
.where(name: AhoyCaptain.config.event[:view_name]).group("#{table_name}.properties"))
|
28
|
+
.joins("INNER JOIN exit_pages ON exit_pages.max_id = #{table_name}.id")
|
61
29
|
}
|
62
30
|
|
63
|
-
scope :
|
64
|
-
table_alias = "first_events_#{SecureRandom.hex.first(6)}"
|
65
|
-
subquery = self.select("MIN(id) as min_id").where(name: AhoyCaptain.config.event[:view_name]).route_not_in(*args).group(:visit_id)
|
66
|
-
joins("INNER JOIN (#{subquery.to_sql}) #{table_alias} ON #{::AhoyCaptain.event.table_name}.id = #{table_alias}.min_id")
|
67
|
-
}
|
31
|
+
scope :with_routes, -> { where(AhoyCaptain.config.event[:url_exists]) }
|
68
32
|
|
69
|
-
scope :
|
70
|
-
|
71
|
-
subquery = self.select("MIN(id) as min_id").where(name: AhoyCaptain.config.event[:view_name]).route_i_cont(arg).group(:visit_id)
|
72
|
-
joins("INNER JOIN (#{subquery.to_sql}) #{table_alias} ON #{::AhoyCaptain.event.table_name}.id = #{table_alias}.min_id")
|
33
|
+
scope :with_url, -> {
|
34
|
+
select(Arel.sql("#{AhoyCaptain.config.event.url_column} AS url"))
|
73
35
|
}
|
74
36
|
|
75
|
-
scope :
|
76
|
-
|
77
|
-
|
78
|
-
subquery = self.select("MAX(id) as max_id").where(name: AhoyCaptain.config.event[:view_name]).route_in(*args).group(:visit_id)
|
79
|
-
joins("INNER JOIN (#{subquery.to_sql}) #{table_alias} ON #{::AhoyCaptain.event.table_name}.id = #{table_alias}.max_id")
|
37
|
+
scope :distinct_url, -> {
|
38
|
+
distinct(Arel.sql("#{AhoyCaptain.config.event.url_column}"))
|
80
39
|
}
|
81
40
|
|
82
|
-
scope :
|
83
|
-
|
84
|
-
|
85
|
-
subquery = self.select("MAX(id) as max_id").where(name: AhoyCaptain.config.event[:view_name]).route_not_in(*args).group(:visit_id)
|
86
|
-
joins("INNER JOIN (#{subquery.to_sql}) #{table_alias} ON #{::AhoyCaptain.event.table_name}.id = #{table_alias}.max_id")
|
41
|
+
scope :with_property_values, ->(value) {
|
42
|
+
where("JSONB_EXISTS(properties, '#{value}')")
|
87
43
|
}
|
88
44
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
subquery = self.select("MAX(id) as max_id").where(name: AhoyCaptain.config.event[:view_name]).route_i_cont(*arg).group(:visit_id)
|
93
|
-
joins("INNER JOIN (#{subquery.to_sql}) #{table_alias} ON #{::AhoyCaptain.event.table_name}.id = #{table_alias}.max_id")
|
94
|
-
}
|
45
|
+
ransacker :properties, args: [:parent, :ransacker_args] do |parent, args|
|
46
|
+
Arel::Nodes::InfixOperation.new('->>', parent.table[:properties], Arel::Nodes.build_quoted(args))
|
47
|
+
end
|
95
48
|
|
49
|
+
ransacker :goal,
|
50
|
+
formatter: ->(value) {
|
51
|
+
::Arel::Nodes::SqlLiteral.new(
|
52
|
+
::AhoyCaptain.config.goals[value].event_query.call.select(:id).to_sql
|
53
|
+
)
|
54
|
+
} do |parent|
|
55
|
+
parent.table[:id]
|
56
|
+
end
|
96
57
|
end
|
97
58
|
|
98
59
|
class_methods do
|
99
60
|
def ransackable_attributes(auth_object = nil)
|
100
|
-
super + ["action", "controller", "id",
|
61
|
+
super + [ "action", "controller", "id", "name", "page", "properties", "time", "url", "user_id", "visit_id", "goal"] + self._ransackers.keys
|
101
62
|
end
|
102
63
|
|
103
64
|
def ransackable_scopes(auth_object = nil)
|
104
|
-
super + [:
|
65
|
+
super + [:with_property_values, :property_value_i_cont]
|
105
66
|
end
|
106
67
|
|
107
68
|
def ransackable_associations(auth_object = nil)
|
@@ -1,9 +1,10 @@
|
|
1
1
|
require 'ahoy_captain/period_collection'
|
2
|
+
require 'ahoy_captain/filters_configuration'
|
2
3
|
|
3
4
|
module AhoyCaptain
|
4
5
|
class Configuration
|
5
|
-
attr_accessor :view_name, :theme
|
6
|
-
attr_reader :goals, :funnels, :cache, :ranges, :disabled_widgets, :event, :models
|
6
|
+
attr_accessor :view_name, :theme, :realtime_interval
|
7
|
+
attr_reader :goals, :funnels, :cache, :ranges, :disabled_widgets, :event, :models, :filters, :predicate_labels
|
7
8
|
def initialize
|
8
9
|
@goals = GoalCollection.new
|
9
10
|
@funnels = FunnelCollection.new
|
@@ -14,15 +15,25 @@ module AhoyCaptain
|
|
14
15
|
option.store = Rails.cache
|
15
16
|
option.ttl = 1.minute
|
16
17
|
end
|
17
|
-
@event = ActiveSupport::OrderedOptions.new.tap do |option|
|
18
|
-
option.view_name = "$view"
|
19
|
-
option.url_column = "CONCAT(ahoy_events.properties->>'controller', '#', ahoy_events.properties->>'action')"
|
20
|
-
option.url_exists = "JSONB_EXISTS(ahoy_events.properties, 'controller') AND JSONB_EXISTS(ahoy_events.properties, 'action')"
|
21
|
-
end
|
22
18
|
@models = ActiveSupport::OrderedOptions.new.tap do |option|
|
23
19
|
option.event = "::Ahoy::Event"
|
24
20
|
option.visit = "::Ahoy::Visit"
|
25
21
|
end
|
22
|
+
@event = ActiveSupport::OrderedOptions.new.tap do |option|
|
23
|
+
option.view_name = "$view"
|
24
|
+
option.url_column = "CONCAT(#{@models.event.parameterize.tableize}.properties->>'controller', '#', #{@models.event.parameterize.tableize}.properties->>'action')"
|
25
|
+
option.url_exists = "JSONB_EXISTS(#{@models.event.parameterize.tableize}.properties, 'controller') AND JSONB_EXISTS(#{@models.event.parameterize.tableize}.properties, 'action')"
|
26
|
+
end
|
27
|
+
@filters = FiltersConfiguration.load_default
|
28
|
+
@predicate_labels = {
|
29
|
+
eq: 'equals',
|
30
|
+
not_eq: 'not equals',
|
31
|
+
cont: 'contains',
|
32
|
+
in: 'in',
|
33
|
+
not_in: 'not in',
|
34
|
+
}
|
35
|
+
|
36
|
+
@realtime_interval = 30.seconds
|
26
37
|
@disabled_widgets = []
|
27
38
|
end
|
28
39
|
|
data/lib/ahoy_captain/engine.rb
CHANGED
@@ -6,6 +6,28 @@ require 'view_component'
|
|
6
6
|
require 'chartkick'
|
7
7
|
require 'groupdate'
|
8
8
|
require 'pagy'
|
9
|
+
require 'zip'
|
10
|
+
|
11
|
+
module Ransack
|
12
|
+
module Nodes
|
13
|
+
class Condition
|
14
|
+
|
15
|
+
# allows for sql from a formatter
|
16
|
+
# see https://github.com/activerecord-hackery/ransack/issues/702
|
17
|
+
def casted_array?(predicate)
|
18
|
+
return unless predicate.is_a?(Arel::Nodes::Casted)
|
19
|
+
|
20
|
+
predicate.value.is_a?(Array)
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
Ransack.configure do |config|
|
28
|
+
config.add_predicate 'json_cont', arel_predicate: 'contains', formatter: proc { |v| JSON.parse(v) }
|
29
|
+
config.add_predicate 'json_eq', arel_predicate: 'eq', formatter: proc { |v| JSON.parse(v) }
|
30
|
+
end
|
9
31
|
|
10
32
|
module AhoyCaptain
|
11
33
|
class Engine < Rails::Engine
|