lookout-ahoy 0.1.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 +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +99 -0
- data/Rakefile +24 -0
- data/app/assets/images/lookout/apple-touch-icon.png +0 -0
- data/app/assets/images/lookout/favicon-16x16.png +0 -0
- data/app/assets/images/lookout/favicon-32x32.png +0 -0
- data/app/assets/images/lookout/logo.png +0 -0
- data/app/assets/images/lookout/safari-pinned-tab.png +0 -0
- data/app/assets/images/lookout/safari-pinned-tab.svg +199 -0
- data/app/assets/javascript/lookout/application.js +2 -0
- data/app/assets/javascript/lookout/controllers/application.js +9 -0
- data/app/assets/javascript/lookout/controllers/application_controller.js +33 -0
- data/app/assets/javascript/lookout/controllers/combobox_controller.js +371 -0
- data/app/assets/javascript/lookout/controllers/details_modal_controller.js +18 -0
- data/app/assets/javascript/lookout/controllers/dropdown_label_controller.js +39 -0
- data/app/assets/javascript/lookout/controllers/filter/item_controller.js +12 -0
- data/app/assets/javascript/lookout/controllers/filter_form_controller.js +13 -0
- data/app/assets/javascript/lookout/controllers/filter_modal_controller.js +45 -0
- data/app/assets/javascript/lookout/controllers/frame_link_controller.js +20 -0
- data/app/assets/javascript/lookout/controllers/funnel_chart_controller.js +159 -0
- data/app/assets/javascript/lookout/controllers/index.js +4 -0
- data/app/assets/javascript/lookout/controllers/interval_controller.js +15 -0
- data/app/assets/javascript/lookout/controllers/line_chart_controller.js +251 -0
- data/app/assets/javascript/lookout/controllers/predicate_select_controller.js +10 -0
- data/app/assets/javascript/lookout/controllers/properties_controller.js +8 -0
- data/app/assets/javascript/lookout/controllers/property_filter_controller.js +45 -0
- data/app/assets/javascript/lookout/controllers/realtime_controller.js +30 -0
- data/app/assets/javascript/lookout/controllers/sparkline_controller.js +64 -0
- data/app/assets/javascript/lookout/controllers/tile_controller.js +33 -0
- data/app/assets/javascript/lookout/controllers/toggle_controller.js +17 -0
- data/app/assets/javascript/lookout/helpers/chart_utils.js +156 -0
- data/app/assets/javascript/lookout/helpers/countries.js +2261 -0
- data/app/assets/javascript/lookout/helpers/number_formatters.js +55 -0
- data/app/assets/manifest/lookout/manifest.js +2 -0
- data/app/components/lookout/combobox_component.html.erb +33 -0
- data/app/components/lookout/combobox_component.rb +13 -0
- data/app/components/lookout/comparison_link_component.html.erb +17 -0
- data/app/components/lookout/comparison_link_component.rb +44 -0
- data/app/components/lookout/dropdown_button_component.html.erb +16 -0
- data/app/components/lookout/dropdown_button_component.rb +14 -0
- data/app/components/lookout/dropdown_link_component.html.erb +17 -0
- data/app/components/lookout/dropdown_link_component.rb +19 -0
- data/app/components/lookout/filter/dropdown_component.html.erb +50 -0
- data/app/components/lookout/filter/dropdown_component.rb +51 -0
- data/app/components/lookout/filter/modal_component.html.erb +16 -0
- data/app/components/lookout/filter/modal_component.rb +13 -0
- data/app/components/lookout/filter/select_component.html.erb +25 -0
- data/app/components/lookout/filter/select_component.rb +64 -0
- data/app/components/lookout/filter/tag_component.html.erb +13 -0
- data/app/components/lookout/filter/tag_component.rb +14 -0
- data/app/components/lookout/filter/tag_container_component.html.erb +4 -0
- data/app/components/lookout/filter/tag_container_component.rb +6 -0
- data/app/components/lookout/previous_next_component.html.erb +8 -0
- data/app/components/lookout/previous_next_component.rb +11 -0
- data/app/components/lookout/stats/comparable_container_component.html.erb +25 -0
- data/app/components/lookout/stats/comparable_container_component.rb +103 -0
- data/app/components/lookout/stats/container_component.html.erb +23 -0
- data/app/components/lookout/stats/container_component.rb +28 -0
- data/app/components/lookout/sticky_nav_component.html.erb +32 -0
- data/app/components/lookout/sticky_nav_component.rb +24 -0
- data/app/components/lookout/table_component.html.erb +16 -0
- data/app/components/lookout/table_component.rb +48 -0
- data/app/components/lookout/tables/devices_table_component.rb +11 -0
- data/app/components/lookout/tables/dynamic_table.rb +13 -0
- data/app/components/lookout/tables/dynamic_table_component.rb +207 -0
- data/app/components/lookout/tables/goals_table_component.rb +17 -0
- data/app/components/lookout/tables/header_component.html.erb +6 -0
- data/app/components/lookout/tables/header_component.rb +18 -0
- data/app/components/lookout/tables/headers/header_component.html.erb +5 -0
- data/app/components/lookout/tables/headers/header_component.rb +16 -0
- data/app/components/lookout/tables/properties_table_component.rb +27 -0
- data/app/components/lookout/tables/row_component.html.erb +4 -0
- data/app/components/lookout/tables/rows/row_component.html.erb +6 -0
- data/app/components/lookout/tables/rows/row_component.rb +40 -0
- data/app/components/lookout/tile_component.html.erb +24 -0
- data/app/components/lookout/tile_component.rb +24 -0
- data/app/components/lookout/tooltip_component.html.erb +3 -0
- data/app/components/lookout/tooltip_component.rb +18 -0
- data/app/controllers/lookout/application_controller.rb +83 -0
- data/app/controllers/lookout/campaigns_controller.rb +19 -0
- data/app/controllers/lookout/devices_controller.rb +20 -0
- data/app/controllers/lookout/entry_pages_controller.rb +19 -0
- data/app/controllers/lookout/exit_pages_controller.rb +19 -0
- data/app/controllers/lookout/exports_controller.rb +14 -0
- data/app/controllers/lookout/filters/base_controller.rb +15 -0
- data/app/controllers/lookout/filters/goals_controller.rb +9 -0
- data/app/controllers/lookout/filters/locations_controller.rb +11 -0
- data/app/controllers/lookout/filters/operating_systems/names_controller.rb +13 -0
- data/app/controllers/lookout/filters/operating_systems/versions_controller.rb +13 -0
- data/app/controllers/lookout/filters/pages/actions_controller.rb +13 -0
- data/app/controllers/lookout/filters/pages/entry_pages_controller.rb +14 -0
- data/app/controllers/lookout/filters/pages/exit_pages_controller.rb +15 -0
- data/app/controllers/lookout/filters/properties/names_controller.rb +29 -0
- data/app/controllers/lookout/filters/properties/values_controller.rb +15 -0
- data/app/controllers/lookout/filters/screens_controller.rb +11 -0
- data/app/controllers/lookout/filters/sources_controller.rb +11 -0
- data/app/controllers/lookout/filters/utms_controller.rb +10 -0
- data/app/controllers/lookout/funnels_controller.rb +8 -0
- data/app/controllers/lookout/goals_controller.rb +7 -0
- data/app/controllers/lookout/locations/cities_controller.rb +22 -0
- data/app/controllers/lookout/locations/countries_controller.rb +22 -0
- data/app/controllers/lookout/locations/maps_controller.rb +24 -0
- data/app/controllers/lookout/locations/regions_controller.rb +22 -0
- data/app/controllers/lookout/properties_controller.rb +73 -0
- data/app/controllers/lookout/realtimes_controller.rb +7 -0
- data/app/controllers/lookout/roots_controller.rb +6 -0
- data/app/controllers/lookout/sources_controller.rb +21 -0
- data/app/controllers/lookout/stats/base_controller.rb +148 -0
- data/app/controllers/lookout/stats/bounce_rates_controller.rb +12 -0
- data/app/controllers/lookout/stats/total_pageviews_controller.rb +10 -0
- data/app/controllers/lookout/stats/total_visits_controller.rb +10 -0
- data/app/controllers/lookout/stats/unique_visitors_controller.rb +11 -0
- data/app/controllers/lookout/stats/views_per_visits_controller.rb +11 -0
- data/app/controllers/lookout/stats/visit_durations_controller.rb +10 -0
- data/app/controllers/lookout/stats_controller.rb +7 -0
- data/app/controllers/lookout/top_pages_controller.rb +20 -0
- data/app/decorators/lookout/application_decorator.rb +58 -0
- data/app/decorators/lookout/campaign_decorator.rb +27 -0
- data/app/decorators/lookout/city_decorator.rb +24 -0
- data/app/decorators/lookout/country_decorator.rb +38 -0
- data/app/decorators/lookout/device_decorator.rb +27 -0
- data/app/decorators/lookout/entry_page_decorator.rb +7 -0
- data/app/decorators/lookout/exit_page_decorator.rb +7 -0
- data/app/decorators/lookout/page_decorator.rb +27 -0
- data/app/decorators/lookout/region_decorator.rb +28 -0
- data/app/decorators/lookout/source_decorator.rb +27 -0
- data/app/decorators/lookout/top_page_decorator.rb +7 -0
- data/app/helpers/lookout/application_helper.rb +124 -0
- data/app/models/concerns/lookout/compare_mode.rb +19 -0
- data/app/models/concerns/lookout/limitable.rb +17 -0
- data/app/models/concerns/lookout/range_options.rb +8 -0
- data/app/models/lookout/comparison_mode.rb +72 -0
- data/app/models/lookout/export.rb +48 -0
- data/app/models/lookout/filter_parser.rb +82 -0
- data/app/models/lookout/range_from_params.rb +78 -0
- data/app/models/lookout/rangeable.rb +7 -0
- data/app/models/lookout/widget.rb +15 -0
- data/app/presenters/lookout/dashboard_presenter.rb +53 -0
- data/app/presenters/lookout/funnel_presenter.rb +75 -0
- data/app/presenters/lookout/goals_presenter.rb +72 -0
- data/app/queries/concerns/lookout/comparable_queries.rb +25 -0
- data/app/queries/concerns/lookout/comparable_query.rb +152 -0
- data/app/queries/concerns/lookout/lazy_comparable_query.rb +42 -0
- data/app/queries/lookout/application_query.rb +186 -0
- data/app/queries/lookout/campaign_query.rb +14 -0
- data/app/queries/lookout/city_query.rb +14 -0
- data/app/queries/lookout/country_query.rb +10 -0
- data/app/queries/lookout/device_query.rb +10 -0
- data/app/queries/lookout/entry_pages_query.rb +18 -0
- data/app/queries/lookout/event_query.rb +42 -0
- data/app/queries/lookout/exit_pages_query.rb +19 -0
- data/app/queries/lookout/region_query.rb +14 -0
- data/app/queries/lookout/source_query.rb +11 -0
- data/app/queries/lookout/stats/average_views_per_visit_query.rb +20 -0
- data/app/queries/lookout/stats/average_visit_duration_query.rb +34 -0
- data/app/queries/lookout/stats/base_query.rb +18 -0
- data/app/queries/lookout/stats/bounce_rates_query.rb +33 -0
- data/app/queries/lookout/stats/total_pageviews_query.rb +9 -0
- data/app/queries/lookout/stats/total_visitors_query.rb +9 -0
- data/app/queries/lookout/stats/unique_visitors_query.rb +9 -0
- data/app/queries/lookout/stats/views_per_visit_query.rb +17 -0
- data/app/queries/lookout/stats/visit_duration_query.rb +19 -0
- data/app/queries/lookout/top_page_query.rb +13 -0
- data/app/queries/lookout/visit_query.rb +42 -0
- data/app/views/lookout/campaigns/index.html+details.erb +4 -0
- data/app/views/lookout/campaigns/index.html.erb +3 -0
- data/app/views/lookout/devices/_table.html.erb +2 -0
- data/app/views/lookout/devices/index.html+details.erb +4 -0
- data/app/views/lookout/devices/index.html.erb +3 -0
- data/app/views/lookout/entry_pages/index.html+details.erb +4 -0
- data/app/views/lookout/entry_pages/index.html.erb +3 -0
- data/app/views/lookout/exit_pages/index.html+details.erb +4 -0
- data/app/views/lookout/exit_pages/index.html.erb +3 -0
- data/app/views/lookout/funnels/index.html.erb +7 -0
- data/app/views/lookout/funnels/show.html.erb +15 -0
- data/app/views/lookout/goals/index.html.erb +4 -0
- data/app/views/lookout/layouts/application.html.erb +144 -0
- data/app/views/lookout/layouts/shared/_tile_loader.html.erb +5 -0
- data/app/views/lookout/layouts/shared/_widget_disabled.html+details.erb +3 -0
- data/app/views/lookout/layouts/shared/_widget_disabled.html.erb +3 -0
- data/app/views/lookout/locations/cities/index.html+details.erb +4 -0
- data/app/views/lookout/locations/cities/index.html.erb +3 -0
- data/app/views/lookout/locations/countries/index.html+details.erb +5 -0
- data/app/views/lookout/locations/countries/index.html.erb +3 -0
- data/app/views/lookout/locations/maps/_simple_map.html.erb +26 -0
- data/app/views/lookout/locations/maps/show.html.erb +106 -0
- data/app/views/lookout/locations/regions/index.html+details.erb +4 -0
- data/app/views/lookout/locations/regions/index.html.erb +3 -0
- data/app/views/lookout/properties/_form.html.erb +6 -0
- data/app/views/lookout/properties/index.html.erb +3 -0
- data/app/views/lookout/properties/show.html.erb +6 -0
- data/app/views/lookout/realtimes/show.html.erb +9 -0
- data/app/views/lookout/roots/_filters.html.erb +80 -0
- data/app/views/lookout/roots/show.html.erb +191 -0
- data/app/views/lookout/sources/index.html+details.erb +4 -0
- data/app/views/lookout/sources/index.html.erb +3 -0
- data/app/views/lookout/stats/base/index.html.erb +40 -0
- data/app/views/lookout/stats/show.html.erb +15 -0
- data/app/views/lookout/top_pages/index.html+details.erb +4 -0
- data/app/views/lookout/top_pages/index.html.erb +3 -0
- data/config/routes.rb +69 -0
- data/lib/generators/lookout/install_generator.rb +31 -0
- data/lib/generators/lookout/migration_generator.rb +21 -0
- data/lib/generators/lookout/templates/config.rb.tt +185 -0
- data/lib/generators/lookout/templates/migration.rb.tt +7 -0
- data/lib/lookout/active_record.rb +108 -0
- data/lib/lookout/ahoy/event_methods.rb +75 -0
- data/lib/lookout/ahoy/visit_methods.rb +24 -0
- data/lib/lookout/configuration.rb +58 -0
- data/lib/lookout/database_adapter.rb +168 -0
- data/lib/lookout/engine.rb +47 -0
- data/lib/lookout/filter_configuration/filter.rb +16 -0
- data/lib/lookout/filter_configuration/filter_collection.rb +48 -0
- data/lib/lookout/filters_configuration.rb +77 -0
- data/lib/lookout/funnels.rb +44 -0
- data/lib/lookout/goals.rb +51 -0
- data/lib/lookout/period_collection.rb +115 -0
- data/lib/lookout/predicate_label.rb +7 -0
- data/lib/lookout/railtie.rb +9 -0
- data/lib/lookout/version.rb +3 -0
- data/lib/lookout.rb +78 -0
- metadata +673 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
module Lookout
|
|
2
|
+
class Goal
|
|
3
|
+
attr_accessor :id
|
|
4
|
+
attr_reader :title, :event_query
|
|
5
|
+
def initialize
|
|
6
|
+
@id = nil
|
|
7
|
+
@title = nil
|
|
8
|
+
@event_query = nil
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def label(value)
|
|
12
|
+
@title = value
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def name(value)
|
|
16
|
+
@event_query = -> { ::Lookout.event.where(name: value) }
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def event(value)
|
|
20
|
+
ActiveSupport::Deprecation.warn(
|
|
21
|
+
"event is deprecated. " \
|
|
22
|
+
"Use name instead."
|
|
23
|
+
)
|
|
24
|
+
name(value)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def query(&block)
|
|
28
|
+
@event_query = block
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
class GoalCollection
|
|
33
|
+
include Enumerable
|
|
34
|
+
|
|
35
|
+
def initialize
|
|
36
|
+
@goals = {}.with_indifferent_access
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def register(goal)
|
|
40
|
+
@goals[goal.id] = goal
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def each(&block)
|
|
44
|
+
@goals.values.each(&block)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def [](value)
|
|
48
|
+
@goals[value]
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
module Lookout
|
|
2
|
+
class PeriodCollection
|
|
3
|
+
class Period
|
|
4
|
+
attr_reader :param, :label, :range
|
|
5
|
+
def initialize(param:, label:, range:)
|
|
6
|
+
@param = param
|
|
7
|
+
@label = label
|
|
8
|
+
@range = range
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def self.load_default
|
|
13
|
+
instance = new
|
|
14
|
+
{
|
|
15
|
+
realtime: {
|
|
16
|
+
label: "Realtime",
|
|
17
|
+
range: -> { [1.minute.ago] },
|
|
18
|
+
},
|
|
19
|
+
day: {
|
|
20
|
+
label: "Day",
|
|
21
|
+
range: -> { [Time.current.beginning_of_day, Time.current] },
|
|
22
|
+
},
|
|
23
|
+
'7d': {
|
|
24
|
+
label: "7 Days",
|
|
25
|
+
range: -> { [7.days.ago, Time.current] },
|
|
26
|
+
},
|
|
27
|
+
'30d': {
|
|
28
|
+
label: "30 Days",
|
|
29
|
+
range: -> { [30.days.ago, Time.current] },
|
|
30
|
+
},
|
|
31
|
+
mtd: {
|
|
32
|
+
label: "Month-to-date",
|
|
33
|
+
range: -> { [Time.current.beginning_of_month, Time.current] },
|
|
34
|
+
},
|
|
35
|
+
lastmonth: {
|
|
36
|
+
label: "Last month",
|
|
37
|
+
range: -> { [1.month.ago.beginning_of_month, 1.month.ago.end_of_month] },
|
|
38
|
+
},
|
|
39
|
+
ytd: {
|
|
40
|
+
label: "This year",
|
|
41
|
+
range: -> { [Time.current.beginning_of_year, Time.current] },
|
|
42
|
+
},
|
|
43
|
+
'12mo': {
|
|
44
|
+
label: "12 months",
|
|
45
|
+
range: -> { [12.months.ago.to_datetime, Time.current] },
|
|
46
|
+
},
|
|
47
|
+
all: {
|
|
48
|
+
label: "All-time",
|
|
49
|
+
range: -> { [Date.new(2004, 8, 1).to_datetime, Time.current] },
|
|
50
|
+
},
|
|
51
|
+
}.each do |param, options|
|
|
52
|
+
instance.add(param, options[:label], options[:range])
|
|
53
|
+
end
|
|
54
|
+
instance.default = :'30d'
|
|
55
|
+
instance
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
attr_reader :default, :max
|
|
59
|
+
def initialize
|
|
60
|
+
@periods = {}
|
|
61
|
+
@default = nil
|
|
62
|
+
@max = nil
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def add(param, label, range_proc)
|
|
66
|
+
raise ArgumentError, "range must be a proc, or respond to .call" unless range_proc.respond_to?(:call)
|
|
67
|
+
raise ArgumentError, "range.call must return a range or an array" unless range_proc.call.is_a?(Range) || range_proc.call.is_a?(Array)
|
|
68
|
+
|
|
69
|
+
@periods[param.to_sym] = Period.new(param: param, label: label, range: range_proc)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def delete(param)
|
|
73
|
+
@periods.delete(param.to_sym)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def reset
|
|
77
|
+
@periods = {}
|
|
78
|
+
@default = nil
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def each(&block)
|
|
82
|
+
@periods.each(&block)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def find(value)
|
|
86
|
+
@periods[value.try(:to_sym)]
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def all
|
|
90
|
+
@periods
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def default=(val)
|
|
94
|
+
@default = val.to_sym
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def max=(amount)
|
|
98
|
+
@max = amount
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def for(value)
|
|
102
|
+
if value.nil?
|
|
103
|
+
period = @periods[@default]
|
|
104
|
+
else
|
|
105
|
+
period = (@periods[value.to_sym] || @periods[@default])
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
if period
|
|
109
|
+
period.range.call
|
|
110
|
+
else
|
|
111
|
+
nil
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
end
|
data/lib/lookout.rb
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
require "lookout/version"
|
|
2
|
+
require "lookout/railtie"
|
|
3
|
+
require "lookout/engine"
|
|
4
|
+
require "lookout/goals"
|
|
5
|
+
require "lookout/funnels"
|
|
6
|
+
require "lookout/database_adapter"
|
|
7
|
+
require "lookout/configuration"
|
|
8
|
+
require "lookout/predicate_label"
|
|
9
|
+
require 'lookout/ahoy/visit_methods'
|
|
10
|
+
require 'lookout/ahoy/event_methods'
|
|
11
|
+
|
|
12
|
+
require 'importmap-rails'
|
|
13
|
+
|
|
14
|
+
module Lookout
|
|
15
|
+
class << self
|
|
16
|
+
attr_accessor :configuration
|
|
17
|
+
|
|
18
|
+
def cache
|
|
19
|
+
@cache ||= if config.cache[:enabled]
|
|
20
|
+
config.cache[:store]
|
|
21
|
+
else
|
|
22
|
+
ActiveSupport::Cache::NullStore.new
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Rails 8+ one-liner support:
|
|
27
|
+
# In a host app's config/importmap.rb you can now do:
|
|
28
|
+
# Lookout.importmap(self)
|
|
29
|
+
# This will draw all Lookout pins onto the host's map builder.
|
|
30
|
+
# If no builder is provided, this returns a standalone Importmap::Map (for inlining).
|
|
31
|
+
def importmap(builder = nil)
|
|
32
|
+
if builder
|
|
33
|
+
builder.pin "@hotwired/turbo-rails", to: "turbo.min.js", preload: true
|
|
34
|
+
builder.pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true
|
|
35
|
+
builder.pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true
|
|
36
|
+
builder.pin "application", to: "lookout/application.js", preload: true
|
|
37
|
+
builder.pin "chartjs-plugin-datalabels", to: "https://cdn.jsdelivr.net/npm/chartjs-plugin-datalabels@2", preload: true
|
|
38
|
+
builder.pin "classnames", to: "https://cdnjs.cloudflare.com/ajax/libs/classnames/2.3.2/index.min.js", preload: true
|
|
39
|
+
builder.pin "chartjs-chart-geo", to: "https://cdn.jsdelivr.net/npm/chartjs-chart-geo@4.3.6/build/index.umd.min.js", preload: true
|
|
40
|
+
builder.pin_all_from Lookout::Engine.root.join("app/assets/javascript/lookout/controllers"), under: "controllers", to: "lookout/controllers"
|
|
41
|
+
builder.pin_all_from Lookout::Engine.root.join("app/assets/javascript/lookout/helpers"), under: "helpers", to: "lookout/helpers"
|
|
42
|
+
return builder
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
Importmap::Map.new.draw do
|
|
46
|
+
pin "@hotwired/turbo-rails", to: "turbo.min.js", preload: true
|
|
47
|
+
pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true
|
|
48
|
+
pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true
|
|
49
|
+
pin "application", to: "lookout/application.js", preload: true
|
|
50
|
+
pin "chartjs-plugin-datalabels", to: "https://cdn.jsdelivr.net/npm/chartjs-plugin-datalabels@2", preload: true
|
|
51
|
+
pin "classnames", to: "https://cdnjs.cloudflare.com/ajax/libs/classnames/2.3.2/index.min.js", preload: true
|
|
52
|
+
pin "chartjs-chart-geo", to: "https://cdn.jsdelivr.net/npm/chartjs-chart-geo@4.3.6/build/index.umd.min.js", preload: true
|
|
53
|
+
pin_all_from Lookout::Engine.root.join("app/assets/javascript/lookout/controllers"), under: "controllers", to: "lookout/controllers"
|
|
54
|
+
pin_all_from Lookout::Engine.root.join("app/assets/javascript/lookout/helpers"), under: "helpers", to: "lookout/helpers"
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def config
|
|
59
|
+
self.configuration ||= Configuration.new
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def configure
|
|
63
|
+
yield config
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def event
|
|
67
|
+
@event ||= config.models[:event].constantize
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def visit
|
|
71
|
+
@visit ||= config.models[:visit].constantize
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def none
|
|
75
|
+
@none ||= OpenStruct.new(text: "(none)", value: "!none!")
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|