mensa 0.1.0 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/gem-push.yml +11 -0
- data/.gitignore +12 -0
- data/Gemfile +10 -8
- data/Gemfile.lock +299 -0
- data/MIT-LICENSE +20 -0
- data/Procfile +2 -0
- data/README.md +76 -18
- data/Rakefile +5 -13
- data/app/assets/config/mensa_manifest.js +5 -0
- data/app/assets/images/mensa/.keep +0 -0
- data/app/assets/stylesheets/mensa/application.css +11 -0
- data/app/components/mensa/add_filter/component.css +13 -0
- data/app/components/mensa/add_filter/component.html.slim +16 -0
- data/app/components/mensa/add_filter/component.rb +13 -0
- data/app/components/mensa/add_filter/component_controller.js +84 -0
- data/app/components/mensa/application_component.rb +12 -0
- data/app/components/mensa/cell/component.css +0 -0
- data/app/components/mensa/cell/component.html.slim +1 -0
- data/app/components/mensa/cell/component.rb +15 -0
- data/app/components/mensa/control_bar/component.css +5 -0
- data/app/components/mensa/control_bar/component.html.slim +15 -0
- data/app/components/mensa/control_bar/component.rb +21 -0
- data/app/components/mensa/filters/component.css +14 -0
- data/app/components/mensa/filters/component.html.slim +14 -0
- data/app/components/mensa/filters/component.rb +13 -0
- data/app/components/mensa/filters/component_controller.js +14 -0
- data/app/components/mensa/header/component.css +54 -0
- data/app/components/mensa/header/component.html.slim +8 -0
- data/app/components/mensa/header/component.rb +19 -0
- data/app/components/mensa/row_action/component.css +0 -0
- data/app/components/mensa/row_action/component.html.slim +6 -0
- data/app/components/mensa/row_action/component.rb +19 -0
- data/app/components/mensa/search/component.css +13 -0
- data/app/components/mensa/search/component.html.slim +17 -0
- data/app/components/mensa/search/component.rb +13 -0
- data/app/components/mensa/search/component_controller.js +62 -0
- data/app/components/mensa/table/component.css +0 -0
- data/app/components/mensa/table/component.html.slim +7 -0
- data/app/components/mensa/table/component.rb +16 -0
- data/app/components/mensa/table/component_controller.js +72 -0
- data/app/components/mensa/table_row/component.css +0 -0
- data/app/components/mensa/table_row/component.html.slim +6 -0
- data/app/components/mensa/table_row/component.rb +19 -0
- data/app/components/mensa/view/component.css +82 -0
- data/app/components/mensa/view/component.html.slim +17 -0
- data/app/components/mensa/view/component.rb +16 -0
- data/app/components/mensa/views/component.css +13 -0
- data/app/components/mensa/views/component.html.slim +18 -0
- data/app/components/mensa/views/component.rb +14 -0
- data/app/controllers/concerns/.keep +0 -0
- data/app/controllers/mensa/application_controller.rb +4 -0
- data/app/controllers/mensa/tables/filters_controller.rb +29 -0
- data/app/controllers/mensa/tables_controller.rb +37 -0
- data/app/helpers/mensa/application_helper.rb +5 -0
- data/app/helpers/mensa/tables_helper.rb +5 -0
- data/app/javascript/mensa/application.js +3 -0
- data/app/javascript/mensa/controllers/alert_controller.js +7 -0
- data/app/javascript/mensa/controllers/application.js +8 -0
- data/app/javascript/mensa/controllers/application_controller.js +57 -0
- data/app/javascript/mensa/controllers/index.js +24 -0
- data/app/jobs/mensa/application_job.rb +7 -0
- data/app/jobs/mensa/export_job.rb +91 -0
- data/app/models/concerns/.keep +0 -0
- data/app/models/mensa/application_record.rb +5 -0
- data/app/models/mensa/table_view.rb +5 -0
- data/app/tables/mensa/action.rb +26 -0
- data/app/tables/mensa/base.rb +103 -0
- data/app/tables/mensa/cell.rb +50 -0
- data/app/tables/mensa/column.rb +85 -0
- data/app/tables/mensa/config/action_dsl.rb +12 -0
- data/app/tables/mensa/config/column_dsl.rb +23 -0
- data/app/tables/mensa/config/dsl_logic.rb +90 -0
- data/app/tables/mensa/config/filter_dsl.rb +8 -0
- data/app/tables/mensa/config/render_dsl.rb +8 -0
- data/app/tables/mensa/config/table_dsl.rb +71 -0
- data/app/tables/mensa/config_readers.rb +13 -0
- data/app/tables/mensa/filter.rb +31 -0
- data/app/tables/mensa/row.rb +36 -0
- data/app/tables/mensa/scope.rb +99 -0
- data/app/views/layouts/mensa/application.html.slim +11 -0
- data/app/views/mensa/tables/filters/show.turbo_stream.slim +8 -0
- data/app/views/mensa/tables/index.html.slim +93 -0
- data/app/views/mensa/tables/show.html.slim +5 -0
- data/app/views/mensa/tables/show.turbo_stream.slim +5 -0
- data/bin/importmap +4 -0
- data/bin/rails +14 -0
- data/config/importmap.rb +8 -0
- data/config/locales/en.yml +8 -0
- data/config/locales/nl.yml +11 -0
- data/config/routes.rb +7 -0
- data/db/migrate/20240201184752_create_mensa_table_views.rb +15 -0
- data/lib/generators/mensa/install_generator.rb +24 -0
- data/lib/generators/mensa/tailwind_config_generator.rb +24 -0
- data/lib/generators/mensa/templates/config/initializers/mensa.rb +22 -0
- data/lib/mensa/configuration.rb +90 -0
- data/lib/mensa/engine.rb +37 -0
- data/lib/mensa/version.rb +1 -3
- data/lib/mensa.rb +24 -5
- data/lib/tasks/mensa_tasks.rake +13 -0
- data/mensa.gemspec +42 -0
- data/package.json +10 -0
- data/vendor/javascript/@rails--request.js.js +2 -0
- data/yarn.lock +837 -0
- metadata +245 -18
- data/.rubocop.yml +0 -13
- data/CHANGELOG.md +0 -5
- data/CODE_OF_CONDUCT.md +0 -84
- data/LICENSE.txt +0 -21
- data/sig/mensa.rbs +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25370127206b302a8c45edd42c4bc78343f85496bf1bfd412d7673a096b9fc41
|
4
|
+
data.tar.gz: 06d7baf09f5b136bc42cf90339eadfb4e96f1dd76105399a37907af9207772fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 578fe9dce64ee4b98246ec69c8fab5602640b547db3eb9b9ac1706079191b99e9854cebc8471f5624bca3210592d70eadb643e3f4c86cd5a803453db5096bf29
|
7
|
+
data.tar.gz: 66215066f2007c0ee32845f834926ecf1e90a4ce3ed8938c3840f976b6d13efe0e47434be9bdb5d5cb3a66535d656588bfc776ffb7f9adbcf30885f7cf670bb0
|
data/.gitignore
ADDED
data/Gemfile
CHANGED
@@ -1,12 +1,14 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
1
|
source "https://rubygems.org"
|
2
|
+
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
3
|
+
git_source(:entdec) { |repo_name| "git@github.com:entdec/#{repo_name}.git" }
|
4
4
|
|
5
|
-
# Specify your gem's dependencies in mensa.gemspec
|
5
|
+
# Specify your gem's dependencies in mensa.gemspec.
|
6
6
|
gemspec
|
7
7
|
|
8
|
-
gem "
|
9
|
-
|
10
|
-
gem "
|
11
|
-
|
12
|
-
gem "
|
8
|
+
gem "puma"
|
9
|
+
gem "sprockets-rails"
|
10
|
+
gem "satis", "~> 1", entdec: "satis", branch: "main"
|
11
|
+
gem "pry"
|
12
|
+
gem "capybara", "~> 3.40"
|
13
|
+
gem "selenium-webdriver", "~> 4.17"
|
14
|
+
gem "slim", "~> 5.2"
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,299 @@
|
|
1
|
+
GIT
|
2
|
+
remote: git@github.com:entdec/satis.git
|
3
|
+
revision: b065f7cebc4d8d28448e75c743fa88da643e3e03
|
4
|
+
branch: main
|
5
|
+
specs:
|
6
|
+
satis (1.0.136)
|
7
|
+
ar_doc_store (~> 2.1)
|
8
|
+
browser
|
9
|
+
diffy
|
10
|
+
rails (>= 6)
|
11
|
+
view_component
|
12
|
+
|
13
|
+
PATH
|
14
|
+
remote: .
|
15
|
+
specs:
|
16
|
+
mensa (0.1.0)
|
17
|
+
caxlsx_rails (~> 0)
|
18
|
+
importmap-rails
|
19
|
+
pagy (>= 6)
|
20
|
+
rails (>= 7.1)
|
21
|
+
slim
|
22
|
+
stimulus-rails
|
23
|
+
tailwindcss-rails
|
24
|
+
textacular (>= 5)
|
25
|
+
turbo-rails
|
26
|
+
|
27
|
+
GEM
|
28
|
+
remote: https://rubygems.org/
|
29
|
+
specs:
|
30
|
+
actioncable (7.1.2)
|
31
|
+
actionpack (= 7.1.2)
|
32
|
+
activesupport (= 7.1.2)
|
33
|
+
nio4r (~> 2.0)
|
34
|
+
websocket-driver (>= 0.6.1)
|
35
|
+
zeitwerk (~> 2.6)
|
36
|
+
actionmailbox (7.1.2)
|
37
|
+
actionpack (= 7.1.2)
|
38
|
+
activejob (= 7.1.2)
|
39
|
+
activerecord (= 7.1.2)
|
40
|
+
activestorage (= 7.1.2)
|
41
|
+
activesupport (= 7.1.2)
|
42
|
+
mail (>= 2.7.1)
|
43
|
+
net-imap
|
44
|
+
net-pop
|
45
|
+
net-smtp
|
46
|
+
actionmailer (7.1.2)
|
47
|
+
actionpack (= 7.1.2)
|
48
|
+
actionview (= 7.1.2)
|
49
|
+
activejob (= 7.1.2)
|
50
|
+
activesupport (= 7.1.2)
|
51
|
+
mail (~> 2.5, >= 2.5.4)
|
52
|
+
net-imap
|
53
|
+
net-pop
|
54
|
+
net-smtp
|
55
|
+
rails-dom-testing (~> 2.2)
|
56
|
+
actionpack (7.1.2)
|
57
|
+
actionview (= 7.1.2)
|
58
|
+
activesupport (= 7.1.2)
|
59
|
+
nokogiri (>= 1.8.5)
|
60
|
+
racc
|
61
|
+
rack (>= 2.2.4)
|
62
|
+
rack-session (>= 1.0.1)
|
63
|
+
rack-test (>= 0.6.3)
|
64
|
+
rails-dom-testing (~> 2.2)
|
65
|
+
rails-html-sanitizer (~> 1.6)
|
66
|
+
actiontext (7.1.2)
|
67
|
+
actionpack (= 7.1.2)
|
68
|
+
activerecord (= 7.1.2)
|
69
|
+
activestorage (= 7.1.2)
|
70
|
+
activesupport (= 7.1.2)
|
71
|
+
globalid (>= 0.6.0)
|
72
|
+
nokogiri (>= 1.8.5)
|
73
|
+
actionview (7.1.2)
|
74
|
+
activesupport (= 7.1.2)
|
75
|
+
builder (~> 3.1)
|
76
|
+
erubi (~> 1.11)
|
77
|
+
rails-dom-testing (~> 2.2)
|
78
|
+
rails-html-sanitizer (~> 1.6)
|
79
|
+
activejob (7.1.2)
|
80
|
+
activesupport (= 7.1.2)
|
81
|
+
globalid (>= 0.3.6)
|
82
|
+
activemodel (7.1.2)
|
83
|
+
activesupport (= 7.1.2)
|
84
|
+
activerecord (7.1.2)
|
85
|
+
activemodel (= 7.1.2)
|
86
|
+
activesupport (= 7.1.2)
|
87
|
+
timeout (>= 0.4.0)
|
88
|
+
activestorage (7.1.2)
|
89
|
+
actionpack (= 7.1.2)
|
90
|
+
activejob (= 7.1.2)
|
91
|
+
activerecord (= 7.1.2)
|
92
|
+
activesupport (= 7.1.2)
|
93
|
+
marcel (~> 1.0)
|
94
|
+
activesupport (7.1.2)
|
95
|
+
base64
|
96
|
+
bigdecimal
|
97
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
98
|
+
connection_pool (>= 2.2.5)
|
99
|
+
drb
|
100
|
+
i18n (>= 1.6, < 2)
|
101
|
+
minitest (>= 5.1)
|
102
|
+
mutex_m
|
103
|
+
tzinfo (~> 2.0)
|
104
|
+
addressable (2.8.6)
|
105
|
+
public_suffix (>= 2.0.2, < 6.0)
|
106
|
+
ar_doc_store (2.1.3)
|
107
|
+
activerecord (>= 6.1)
|
108
|
+
pg
|
109
|
+
base64 (0.2.0)
|
110
|
+
bigdecimal (3.1.5)
|
111
|
+
browser (5.3.1)
|
112
|
+
builder (3.2.4)
|
113
|
+
capybara (3.40.0)
|
114
|
+
addressable
|
115
|
+
matrix
|
116
|
+
mini_mime (>= 0.1.3)
|
117
|
+
nokogiri (~> 1.11)
|
118
|
+
rack (>= 1.6.0)
|
119
|
+
rack-test (>= 0.6.3)
|
120
|
+
regexp_parser (>= 1.5, < 3.0)
|
121
|
+
xpath (~> 3.2)
|
122
|
+
caxlsx (3.4.1)
|
123
|
+
htmlentities (~> 4.3, >= 4.3.4)
|
124
|
+
marcel (~> 1.0)
|
125
|
+
nokogiri (~> 1.10, >= 1.10.4)
|
126
|
+
rubyzip (>= 1.3.0, < 3)
|
127
|
+
caxlsx_rails (0.6.3)
|
128
|
+
actionpack (>= 3.1)
|
129
|
+
caxlsx (>= 3.0)
|
130
|
+
coderay (1.1.3)
|
131
|
+
concurrent-ruby (1.2.2)
|
132
|
+
connection_pool (2.4.1)
|
133
|
+
crass (1.0.6)
|
134
|
+
date (3.3.4)
|
135
|
+
diffy (3.4.2)
|
136
|
+
drb (2.2.0)
|
137
|
+
ruby2_keywords
|
138
|
+
erubi (1.12.0)
|
139
|
+
globalid (1.2.1)
|
140
|
+
activesupport (>= 6.1)
|
141
|
+
htmlentities (4.3.4)
|
142
|
+
i18n (1.14.1)
|
143
|
+
concurrent-ruby (~> 1.0)
|
144
|
+
importmap-rails (2.0.1)
|
145
|
+
actionpack (>= 6.0.0)
|
146
|
+
activesupport (>= 6.0.0)
|
147
|
+
railties (>= 6.0.0)
|
148
|
+
io-console (0.7.1)
|
149
|
+
irb (1.11.1)
|
150
|
+
rdoc
|
151
|
+
reline (>= 0.4.2)
|
152
|
+
loofah (2.22.0)
|
153
|
+
crass (~> 1.0.2)
|
154
|
+
nokogiri (>= 1.12.0)
|
155
|
+
mail (2.8.1)
|
156
|
+
mini_mime (>= 0.1.1)
|
157
|
+
net-imap
|
158
|
+
net-pop
|
159
|
+
net-smtp
|
160
|
+
marcel (1.0.2)
|
161
|
+
matrix (0.4.2)
|
162
|
+
method_source (1.0.0)
|
163
|
+
mini_mime (1.1.5)
|
164
|
+
minitest (5.21.1)
|
165
|
+
mutex_m (0.2.0)
|
166
|
+
net-imap (0.4.9.1)
|
167
|
+
date
|
168
|
+
net-protocol
|
169
|
+
net-pop (0.1.2)
|
170
|
+
net-protocol
|
171
|
+
net-protocol (0.2.2)
|
172
|
+
timeout
|
173
|
+
net-smtp (0.4.0.1)
|
174
|
+
net-protocol
|
175
|
+
nio4r (2.7.0)
|
176
|
+
nokogiri (1.16.0-arm64-darwin)
|
177
|
+
racc (~> 1.4)
|
178
|
+
nokogiri (1.16.0-x86_64-linux)
|
179
|
+
racc (~> 1.4)
|
180
|
+
pagy (7.0.4)
|
181
|
+
pg (1.5.4)
|
182
|
+
pry (0.14.2)
|
183
|
+
coderay (~> 1.1)
|
184
|
+
method_source (~> 1.0)
|
185
|
+
psych (5.1.2)
|
186
|
+
stringio
|
187
|
+
public_suffix (5.0.4)
|
188
|
+
puma (6.4.2)
|
189
|
+
nio4r (~> 2.0)
|
190
|
+
racc (1.7.3)
|
191
|
+
rack (3.0.8)
|
192
|
+
rack-session (2.0.0)
|
193
|
+
rack (>= 3.0.0)
|
194
|
+
rack-test (2.1.0)
|
195
|
+
rack (>= 1.3)
|
196
|
+
rackup (2.1.0)
|
197
|
+
rack (>= 3)
|
198
|
+
webrick (~> 1.8)
|
199
|
+
rails (7.1.2)
|
200
|
+
actioncable (= 7.1.2)
|
201
|
+
actionmailbox (= 7.1.2)
|
202
|
+
actionmailer (= 7.1.2)
|
203
|
+
actionpack (= 7.1.2)
|
204
|
+
actiontext (= 7.1.2)
|
205
|
+
actionview (= 7.1.2)
|
206
|
+
activejob (= 7.1.2)
|
207
|
+
activemodel (= 7.1.2)
|
208
|
+
activerecord (= 7.1.2)
|
209
|
+
activestorage (= 7.1.2)
|
210
|
+
activesupport (= 7.1.2)
|
211
|
+
bundler (>= 1.15.0)
|
212
|
+
railties (= 7.1.2)
|
213
|
+
rails-dom-testing (2.2.0)
|
214
|
+
activesupport (>= 5.0.0)
|
215
|
+
minitest
|
216
|
+
nokogiri (>= 1.6)
|
217
|
+
rails-html-sanitizer (1.6.0)
|
218
|
+
loofah (~> 2.21)
|
219
|
+
nokogiri (~> 1.14)
|
220
|
+
railties (7.1.2)
|
221
|
+
actionpack (= 7.1.2)
|
222
|
+
activesupport (= 7.1.2)
|
223
|
+
irb
|
224
|
+
rackup (>= 1.0.0)
|
225
|
+
rake (>= 12.2)
|
226
|
+
thor (~> 1.0, >= 1.2.2)
|
227
|
+
zeitwerk (~> 2.6)
|
228
|
+
rake (13.1.0)
|
229
|
+
rdoc (6.6.2)
|
230
|
+
psych (>= 4.0.0)
|
231
|
+
regexp_parser (2.9.0)
|
232
|
+
reline (0.4.2)
|
233
|
+
io-console (~> 0.5)
|
234
|
+
rexml (3.2.6)
|
235
|
+
ruby2_keywords (0.0.5)
|
236
|
+
rubyzip (2.3.2)
|
237
|
+
selenium-webdriver (4.18.1)
|
238
|
+
base64 (~> 0.2)
|
239
|
+
rexml (~> 3.2, >= 3.2.5)
|
240
|
+
rubyzip (>= 1.2.2, < 3.0)
|
241
|
+
websocket (~> 1.0)
|
242
|
+
slim (5.2.1)
|
243
|
+
temple (~> 0.10.0)
|
244
|
+
tilt (>= 2.1.0)
|
245
|
+
sprockets (4.2.1)
|
246
|
+
concurrent-ruby (~> 1.0)
|
247
|
+
rack (>= 2.2.4, < 4)
|
248
|
+
sprockets-rails (3.4.2)
|
249
|
+
actionpack (>= 5.2)
|
250
|
+
activesupport (>= 5.2)
|
251
|
+
sprockets (>= 3.0.0)
|
252
|
+
stimulus-rails (1.3.3)
|
253
|
+
railties (>= 6.0.0)
|
254
|
+
stringio (3.1.0)
|
255
|
+
tailwindcss-rails (2.3.0-arm64-darwin)
|
256
|
+
railties (>= 6.0.0)
|
257
|
+
tailwindcss-rails (2.3.0-x86_64-linux)
|
258
|
+
railties (>= 6.0.0)
|
259
|
+
temple (0.10.3)
|
260
|
+
textacular (5.6.0)
|
261
|
+
activerecord (>= 5.0, < 7.2)
|
262
|
+
thor (1.3.0)
|
263
|
+
tilt (2.3.0)
|
264
|
+
timeout (0.4.1)
|
265
|
+
turbo-rails (2.0.4)
|
266
|
+
actionpack (>= 6.0.0)
|
267
|
+
activejob (>= 6.0.0)
|
268
|
+
railties (>= 6.0.0)
|
269
|
+
tzinfo (2.0.6)
|
270
|
+
concurrent-ruby (~> 1.0)
|
271
|
+
view_component (3.10.0)
|
272
|
+
activesupport (>= 5.2.0, < 8.0)
|
273
|
+
concurrent-ruby (~> 1.0)
|
274
|
+
method_source (~> 1.0)
|
275
|
+
webrick (1.8.1)
|
276
|
+
websocket (1.2.10)
|
277
|
+
websocket-driver (0.7.6)
|
278
|
+
websocket-extensions (>= 0.1.0)
|
279
|
+
websocket-extensions (0.1.5)
|
280
|
+
xpath (3.2.0)
|
281
|
+
nokogiri (~> 1.8)
|
282
|
+
zeitwerk (2.6.12)
|
283
|
+
|
284
|
+
PLATFORMS
|
285
|
+
arm64-darwin-22
|
286
|
+
x86_64-linux
|
287
|
+
|
288
|
+
DEPENDENCIES
|
289
|
+
capybara (~> 3.40)
|
290
|
+
mensa!
|
291
|
+
pry
|
292
|
+
puma
|
293
|
+
satis (~> 1)!
|
294
|
+
selenium-webdriver (~> 4.17)
|
295
|
+
slim (~> 5.2)
|
296
|
+
sprockets-rails
|
297
|
+
|
298
|
+
BUNDLED WITH
|
299
|
+
2.3.21
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright Tom de Grunt
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Procfile
ADDED
data/README.md
CHANGED
@@ -1,37 +1,95 @@
|
|
1
1
|
# Mensa
|
2
|
+
Fast and awesome tables, with pagination, sorting, filtering and custom views.
|
3
|
+
|
4
|
+
Wanted features:
|
5
|
+
* [X] very fast
|
6
|
+
* [X] row-links
|
7
|
+
* [X] sorting
|
8
|
+
* [X] tables without headers (and without most of the above)
|
9
|
+
* [ ] column sorting
|
10
|
+
* [ ] filtering (of multiple columns, single is done)
|
11
|
+
* [ ] view selection and exports per view
|
12
|
+
* [ ] group by
|
13
|
+
* [ ] sum/max/min
|
14
|
+
* [ ] tables backed by arrays (of ActiveModel)
|
2
15
|
|
3
|
-
|
16
|
+
## Usage
|
4
17
|
|
5
|
-
|
18
|
+
Add tables in your app/tables folder, inheriting from ApplicationTable.
|
19
|
+
This in turn should inherit from Mensa::Base.
|
6
20
|
|
7
|
-
|
21
|
+
```ruby
|
22
|
+
class UserTable < ApplicationTable
|
23
|
+
definition do
|
24
|
+
model User # implicit from name
|
8
25
|
|
9
|
-
|
26
|
+
order { name: :desc}
|
27
|
+
|
28
|
+
column(:name) do
|
29
|
+
attribute :name # Optional, we can deduct this from the column name
|
10
30
|
|
11
|
-
|
31
|
+
filter do
|
32
|
+
collection -> { }
|
33
|
+
scope -> { where(name: ...) }
|
34
|
+
end
|
35
|
+
end
|
12
36
|
|
13
|
-
|
37
|
+
column(:nr_of_roles) do
|
38
|
+
attribute "roles_count" # We use a database column here
|
39
|
+
end
|
14
40
|
|
15
|
-
|
41
|
+
end
|
42
|
+
end
|
43
|
+
```
|
16
44
|
|
17
|
-
|
45
|
+
Currently mensa depends on satis, but that is something we might remove in a future version.
|
46
|
+
You can show your tables on the page using the following:
|
18
47
|
|
19
|
-
|
48
|
+
```slim
|
49
|
+
= sts.table :users
|
50
|
+
```
|
20
51
|
|
21
|
-
|
52
|
+
### Fast
|
22
53
|
|
23
|
-
|
54
|
+
Mensa selects only the data it needs, based on the columns. Sometimes it needs additional columns to do it's work, but you don't want them displayed.
|
55
|
+
This can be done by adding `internal true` to the column definition.
|
24
56
|
|
25
|
-
|
57
|
+
```ruby
|
58
|
+
column :born_on do
|
59
|
+
internal true # Needed for age below
|
60
|
+
end
|
61
|
+
column :age do
|
62
|
+
attribute "EXTRACT(YEAR FROM AGE(born_on))::int"
|
63
|
+
end
|
64
|
+
```
|
26
65
|
|
27
|
-
##
|
66
|
+
## Installation
|
67
|
+
Add this line to your application's Gemfile:
|
28
68
|
|
29
|
-
|
69
|
+
```ruby
|
70
|
+
gem "mensa"
|
71
|
+
```
|
30
72
|
|
31
|
-
|
73
|
+
And then execute:
|
74
|
+
```bash
|
75
|
+
$ bundle
|
76
|
+
```
|
32
77
|
|
33
|
-
|
78
|
+
Or install it yourself as:
|
79
|
+
```bash
|
80
|
+
$ gem install mensa
|
81
|
+
```
|
34
82
|
|
35
|
-
|
83
|
+
Always use `bundle` to install the gem. Next use the install generator to install migrations, add an initializer and do other setup:
|
84
|
+
```bash
|
85
|
+
$ bin/rails g mensa:install
|
86
|
+
```
|
36
87
|
|
37
|
-
|
88
|
+
## Contributing
|
89
|
+
```
|
90
|
+
Contribution directions go here.
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
## License
|
95
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
CHANGED
@@ -1,16 +1,8 @@
|
|
1
|
-
|
1
|
+
require "bundler/setup"
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
Rake::TestTask.new(:test) do |t|
|
7
|
-
t.libs << "test"
|
8
|
-
t.libs << "lib"
|
9
|
-
t.test_files = FileList["test/**/test_*.rb"]
|
10
|
-
end
|
3
|
+
APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
|
4
|
+
load "rails/tasks/engine.rake"
|
11
5
|
|
12
|
-
|
6
|
+
load "rails/tasks/statistics.rake"
|
13
7
|
|
14
|
-
|
15
|
-
|
16
|
-
task default: %i[test rubocop]
|
8
|
+
require "bundler/gem_tasks"
|
File without changes
|
@@ -0,0 +1,11 @@
|
|
1
|
+
@import '../../../components/mensa/add_filter/component.css';
|
2
|
+
@import '../../../components/mensa/cell/component.css';
|
3
|
+
@import '../../../components/mensa/control_bar/component.css';
|
4
|
+
@import '../../../components/mensa/filters/component.css';
|
5
|
+
@import '../../../components/mensa/header/component.css';
|
6
|
+
@import '../../../components/mensa/row_action/component.css';
|
7
|
+
@import '../../../components/mensa/search/component.css';
|
8
|
+
@import '../../../components/mensa/table/component.css';
|
9
|
+
@import '../../../components/mensa/table_row/component.css';
|
10
|
+
@import '../../../components/mensa/view/component.css';
|
11
|
+
@import '../../../components/mensa/views/component.css';
|
@@ -0,0 +1,13 @@
|
|
1
|
+
.sts-table {
|
2
|
+
&__add_filter {
|
3
|
+
@apply relative;
|
4
|
+
|
5
|
+
&__popover_container {
|
6
|
+
@apply p-2 absolute z-10 mt-1 max-h-60 w-64 overflow-auto rounded-md bg-white dark:bg-gray-800 py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm;
|
7
|
+
|
8
|
+
&__clear {
|
9
|
+
@apply text-gray-600 dark:text-gray-400 no-underline;
|
10
|
+
}
|
11
|
+
}
|
12
|
+
}
|
13
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
.sts-table__add_filter data-controller="mensa-add-filter" data-mensa-add-filter-mensa-table-outlet=".mensa-table#table-#{table.table_id}"
|
2
|
+
button.relative.w-full.cursor-default.rounded-md.bg-white.dark:bg-gray-800.py-1.5.pl-3.pr-6.text-left.text-gray-900.dark:text-gray-400.shadow-sm.border.border-dashed.focus:outline-none.focus:ring-2.focus:ring-primary-600.sm:text-sm.sm:leading-6 type="button" data-action="mensa-add-filter#toggle"
|
3
|
+
span.block.truncate data-mensa-add-filter-target="description"
|
4
|
+
= t('.add_filter')
|
5
|
+
span.pointer-events-none.absolute.inset-y-0.right-0.flex.items-center.pr-2
|
6
|
+
.fal.fa-plus
|
7
|
+
|
8
|
+
ul.hidden.absolute.z-10.mt-1.max-h-60.w-64.overflow-auto.rounded-md.bg-white.dark:bg-gray-800.py-1.text-base.shadow-lg.ring-1.ring-black.ring-opacity-5.focus:outline-none.sm:text-sm data-mensa-add-filter-target="filterList"
|
9
|
+
- table.columns.select(&:filter?).each do |column|
|
10
|
+
li#listbox-option-0.text-gray-900.dark:text-gray-400.hover:bg-gray-100.relative.cursor-default.select-none.py-2.pl-8.pr-4 data-mensa-add-filter-target="filterListItem" data-action="click->mensa-add-filter#selectColumn" data-filter-column-name=column.name
|
11
|
+
.label.font-normal.block.truncate
|
12
|
+
= column.human_name
|
13
|
+
.check.hidden.text-primary-600.absolute.inset-y-0.left-0.flex.items-center.pl-3
|
14
|
+
.fal.fa-check
|
15
|
+
|
16
|
+
div.hidden.sts-table__add_filter__popover_container data-mensa-add-filter-target="valuePopover" id="mensa-filter-value-#{SecureRandom.base36}"
|
@@ -0,0 +1,84 @@
|
|
1
|
+
import ApplicationController from 'mensa/controllers/application_controller'
|
2
|
+
// import { debounce } from '@entdec/satis'
|
3
|
+
import { get } from '@rails/request.js'
|
4
|
+
|
5
|
+
export default class AddFilterComponentController extends ApplicationController {
|
6
|
+
static outlets = [
|
7
|
+
"mensa-table"
|
8
|
+
]
|
9
|
+
static targets = [
|
10
|
+
'filterList', // all filters
|
11
|
+
'filterListItem', // individual filters
|
12
|
+
'description', // contains the filter description in the "tab"
|
13
|
+
'valuePopover' // contains the filter-value
|
14
|
+
]
|
15
|
+
static values = {
|
16
|
+
supportsViews: Boolean
|
17
|
+
}
|
18
|
+
|
19
|
+
connect () {
|
20
|
+
super.connect()
|
21
|
+
|
22
|
+
// this.filterValueEntered = debounce(this.filterValueEntered, 500).bind(this)
|
23
|
+
// this.filterValueEntered = this.filterValueEntered.bind(this)
|
24
|
+
this.selectedFilterColumn = null
|
25
|
+
}
|
26
|
+
|
27
|
+
// Called when you click add-filter
|
28
|
+
toggle (event) {
|
29
|
+
this.filterListTarget.classList.toggle('hidden')
|
30
|
+
}
|
31
|
+
|
32
|
+
// Called when you selected a column
|
33
|
+
openValuePopover (event) {
|
34
|
+
let url = this.ourUrl
|
35
|
+
url.pathname += `/filters/${this.selectedFilterColumn}`
|
36
|
+
url.searchParams.append('target', this.valuePopoverTarget.id)
|
37
|
+
|
38
|
+
get(url, {
|
39
|
+
responseKind: 'turbo-stream'
|
40
|
+
}).then(() => {
|
41
|
+
this.valuePopoverTarget.classList.remove('hidden')
|
42
|
+
})
|
43
|
+
}
|
44
|
+
|
45
|
+
// Called when you select a column from the "dropdown"
|
46
|
+
selectColumn (event) {
|
47
|
+
this.filterListItemTargets.forEach((lt) => {
|
48
|
+
let check = lt.querySelector('.check')
|
49
|
+
check.classList.add('hidden')
|
50
|
+
})
|
51
|
+
let check = event.target.closest('li').querySelector('.check')
|
52
|
+
check.classList.remove('hidden')
|
53
|
+
this.selectedFilterColumn = event.target.closest('li').getAttribute('data-filter-column-name')
|
54
|
+
|
55
|
+
let label = event.target.closest('li').querySelector('.label')
|
56
|
+
this.descriptionTarget.innerText = label.innerText + ': '
|
57
|
+
|
58
|
+
this.toggle()
|
59
|
+
this.openValuePopover()
|
60
|
+
}
|
61
|
+
|
62
|
+
// Called when you entered/selected a filter value
|
63
|
+
filterValueEntered (event) {
|
64
|
+
this.valuePopoverTarget.classList.add('hidden')
|
65
|
+
|
66
|
+
let url = this.ourUrl
|
67
|
+
|
68
|
+
let filters = url.searchParams.get('filters') || {}
|
69
|
+
// FIXME: Needs better way of getting value
|
70
|
+
url.searchParams.append(`filters[${this.selectedFilterColumn}]`, event.target.value)
|
71
|
+
|
72
|
+
get(url, {
|
73
|
+
responseKind: 'turbo-stream'
|
74
|
+
}).then(() => {
|
75
|
+
// FIXME: There should be a better way to do this, possibly using
|
76
|
+
// this.mensaTableOutlet.filtersTarget.addEventListener("turbo:after-stream-render", this.unhide.bind(this)) ?
|
77
|
+
setTimeout(() => {
|
78
|
+
this.mensaTableOutlet.filtersTarget.classList.remove('hidden')
|
79
|
+
}, 50)
|
80
|
+
})
|
81
|
+
event.preventDefault()
|
82
|
+
return false
|
83
|
+
}
|
84
|
+
}
|