pagy 9.4.0 → 43.5.5
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/LICENSE.txt +1 -1
- data/apps/calendar.ru +566 -562
- data/apps/demo.ru +246 -182
- data/apps/enable_rails_page_segment.rb +56 -0
- data/apps/index.rb +4 -2
- data/apps/keynav+root_key.ru +316 -0
- data/apps/keynav.ru +255 -0
- data/apps/{keyset_ar.ru → keyset.ru} +33 -42
- data/apps/{keyset_s.ru → keyset_sequel.ru} +32 -40
- data/apps/rails.ru +57 -58
- data/apps/repro.ru +54 -51
- data/bin/pagy +2 -95
- data/config/pagy.rb +33 -207
- data/javascripts/ai_widget.js +90 -0
- data/javascripts/pagy.js +166 -0
- data/javascripts/pagy.min.js +2 -4
- data/javascripts/pagy.mjs +126 -67
- data/javascripts/wand.js +1172 -0
- data/lib/pagy/classes/calendar/calendar.rb +101 -0
- data/lib/pagy/{calendar → classes/calendar}/day.rb +7 -11
- data/lib/pagy/{calendar → classes/calendar}/month.rb +5 -10
- data/lib/pagy/{calendar → classes/calendar}/quarter.rb +10 -15
- data/lib/pagy/classes/calendar/unit.rb +93 -0
- data/lib/pagy/{calendar → classes/calendar}/week.rb +5 -9
- data/lib/pagy/{calendar → classes/calendar}/year.rb +5 -6
- data/lib/pagy/classes/exceptions.rb +26 -0
- data/lib/pagy/classes/keyset/adapters/active_record.rb +50 -0
- data/lib/pagy/classes/keyset/adapters/sequel.rb +62 -0
- data/lib/pagy/classes/keyset/keynav.rb +85 -0
- data/lib/pagy/classes/keyset/keyset.rb +155 -0
- data/lib/pagy/classes/offset/countish.rb +17 -0
- data/lib/pagy/classes/offset/countless.rb +63 -0
- data/lib/pagy/classes/offset/offset.rb +63 -0
- data/lib/pagy/classes/offset/search.rb +34 -0
- data/lib/pagy/classes/request.rb +48 -0
- data/lib/pagy/cli.rb +122 -0
- data/lib/pagy/console.rb +5 -20
- data/lib/pagy/deprecated.rb +84 -0
- data/lib/pagy/modules/abilities/configurable.rb +37 -0
- data/lib/pagy/modules/abilities/countable.rb +23 -0
- data/lib/pagy/modules/abilities/linkable.rb +72 -0
- data/lib/pagy/modules/abilities/rangeable.rb +14 -0
- data/lib/pagy/modules/abilities/shiftable.rb +12 -0
- data/lib/pagy/{b64.rb → modules/b64.rb} +4 -2
- data/lib/pagy/modules/console.rb +33 -0
- data/lib/pagy/modules/i18n/i18n.rb +72 -0
- data/lib/pagy/modules/i18n/p11n/arabic.rb +30 -0
- data/lib/pagy/modules/i18n/p11n/east_slavic.rb +27 -0
- data/lib/pagy/modules/i18n/p11n/one_other.rb +15 -0
- data/lib/pagy/modules/i18n/p11n/one_upto_two_other.rb +15 -0
- data/lib/pagy/modules/i18n/p11n/other.rb +13 -0
- data/lib/pagy/modules/i18n/p11n/polish.rb +27 -0
- data/lib/pagy/modules/i18n/p11n/west_slavic.rb +22 -0
- data/lib/pagy/modules/i18n/p11n.rb +16 -0
- data/lib/pagy/modules/searcher.rb +20 -0
- data/lib/pagy/next.rb +25 -0
- data/lib/pagy/tasks/sync.rb +20 -0
- data/lib/pagy/toolbox/helpers/anchor_tags.rb +19 -0
- data/lib/pagy/toolbox/helpers/bootstrap/input_nav_js.rb +28 -0
- data/lib/pagy/toolbox/helpers/bootstrap/previous_next_html.rb +19 -0
- data/lib/pagy/toolbox/helpers/bootstrap/series_nav.rb +32 -0
- data/lib/pagy/toolbox/helpers/bootstrap/series_nav_js.rb +24 -0
- data/lib/pagy/toolbox/helpers/bulma/input_nav_js.rb +25 -0
- data/lib/pagy/toolbox/helpers/bulma/previous_next_html.rb +20 -0
- data/lib/pagy/toolbox/helpers/bulma/series_nav.rb +31 -0
- data/lib/pagy/toolbox/helpers/bulma/series_nav_js.rb +23 -0
- data/lib/pagy/toolbox/helpers/data_hash.rb +29 -0
- data/lib/pagy/toolbox/helpers/headers_hash.rb +30 -0
- data/lib/pagy/toolbox/helpers/info_tag.rb +30 -0
- data/lib/pagy/toolbox/helpers/input_nav_js.rb +22 -0
- data/lib/pagy/toolbox/helpers/limit_tag_js.rb +25 -0
- data/lib/pagy/toolbox/helpers/loaders.rb +58 -0
- data/lib/pagy/toolbox/helpers/page_url.rb +16 -0
- data/lib/pagy/toolbox/helpers/series_nav.rb +30 -0
- data/lib/pagy/toolbox/helpers/series_nav_js.rb +20 -0
- data/lib/pagy/toolbox/helpers/support/a_lambda.rb +36 -0
- data/lib/pagy/toolbox/helpers/support/data_pagy_attribute.rb +19 -0
- data/lib/pagy/toolbox/helpers/support/nav_aria_label_attribute.rb +10 -0
- data/lib/pagy/toolbox/helpers/support/series.rb +37 -0
- data/lib/pagy/toolbox/helpers/support/wrap_input_nav_js.rb +18 -0
- data/lib/pagy/toolbox/helpers/support/wrap_series_nav.rb +15 -0
- data/lib/pagy/toolbox/helpers/support/wrap_series_nav_js.rb +38 -0
- data/lib/pagy/toolbox/helpers/urls_hash.rb +12 -0
- data/lib/pagy/toolbox/paginators/calendar.rb +34 -0
- data/lib/pagy/toolbox/paginators/countish.rb +38 -0
- data/lib/pagy/toolbox/paginators/countless.rb +22 -0
- data/lib/pagy/toolbox/paginators/elasticsearch_rails.rb +56 -0
- data/lib/pagy/toolbox/paginators/keynav_js.rb +26 -0
- data/lib/pagy/toolbox/paginators/keyset.rb +15 -0
- data/lib/pagy/toolbox/paginators/meilisearch.rb +34 -0
- data/lib/pagy/toolbox/paginators/method.rb +38 -0
- data/lib/pagy/toolbox/paginators/offset.rb +24 -0
- data/lib/pagy/toolbox/paginators/searchkick.rb +34 -0
- data/lib/pagy/toolbox/paginators/typesense_rails.rb +34 -0
- data/lib/pagy.rb +79 -89
- data/locales/ar.yml +9 -6
- data/locales/be.yml +9 -6
- data/locales/bg.yml +9 -6
- data/locales/bs.yml +9 -6
- data/locales/ca.yml +9 -6
- data/locales/ckb.yml +8 -6
- data/locales/cs.yml +9 -6
- data/locales/da.yml +9 -6
- data/locales/de.yml +9 -6
- data/locales/dz.yml +9 -6
- data/locales/en.yml +9 -6
- data/locales/es.yml +9 -6
- data/locales/fr.yml +9 -6
- data/locales/hr.yml +9 -6
- data/locales/hu.yml +24 -0
- data/locales/id.yml +10 -9
- data/locales/it.yml +9 -6
- data/locales/ja.yml +10 -9
- data/locales/km.yml +10 -9
- data/locales/ko.yml +9 -6
- data/locales/nb.yml +9 -6
- data/locales/nl.yml +9 -6
- data/locales/nn.yml +9 -6
- data/locales/pl.yml +9 -6
- data/locales/pt-BR.yml +10 -7
- data/locales/pt.yml +10 -7
- data/locales/ru.yml +9 -6
- data/locales/sk.yml +9 -6
- data/locales/sr.yml +9 -6
- data/locales/sv-SE.yml +9 -6
- data/locales/sv.yml +9 -6
- data/locales/sw.yml +12 -9
- data/locales/ta.yml +9 -6
- data/locales/tr.yml +17 -12
- data/locales/uk.yml +9 -6
- data/locales/vi.yml +9 -6
- data/locales/zh-CN.yml +9 -6
- data/locales/zh-HK.yml +9 -6
- data/locales/zh-TW.yml +9 -6
- data/stylesheets/pagy-tailwind.css +68 -0
- data/stylesheets/pagy.css +64 -27
- metadata +134 -53
- data/javascripts/pagy.min.js.map +0 -10
- data/lib/optimist.rb +0 -1022
- data/lib/pagy/backend.rb +0 -44
- data/lib/pagy/calendar/unit.rb +0 -103
- data/lib/pagy/calendar.rb +0 -84
- data/lib/pagy/countless.rb +0 -38
- data/lib/pagy/exceptions.rb +0 -25
- data/lib/pagy/extras/arel.rb +0 -28
- data/lib/pagy/extras/array.rb +0 -19
- data/lib/pagy/extras/bootstrap.rb +0 -97
- data/lib/pagy/extras/bulma.rb +0 -93
- data/lib/pagy/extras/calendar.rb +0 -79
- data/lib/pagy/extras/countless.rb +0 -32
- data/lib/pagy/extras/elasticsearch_rails.rb +0 -71
- data/lib/pagy/extras/gearbox.rb +0 -55
- data/lib/pagy/extras/headers.rb +0 -54
- data/lib/pagy/extras/i18n.rb +0 -26
- data/lib/pagy/extras/js_tools.rb +0 -70
- data/lib/pagy/extras/jsonapi.rb +0 -88
- data/lib/pagy/extras/keyset.rb +0 -30
- data/lib/pagy/extras/limit.rb +0 -63
- data/lib/pagy/extras/meilisearch.rb +0 -57
- data/lib/pagy/extras/metadata.rb +0 -42
- data/lib/pagy/extras/overflow.rb +0 -81
- data/lib/pagy/extras/pagy.rb +0 -82
- data/lib/pagy/extras/searchkick.rb +0 -59
- data/lib/pagy/extras/size.rb +0 -40
- data/lib/pagy/extras/standalone.rb +0 -60
- data/lib/pagy/extras/trim.rb +0 -29
- data/lib/pagy/frontend.rb +0 -99
- data/lib/pagy/i18n.rb +0 -167
- data/lib/pagy/keyset/active_record.rb +0 -44
- data/lib/pagy/keyset/sequel.rb +0 -57
- data/lib/pagy/keyset.rb +0 -118
- data/lib/pagy/shared_methods.rb +0 -26
- data/lib/pagy/url_helpers.rb +0 -26
- data/stylesheets/pagy.scss +0 -48
- data/stylesheets/pagy.tailwind.css +0 -21
data/apps/repro.ru
CHANGED
|
@@ -4,44 +4,43 @@
|
|
|
4
4
|
# Reproduce generic/simple issues
|
|
5
5
|
#
|
|
6
6
|
# DOC
|
|
7
|
-
# https://ddnexus.github.io/pagy/playground/#
|
|
7
|
+
# https://ddnexus.github.io/pagy/playground/#repro-app
|
|
8
8
|
#
|
|
9
9
|
# BIN HELP
|
|
10
|
-
#
|
|
10
|
+
# pagy -h
|
|
11
11
|
#
|
|
12
12
|
# DEV USAGE
|
|
13
|
-
#
|
|
14
|
-
#
|
|
13
|
+
# pagy clone repro
|
|
14
|
+
# pagy ./repro.ru
|
|
15
15
|
#
|
|
16
16
|
# URL
|
|
17
|
-
# http://
|
|
17
|
+
# http://127.0.0.1:8000
|
|
18
18
|
|
|
19
|
-
VERSION = '
|
|
19
|
+
VERSION = '43.5.5'
|
|
20
|
+
|
|
21
|
+
if VERSION != Pagy::VERSION
|
|
22
|
+
Warning.warn("\n>>> WARNING! '#{File.basename(__FILE__)}-#{VERSION}' running with 'pagy-#{Pagy::VERSION}'! <<< \n\n")
|
|
23
|
+
end
|
|
24
|
+
run_from_repo = Pagy::ROOT.join('pagy.gemspec').exist?
|
|
20
25
|
|
|
21
26
|
# Bundle
|
|
22
27
|
require 'bundler/inline'
|
|
23
|
-
|
|
24
|
-
Bundler.configure
|
|
25
|
-
gemfile(ENV['PAGY_INSTALL_BUNDLE'] == 'true') do
|
|
28
|
+
gemfile(!run_from_repo) do
|
|
26
29
|
source 'https://rubygems.org'
|
|
27
30
|
gem 'oj'
|
|
28
31
|
gem 'puma'
|
|
29
32
|
gem 'sinatra'
|
|
30
33
|
end
|
|
31
34
|
|
|
32
|
-
# Edit this section adding
|
|
33
|
-
#
|
|
34
|
-
|
|
35
|
-
require 'pagy/extras/limit'
|
|
36
|
-
require 'pagy/extras/overflow'
|
|
37
|
-
Pagy::DEFAULT[:overflow] = :empty_page
|
|
38
|
-
Pagy::DEFAULT.freeze
|
|
35
|
+
# Edit this section adding the legacy as needed
|
|
36
|
+
# Pagy initializer
|
|
37
|
+
Pagy::OPTIONS[:max_limit] = 100
|
|
39
38
|
|
|
40
39
|
# Sinatra setup
|
|
41
40
|
require 'sinatra/base'
|
|
42
41
|
# Sinatra application
|
|
43
42
|
class PagyRepro < Sinatra::Base
|
|
44
|
-
include Pagy::
|
|
43
|
+
include Pagy::Method
|
|
45
44
|
|
|
46
45
|
get('/javascripts/:file') do
|
|
47
46
|
format = params[:file].split('.').last
|
|
@@ -50,30 +49,29 @@ class PagyRepro < Sinatra::Base
|
|
|
50
49
|
elsif format == 'map'
|
|
51
50
|
content_type 'application/json'
|
|
52
51
|
end
|
|
53
|
-
send_file Pagy.
|
|
52
|
+
send_file Pagy::ROOT.join('javascripts', params[:file])
|
|
54
53
|
end
|
|
55
54
|
|
|
56
55
|
# Edit this action as needed
|
|
57
56
|
get '/' do
|
|
58
57
|
collection = MockCollection.new
|
|
59
|
-
@pagy, @records = pagy(collection)
|
|
58
|
+
@pagy, @records = pagy(collection) # simplest form
|
|
59
|
+
# @pagy, @records = pagy(:offset, collection, limit: 7, max_limit: 30)
|
|
60
|
+
# @pagy, @records = pagy(:countish, collection, ttl: 20)
|
|
61
|
+
# @pagy, @records = pagy(:countless, collection)
|
|
62
|
+
# @pagy, @records = pagy(Array(1..1000))
|
|
63
|
+
# response.headers.merge!(@pagy.headers_hash)
|
|
60
64
|
erb :main
|
|
61
65
|
end
|
|
62
66
|
|
|
63
|
-
# Edit this section adding your own helpers as needed
|
|
64
|
-
helpers do
|
|
65
|
-
include Pagy::Frontend
|
|
66
|
-
end
|
|
67
|
-
|
|
68
67
|
# Views
|
|
69
68
|
template :layout do
|
|
70
69
|
<<~ERB
|
|
71
70
|
<!DOCTYPE html>
|
|
72
71
|
<html lang="en">
|
|
73
|
-
<html>
|
|
74
72
|
<head>
|
|
75
|
-
|
|
76
|
-
<script src="javascripts/pagy.
|
|
73
|
+
<title>Pagy Repro App</title>
|
|
74
|
+
<script src="javascripts/pagy.js"></script>
|
|
77
75
|
<script>
|
|
78
76
|
window.addEventListener("load", Pagy.init);
|
|
79
77
|
</script>
|
|
@@ -81,7 +79,7 @@ class PagyRepro < Sinatra::Base
|
|
|
81
79
|
<style type="text/css">
|
|
82
80
|
@media screen { html, body {
|
|
83
81
|
font-size: 1rem;
|
|
84
|
-
line-height: 1.
|
|
82
|
+
line-height: 1.2;
|
|
85
83
|
padding: 0;
|
|
86
84
|
margin: 0;
|
|
87
85
|
} }
|
|
@@ -90,10 +88,15 @@ class PagyRepro < Sinatra::Base
|
|
|
90
88
|
margin: 0 !important;
|
|
91
89
|
font-family: sans-serif !important;
|
|
92
90
|
}
|
|
93
|
-
.content {
|
|
91
|
+
.main-content {
|
|
94
92
|
padding: 1rem 1.5rem 2rem !important;
|
|
95
93
|
}
|
|
96
|
-
|
|
94
|
+
.pagy, .pagy-bootstrap, .pagy-bulma {
|
|
95
|
+
padding: .5em;
|
|
96
|
+
margin: .3em 0;
|
|
97
|
+
width: fit-content;
|
|
98
|
+
box-shadow: 5px 5px 10px 0px rgba(0,0,0,0.2);
|
|
99
|
+
}
|
|
97
100
|
/* Quick demo for overriding the element style attribute of certain pagy helpers
|
|
98
101
|
.pagy input[style] {
|
|
99
102
|
width: 5rem !important;
|
|
@@ -104,7 +107,7 @@ class PagyRepro < Sinatra::Base
|
|
|
104
107
|
If you want to customize the style,
|
|
105
108
|
please replace the line below with the actual file content
|
|
106
109
|
*/
|
|
107
|
-
<%= Pagy.
|
|
110
|
+
<%= Pagy::ROOT.join('stylesheets/pagy.css').read %>
|
|
108
111
|
</style>
|
|
109
112
|
</head>
|
|
110
113
|
<body>
|
|
@@ -116,11 +119,11 @@ class PagyRepro < Sinatra::Base
|
|
|
116
119
|
|
|
117
120
|
template :main do
|
|
118
121
|
<<~ERB
|
|
119
|
-
<div class="content">
|
|
122
|
+
<div class="main-content">
|
|
120
123
|
<h1>Pagy Repro App</h1>
|
|
121
124
|
<p> Self-contained, standalone app usable to easily reproduce any pagy issue.</p>
|
|
122
|
-
|
|
123
|
-
<h2>Versions</
|
|
125
|
+
|
|
126
|
+
<h2>Versions</h2>
|
|
124
127
|
<ul>
|
|
125
128
|
<li>Ruby: <%= RUBY_VERSION %></li>
|
|
126
129
|
<li>Rack: <%= Rack::RELEASE %></li>
|
|
@@ -133,31 +136,31 @@ class PagyRepro < Sinatra::Base
|
|
|
133
136
|
|
|
134
137
|
<hr>
|
|
135
138
|
|
|
136
|
-
<h4
|
|
137
|
-
<%=
|
|
138
|
-
|
|
139
|
-
<h4>pagy_nav_js</h4>
|
|
140
|
-
<%= pagy_nav_js(@pagy, id: 'nav-js', aria_label: 'Pages nav_js') %>
|
|
139
|
+
<h4>@pagy.series_nav</h4>
|
|
140
|
+
<%= @pagy.series_nav(id: 'series-nav',
|
|
141
|
+
aria_label: 'Pages nav') %>
|
|
141
142
|
|
|
142
|
-
<h4
|
|
143
|
-
<%=
|
|
144
|
-
|
|
143
|
+
<h4>@pagy.series_nav_js (responsive)</h4>
|
|
144
|
+
<%= @pagy.series_nav_js(id: 'series-nav-js-responsive',
|
|
145
|
+
aria_label: 'Pages nav_js_responsive',
|
|
146
|
+
steps: { 0 => 5, 500 => 7, 600 => 9, 700 => 11 }) %>
|
|
145
147
|
|
|
146
|
-
<h4
|
|
147
|
-
<%=
|
|
148
|
+
<h4>@pagy.input_nav_js</h4>
|
|
149
|
+
<%= @pagy.input_nav_js(id: 'input-nav-js',
|
|
150
|
+
aria_label: 'Pages input_nav_js') %>
|
|
148
151
|
|
|
149
|
-
<h4
|
|
150
|
-
<%=
|
|
152
|
+
<h4>@pagy.limit_tag_js</h4>
|
|
153
|
+
<%= @pagy.limit_tag_js(id: 'limit-tag-js') %>
|
|
151
154
|
|
|
152
|
-
<h4
|
|
153
|
-
<%=
|
|
155
|
+
<h4>@pagy.info_tag</h4>
|
|
156
|
+
<%= @pagy.info_tag(id: 'pagy-info') %>
|
|
154
157
|
</div>
|
|
155
158
|
ERB
|
|
156
159
|
end
|
|
157
160
|
end
|
|
158
161
|
|
|
159
162
|
# Simple array-based collection that acts as a standard DB collection.
|
|
160
|
-
# Use it as a simple way to get a collection that acts as
|
|
163
|
+
# Use it as a simple way to get a collection that acts as an AR scope, but without any DB
|
|
161
164
|
# or create an ActiveRecord class or anything else that you need instead
|
|
162
165
|
class MockCollection < Array
|
|
163
166
|
def initialize(arr = Array(1..1000))
|
|
@@ -166,12 +169,12 @@ class MockCollection < Array
|
|
|
166
169
|
end
|
|
167
170
|
|
|
168
171
|
def offset(value)
|
|
169
|
-
@collection = self[value..]
|
|
172
|
+
@collection = self[value..] || []
|
|
170
173
|
self
|
|
171
174
|
end
|
|
172
175
|
|
|
173
176
|
def limit(value)
|
|
174
|
-
@collection[0, value]
|
|
177
|
+
@collection.empty? ? [] : @collection[0, value]
|
|
175
178
|
end
|
|
176
179
|
|
|
177
180
|
def count(*)
|
data/bin/pagy
CHANGED
|
@@ -1,98 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
HOST = '0.0.0.0'
|
|
7
|
-
PORT = '8000'
|
|
8
|
-
|
|
9
|
-
require_relative '../lib/optimist'
|
|
10
|
-
require_relative '../apps/index'
|
|
11
|
-
apps = PagyApps::INDEX
|
|
12
|
-
opts = Optimist.options do
|
|
13
|
-
text <<~HEAD
|
|
14
|
-
Pagy #{VERSION} (https://ddnexus.github.io/pagy/playground)
|
|
15
|
-
Playground to showcase, clone and develop pagy APPs
|
|
16
|
-
APPs
|
|
17
|
-
#{ apps.map do |name, path|
|
|
18
|
-
" #{name}#{' ' * (27 - name.length)}#{File.readlines(path)[3].sub('# ', '').strip}"
|
|
19
|
-
end.join("\n")
|
|
20
|
-
}
|
|
21
|
-
USAGE
|
|
22
|
-
pagy APP [options] Showcase APP from the installed gem
|
|
23
|
-
pagy clone APP Clone APP to the current dir
|
|
24
|
-
pagy APPFILE [options] Develop APPFILE from local path
|
|
25
|
-
EXAMPLES
|
|
26
|
-
pagy demo Showcase demo at http://#{HOST}:#{PORT}
|
|
27
|
-
pagy clone repro Clone repro to ./repro.ru
|
|
28
|
-
pagy ~/my-repro.ru Develop ~/my-repro.ru at#{HOST}:#{PORT}
|
|
29
|
-
HEAD
|
|
30
|
-
text 'Rackup options'
|
|
31
|
-
opt :env, 'Environment', default: 'development'
|
|
32
|
-
opt :host, 'Host', default: HOST, short: :o
|
|
33
|
-
opt :port, 'Port', default: PORT
|
|
34
|
-
opt :install, 'Install bundle for users', default: true
|
|
35
|
-
if LINUX
|
|
36
|
-
text 'Rerun options'
|
|
37
|
-
opt :rerun, 'Enable rerun for development', default: true
|
|
38
|
-
opt :clear, 'Clear screen before each rerun'
|
|
39
|
-
end
|
|
40
|
-
text 'Other options'
|
|
41
|
-
opt :quiet, 'Quiet mode for development'
|
|
42
|
-
version VERSION
|
|
43
|
-
end
|
|
44
|
-
Optimist.educate if ARGV.empty?
|
|
45
|
-
|
|
46
|
-
run_from_repo = File.exist?(File.expand_path('../pagy.gemspec', __dir__))
|
|
47
|
-
|
|
48
|
-
# Bundle
|
|
49
|
-
require 'bundler/inline'
|
|
50
|
-
require 'bundler'
|
|
51
|
-
Bundler.configure
|
|
52
|
-
gemfile(opts[:install]) do
|
|
53
|
-
source 'https://rubygems.org'
|
|
54
|
-
gem 'rackup'
|
|
55
|
-
gem 'rerun' if LINUX
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
arg = ARGV.shift
|
|
59
|
-
if arg.eql?('clone')
|
|
60
|
-
name = ARGV.shift
|
|
61
|
-
Optimist.die("Expected APP to be in [#{apps.keys.join(', ')}]; got #{name.inspect}") unless apps.key?(name)
|
|
62
|
-
if File.exist?(name)
|
|
63
|
-
print "Do you want to overwrite the #{name.inspect} file? (y/n)> "
|
|
64
|
-
answer = gets.chomp
|
|
65
|
-
Optimist.die("#{name.inspect} file already present") unless answer.start_with?(/y/i)
|
|
66
|
-
end
|
|
67
|
-
require 'fileutils'
|
|
68
|
-
FileUtils.cp(apps[name], '.', verbose: true)
|
|
69
|
-
else
|
|
70
|
-
if apps.key?(arg) # showcase env
|
|
71
|
-
opts[:env] = 'showcase'
|
|
72
|
-
opts[:rerun] = false
|
|
73
|
-
opts[:quiet] = true
|
|
74
|
-
# Avoid the creation of './tmp/local_secret.txt' for showcase env
|
|
75
|
-
ENV['SECRET_KEY_BASE'] = 'absolute secret!' if arg.eql?('rails')
|
|
76
|
-
file = apps[arg]
|
|
77
|
-
else # development env
|
|
78
|
-
file = arg
|
|
79
|
-
end
|
|
80
|
-
Optimist.die("#{file.inspect} app not found") unless File.exist?(file)
|
|
81
|
-
# Run command
|
|
82
|
-
gem_dir = File.expand_path('..', __dir__)
|
|
83
|
-
rackup = "rackup -I #{gem_dir}/lib -r pagy -o #{opts[:host]} -p #{opts[:port]} -E #{opts[:env]} #{file}"
|
|
84
|
-
rackup << ' -q' if opts[:quiet]
|
|
85
|
-
if opts[:rerun]
|
|
86
|
-
name = File.basename(file)
|
|
87
|
-
dir = File.dirname(file)
|
|
88
|
-
rerun = if run_from_repo # rerun app also when gem dir files change (for pagy devs)
|
|
89
|
-
"rerun --name #{name} -d #{dir},#{gem_dir} -p **/*.{rb,js,css,scss,ru,yml}"
|
|
90
|
-
else
|
|
91
|
-
"rerun --name #{name} -d #{dir} -p #{name}" # rerun only when app.ru changes
|
|
92
|
-
end
|
|
93
|
-
rerun << ' -q' if opts[:quiet]
|
|
94
|
-
rerun << ' -c' if opts[:clear]
|
|
95
|
-
rerun << " -- #{rackup}"
|
|
96
|
-
end
|
|
97
|
-
exec("PAGY_INSTALL_BUNDLE='#{opts[:install]}' #{rerun || rackup}")
|
|
98
|
-
end
|
|
4
|
+
require_relative '../lib/pagy/cli'
|
|
5
|
+
Pagy::CLI.new.start
|
data/config/pagy.rb
CHANGED
|
@@ -1,220 +1,46 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Pagy initializer file (
|
|
4
|
-
#
|
|
5
|
-
# Should you just cherry pick part of this file, please maintain the require-order of the extras
|
|
3
|
+
# Pagy initializer file (43.5.5)
|
|
4
|
+
# See https://ddnexus.github.io/pagy/toolbox/configuration/initializer/
|
|
6
5
|
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
# See https://ddnexus.github.io/pagy/
|
|
10
|
-
#
|
|
11
|
-
# Pagy.new|Pagy::Countless.new|Pagy::Calendar::*.new or any of the #pagy* controller methods
|
|
12
|
-
# Here are the few that make more sense as DEFAULTs:
|
|
13
|
-
# Pagy::DEFAULT[:limit] = 20 # default
|
|
14
|
-
# Pagy::DEFAULT[:size] = 7 # default
|
|
15
|
-
# Pagy::DEFAULT[:ends] = true # default
|
|
16
|
-
# Pagy::DEFAULT[:page_param] = :page # default
|
|
17
|
-
# Pagy::DEFAULT[:count_args] = [] # example for non AR ORMs
|
|
18
|
-
# Pagy::DEFAULT[:max_pages] = 3000 # example
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
# Extras
|
|
22
|
-
# See https://ddnexus.github.io/pagy/categories/extra
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
# Legacy Compatibility Extras
|
|
26
|
-
|
|
27
|
-
# Size extra: Enable the Array type for the `:size` variable (e.g. `size: [1,4,4,1]`)
|
|
28
|
-
# See https://ddnexus.github.io/pagy/docs/extras/size
|
|
29
|
-
# require 'pagy/extras/size' # must be required before the other extras
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
# Backend Extras
|
|
33
|
-
|
|
34
|
-
# Arel extra: For better performance utilizing grouped ActiveRecord collections:
|
|
35
|
-
# See: https://ddnexus.github.io/pagy/docs/extras/arel
|
|
36
|
-
# require 'pagy/extras/arel'
|
|
37
|
-
|
|
38
|
-
# Array extra: Paginate arrays efficiently, avoiding expensive array-wrapping and without overriding
|
|
39
|
-
# See https://ddnexus.github.io/pagy/docs/extras/array
|
|
40
|
-
# require 'pagy/extras/array'
|
|
41
|
-
|
|
42
|
-
# Calendar extra: Add pagination filtering by calendar time unit (year, quarter, month, week, day)
|
|
43
|
-
# See https://ddnexus.github.io/pagy/docs/extras/calendar
|
|
44
|
-
# require 'pagy/extras/calendar'
|
|
45
|
-
# Default for each calendar unit class in IRB:
|
|
46
|
-
# >> Pagy::Calendar::Year::DEFAULT
|
|
47
|
-
# >> Pagy::Calendar::Quarter::DEFAULT
|
|
48
|
-
# >> Pagy::Calendar::Month::DEFAULT
|
|
49
|
-
# >> Pagy::Calendar::Week::DEFAULT
|
|
50
|
-
# >> Pagy::Calendar::Day::DEFAULT
|
|
7
|
+
############ Global Options ################################################################
|
|
8
|
+
# See https://ddnexus.github.io/pagy/toolbox/configuration/options/ for details.
|
|
9
|
+
# Examples:
|
|
51
10
|
#
|
|
52
|
-
#
|
|
53
|
-
#
|
|
54
|
-
#
|
|
55
|
-
# ::I18n.l(time, **opts)
|
|
56
|
-
# end
|
|
57
|
-
# end
|
|
58
|
-
# Pagy::Calendar.prepend LocalizePagyCalendar
|
|
59
|
-
|
|
60
|
-
# Countless extra: Paginate without any count, saving one query per rendering
|
|
61
|
-
# See https://ddnexus.github.io/pagy/docs/extras/countless
|
|
62
|
-
# require 'pagy/extras/countless'
|
|
63
|
-
# Pagy::DEFAULT[:countless_minimal] = false # default (eager loading)
|
|
64
|
-
|
|
65
|
-
# Elasticsearch Rails extra: Paginate `ElasticsearchRails::Results` objects
|
|
66
|
-
# See https://ddnexus.github.io/pagy/docs/extras/elasticsearch_rails
|
|
67
|
-
# Default :pagy_search method: change only if you use also
|
|
68
|
-
# the searchkick or meilisearch extra that defines the same
|
|
69
|
-
# Pagy::DEFAULT[:elasticsearch_rails_pagy_search] = :pagy_search
|
|
70
|
-
# Default original :search method called internally to do the actual search
|
|
71
|
-
# Pagy::DEFAULT[:elasticsearch_rails_search] = :search
|
|
72
|
-
# require 'pagy/extras/elasticsearch_rails'
|
|
73
|
-
|
|
74
|
-
# Headers extra: http response headers (and other helpers) useful for API pagination
|
|
75
|
-
# See https://ddnexus.github.io/pagy/docs/extras/headers
|
|
76
|
-
# require 'pagy/extras/headers'
|
|
77
|
-
# Pagy::DEFAULT[:headers] = { page: 'Current-Page',
|
|
78
|
-
# limit: 'Page-Items',
|
|
79
|
-
# count: 'Total-Count',
|
|
80
|
-
# pages: 'Total-Pages' } # default
|
|
81
|
-
|
|
82
|
-
# Keyset extra: Paginate with the Pagy keyset pagination technique
|
|
83
|
-
# See https://ddnexus.github.io/pagy/docs/extras/keyset
|
|
84
|
-
# require 'pagy/extras/keyset'
|
|
85
|
-
|
|
86
|
-
# Meilisearch extra: Paginate `Meilisearch` result objects
|
|
87
|
-
# See https://ddnexus.github.io/pagy/docs/extras/meilisearch
|
|
88
|
-
# Default :pagy_search method: change only if you use also
|
|
89
|
-
# the elasticsearch_rails or searchkick extra that define the same method
|
|
90
|
-
# Pagy::DEFAULT[:meilisearch_pagy_search] = :pagy_search
|
|
91
|
-
# Default original :search method called internally to do the actual search
|
|
92
|
-
# Pagy::DEFAULT[:meilisearch_search] = :ms_search
|
|
93
|
-
# require 'pagy/extras/meilisearch'
|
|
94
|
-
|
|
95
|
-
# Metadata extra: Provides the pagination metadata to Javascript frameworks like Vue.js, react.js, etc.
|
|
96
|
-
# See https://ddnexus.github.io/pagy/docs/extras/metadata
|
|
97
|
-
# you must require the JS Tools internal extra (BEFORE the metadata extra) ONLY if you need also the :sequels
|
|
98
|
-
# require 'pagy/extras/js_tools'
|
|
99
|
-
# require 'pagy/extras/metadata'
|
|
100
|
-
# For performance reasons, you should explicitly set ONLY the metadata you use in the frontend
|
|
101
|
-
# Pagy::DEFAULT[:metadata] = %i[scaffold_url page prev next last] # example
|
|
102
|
-
|
|
103
|
-
# Searchkick extra: Paginate `Searchkick::Results` objects
|
|
104
|
-
# See https://ddnexus.github.io/pagy/docs/extras/searchkick
|
|
105
|
-
# Default :pagy_search method: change only if you use also
|
|
106
|
-
# the elasticsearch_rails or meilisearch extra that defines the same
|
|
107
|
-
# Pagy::DEFAULT[:searchkick_pagy_search] = :pagy_search
|
|
108
|
-
# Default original :search method called internally to do the actual search
|
|
109
|
-
# Pagy::DEFAULT[:searchkick_search] = :search
|
|
110
|
-
# require 'pagy/extras/searchkick'
|
|
111
|
-
# uncomment if you are going to use Searchkick.pagy_search
|
|
112
|
-
# Searchkick.extend Pagy::Searchkick
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
# Frontend Extras
|
|
11
|
+
# Pagy::OPTIONS[:limit] = 10 # Limit the items per page
|
|
12
|
+
# Pagy::OPTIONS[:max_limit] = 100 # The client is allowed to request a limit up to 100
|
|
13
|
+
# Pagy::OPTIONS[:jsonapi] = true # Use JSON:API compliant URLs
|
|
116
14
|
|
|
117
|
-
|
|
118
|
-
# See https://ddnexus.github.io/pagy/docs/extras/bootstrap
|
|
119
|
-
# require 'pagy/extras/bootstrap'
|
|
15
|
+
Pagy::OPTIONS.freeze
|
|
120
16
|
|
|
121
|
-
|
|
122
|
-
# See https://ddnexus.github.io/pagy/
|
|
123
|
-
#
|
|
124
|
-
|
|
125
|
-
# Pagy extra: Add the pagy styled versions of the javascript-powered navs
|
|
126
|
-
# and a few other components to the Pagy::Frontend module.
|
|
127
|
-
# See https://ddnexus.github.io/pagy/docs/extras/pagy
|
|
128
|
-
# require 'pagy/extras/pagy'
|
|
129
|
-
|
|
130
|
-
# Multi size var used by the *_nav_js helpers
|
|
131
|
-
# See https://ddnexus.github.io/pagy/docs/extras/pagy#steps
|
|
132
|
-
# Pagy::DEFAULT[:steps] = { 0 => 5, 540 => 7, 720 => 9 } # example
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
# Feature Extras
|
|
136
|
-
|
|
137
|
-
# Gearbox extra: Automatically change the limit per page depending on the page number
|
|
138
|
-
# See https://ddnexus.github.io/pagy/docs/extras/gearbox
|
|
139
|
-
# require 'pagy/extras/gearbox'
|
|
140
|
-
# set to false only if you want to make :gearbox_extra an opt-in variable
|
|
141
|
-
# Pagy::DEFAULT[:gearbox_extra] = false # default true
|
|
142
|
-
# Pagy::DEFAULT[:gearbox_limit] = [15, 30, 60, 100] # default
|
|
143
|
-
|
|
144
|
-
# Limit extra: Allow the client to request a custom limit per page with an optional selector UI
|
|
145
|
-
# See https://ddnexus.github.io/pagy/docs/extras/limit
|
|
146
|
-
# require 'pagy/extras/limit'
|
|
147
|
-
# set to false only if you want to make :limit_extra an opt-in variable
|
|
148
|
-
# Pagy::DEFAULT[:limit_extra] = false # default true
|
|
149
|
-
# Pagy::DEFAULT[:limit_param] = :limit # default
|
|
150
|
-
# Pagy::DEFAULT[:limit_max] = 100 # default
|
|
151
|
-
|
|
152
|
-
# Overflow extra: Allow for easy handling of overflowing pages
|
|
153
|
-
# See https://ddnexus.github.io/pagy/docs/extras/overflow
|
|
154
|
-
# require 'pagy/extras/overflow'
|
|
155
|
-
# Pagy::DEFAULT[:overflow] = :empty_page # default (other options: :last_page and :exception)
|
|
156
|
-
|
|
157
|
-
# Trim extra: Remove the page=1 param from links
|
|
158
|
-
# See https://ddnexus.github.io/pagy/docs/extras/trim
|
|
159
|
-
# require 'pagy/extras/trim'
|
|
160
|
-
# set to false only if you want to make :trim_extra an opt-in variable
|
|
161
|
-
# Pagy::DEFAULT[:trim_extra] = false # default true
|
|
162
|
-
|
|
163
|
-
# Standalone extra: Use pagy in non Rack environment/gem
|
|
164
|
-
# See https://ddnexus.github.io/pagy/docs/extras/standalone
|
|
165
|
-
# require 'pagy/extras/standalone'
|
|
166
|
-
# Pagy::DEFAULT[:url] = 'http://www.example.com/subdir' # optional default
|
|
167
|
-
|
|
168
|
-
# Jsonapi extra: Implements JSON:API specifications
|
|
169
|
-
# See https://ddnexus.github.io/pagy/docs/extras/jsonapi
|
|
170
|
-
# require 'pagy/extras/jsonapi' # must be required after the other extras
|
|
171
|
-
# set to false only if you want to make :jsonapi an opt-in variable
|
|
172
|
-
# Pagy::DEFAULT[:jsonapi] = false # default true
|
|
173
|
-
|
|
174
|
-
# Rails
|
|
175
|
-
# Enable the .js file required by the helpers that use javascript
|
|
176
|
-
# (pagy*_nav_js, pagy*_combo_nav_js, and pagy_limit_selector_js)
|
|
177
|
-
# See https://ddnexus.github.io/pagy/docs/api/javascript
|
|
178
|
-
|
|
179
|
-
# With the asset pipeline
|
|
180
|
-
# Sprockets need to look into the pagy javascripts dir, so add it to the assets paths
|
|
181
|
-
# Rails.application.config.assets.paths << Pagy.root.join('javascripts')
|
|
182
|
-
|
|
183
|
-
# I18n
|
|
184
|
-
|
|
185
|
-
# Pagy internal I18n: ~18x faster using ~10x less memory than the i18n gem
|
|
186
|
-
# See https://ddnexus.github.io/pagy/docs/api/i18n
|
|
187
|
-
# Notice: No need to configure anything in this section if your app uses only "en"
|
|
188
|
-
# or if you use the i18n extra below
|
|
189
|
-
#
|
|
190
|
-
# Examples:
|
|
191
|
-
# load the "de" built-in locale:
|
|
192
|
-
# Pagy::I18n.load(locale: 'de')
|
|
17
|
+
############ JS and CSS Resources ##########################################################
|
|
18
|
+
# See https://ddnexus.github.io/pagy/resources/javascript/
|
|
19
|
+
# and https://ddnexus.github.io/pagy/resources/stylesheets/ for details.
|
|
20
|
+
# Sync example:
|
|
193
21
|
#
|
|
194
|
-
#
|
|
195
|
-
#
|
|
22
|
+
# if Rails.env.development?
|
|
23
|
+
# Pagy.sync(:javascript, Rails.root.join('app/javascript'), 'pagy.mjs')
|
|
24
|
+
# Pagy.sync(:stylesheet, Rails.root.join('app/stylesheets'), 'pagy.css')
|
|
25
|
+
# end
|
|
196
26
|
#
|
|
197
|
-
#
|
|
198
|
-
# (the first passed :locale will be used also as the default_locale)
|
|
199
|
-
# Pagy::I18n.load({ locale: 'de' },
|
|
200
|
-
# { locale: 'en' },
|
|
201
|
-
# { locale: 'es' })
|
|
27
|
+
# Pipeline example:
|
|
202
28
|
#
|
|
203
|
-
#
|
|
204
|
-
#
|
|
205
|
-
# (the first passed :locale will be used also as the default_locale)
|
|
206
|
-
# Pagy::I18n.load({ locale: 'en' },
|
|
207
|
-
# { locale: 'es', filepath: 'path/to/pagy-es.yml' },
|
|
208
|
-
# { locale: 'xyz', # not built-in
|
|
209
|
-
# filepath: 'path/to/pagy-xyz.yml',
|
|
210
|
-
# pluralize: lambda{ |count| ... } )
|
|
211
|
-
|
|
29
|
+
# Rails.application.config.assets.paths << Pagy::ROOT.join(':javascripts')
|
|
30
|
+
# Rails.application.config.assets.paths << Pagy::ROOT.join(':stylesheets')
|
|
212
31
|
|
|
213
|
-
|
|
214
|
-
#
|
|
215
|
-
#
|
|
216
|
-
#
|
|
32
|
+
############# Overriding Pagy::I18n Lookup #################################################
|
|
33
|
+
# See https://ddnexus.github.io/pagy/resources/i18n/ for details.
|
|
34
|
+
# Example for Rails:
|
|
35
|
+
#
|
|
36
|
+
# Pagy::I18n.pathnames << Rails.root.join('config/locales/pagy')
|
|
217
37
|
|
|
38
|
+
############# I18n Gem Translation #########################################################
|
|
39
|
+
# See https://ddnexus.github.io/pagy/resources/i18n/ for details.
|
|
40
|
+
#
|
|
41
|
+
# Pagy.translate_with_the_slower_i18n_gem!
|
|
218
42
|
|
|
219
|
-
|
|
220
|
-
|
|
43
|
+
############# Calendar Localization for non-en locales ####################################
|
|
44
|
+
# See https://ddnexus.github.io/pagy/toolbox/paginators/calendar#localization for details.
|
|
45
|
+
#
|
|
46
|
+
# Pagy::Calendar.localize_with_rails_i18n_gem(*your_locales)
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
const PagyAIWidget = {
|
|
2
|
+
HOST_ID: 'gurubase-chat-widget-container',
|
|
3
|
+
IMG_SELECTOR: '#chatWindow > div.anteon-header > div > img',
|
|
4
|
+
NAME_SELECTOR: '#chatWindow > div.anteon-header > div > span',
|
|
5
|
+
DESCRIPTION_SELECTOR: '#chatWindow > div.chat-messages > div > p',
|
|
6
|
+
NEW_IMG_SIZE: '40px',
|
|
7
|
+
NEW_NAME: 'Ask Pagy AI',
|
|
8
|
+
NEW_DESCRIPTION: 'Pagy AI uses the latest data in the documentation to answer your questions.',
|
|
9
|
+
ICON_URL: 'https://github.com/ddnexus/pagy/blob/master/assets/images/pagy-the-frog.png?raw=true',
|
|
10
|
+
skipTurbo: true,
|
|
11
|
+
|
|
12
|
+
checkAndEdit: function() {
|
|
13
|
+
const hostElement = document.getElementById(this.HOST_ID);
|
|
14
|
+
if (hostElement && hostElement.shadowRoot) {
|
|
15
|
+
const shadowRoot = hostElement.shadowRoot;
|
|
16
|
+
const img = shadowRoot.querySelector(this.IMG_SELECTOR);
|
|
17
|
+
const name = shadowRoot.querySelector(this.NAME_SELECTOR);
|
|
18
|
+
const description = shadowRoot.querySelector(this.DESCRIPTION_SELECTOR);
|
|
19
|
+
|
|
20
|
+
if (img) {
|
|
21
|
+
img.style.maxWidth = this.NEW_IMG_SIZE;
|
|
22
|
+
img.style.maxHeight = this.NEW_IMG_SIZE;
|
|
23
|
+
}
|
|
24
|
+
if (name) {
|
|
25
|
+
name.textContent = this.NEW_NAME;
|
|
26
|
+
}
|
|
27
|
+
if (description) {
|
|
28
|
+
description.textContent = this.NEW_DESCRIPTION;
|
|
29
|
+
}
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
return false;
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
attemptEditing: function() {
|
|
36
|
+
if (this.checkAndEdit()) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
setTimeout(() => this.attemptEditing(), 200);
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
editChatWidget: function() {
|
|
43
|
+
this.attemptEditing();
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
appendWidgetScript: function() {
|
|
47
|
+
const script = document.createElement('script');
|
|
48
|
+
const hostname = window.location.hostname;
|
|
49
|
+
|
|
50
|
+
switch (hostname) {
|
|
51
|
+
case 'ddnexus.github.io': // remote docs
|
|
52
|
+
script.dataset.widgetId = 'HKtFSPZLGiAXOdBWS4rSAxEkqv8czIbJoQdMEwCqgEc';
|
|
53
|
+
script.dataset.margins = '{"bottom": "1.48rem", "right": "6rem"}';
|
|
54
|
+
break;
|
|
55
|
+
case 'localhost': // local docs
|
|
56
|
+
script.dataset.widgetId = 'djgBhRlpdH8b07oj0Gsaerz69Xfs0FXMuUluyOo2iR4';
|
|
57
|
+
script.dataset.margins = '{"bottom": "1.48rem", "right": "6rem"}';
|
|
58
|
+
break;
|
|
59
|
+
case '127.0.0.1': // apps
|
|
60
|
+
script.dataset.widgetId = '_rXLissYyqe-dJ9vGGGXzmJwavoW0GvuzQPEq5BZjP8';
|
|
61
|
+
break;
|
|
62
|
+
default:
|
|
63
|
+
console.error('Pagy AI - Unknown hostname: ', hostname);
|
|
64
|
+
}
|
|
65
|
+
script.async = true;
|
|
66
|
+
script.src = 'https://widget.gurubase.io/widget.latest.min.js';
|
|
67
|
+
script.id = 'guru-widget-id';
|
|
68
|
+
script.dataset.iconUrl = this.ICON_URL;
|
|
69
|
+
script.dataset.text = 'Pagy AI';
|
|
70
|
+
script.dataset.bgColor = '#1f7a1f';
|
|
71
|
+
script.dataset.lightMode = 'auto';
|
|
72
|
+
script.dataset.tooltipSide = 'bottom';
|
|
73
|
+
document.head.appendChild(script);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
document.addEventListener('DOMContentLoaded', () => {
|
|
78
|
+
PagyAIWidget.appendWidgetScript();
|
|
79
|
+
PagyAIWidget.editChatWidget();
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
document.addEventListener("turbo:load", () => {
|
|
83
|
+
// skip only the first time (already done by DOMContentLoaded)
|
|
84
|
+
if (PagyAIWidget.skipTurbo) {
|
|
85
|
+
PagyAIWidget.skipTurbo = false;
|
|
86
|
+
} else {
|
|
87
|
+
window.chatWidget = new ChatWidget();
|
|
88
|
+
PagyAIWidget.editChatWidget();
|
|
89
|
+
}
|
|
90
|
+
});
|