mensa 0.1.4 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +24 -2
- data/app/components/mensa/view/component.css +7 -39
- data/app/components/mensa/view/paging.css +34 -0
- data/app/tables/mensa/scope.rb +0 -6
- data/config/locales/en.yml +6 -3
- data/config/locales/nl.yml +3 -3
- data/lib/mensa/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ea896685ecf825e96fee443f27a8360a223648e1c0b7ca38d98bd2abc2ce5c5
|
4
|
+
data.tar.gz: ce47343a31385d9ea6317a2ea658f2e97379cdbe342d5f7865706cbb87542f29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8cba3e05cdee397e2bc953d3b7adc7c20acc5a1a1dfd6a873355a79ce8bd218b373baa58ea3e6d3fc538bb6ae14a6f52b610e23cc7dba112b219c080b321f77
|
7
|
+
data.tar.gz: 162b5cb1c344d719871baac7783f9bcc96d465972458e37dc2d8bca60384d65c4cc184ba4ab542775f6982437f2a36768b6b88e18c5560b3bec3742295062e3e
|
data/README.md
CHANGED
@@ -13,6 +13,10 @@ Wanted features:
|
|
13
13
|
* [ ] sum/max/min
|
14
14
|
* [ ] tables backed by arrays (of ActiveModel)
|
15
15
|
|
16
|
+
Todo:
|
17
|
+
* [ ] Hide filter icon in case there are no filters
|
18
|
+
* [ ] Search only works on table columns
|
19
|
+
|
16
20
|
## Usage
|
17
21
|
|
18
22
|
Add tables in your app/tables folder, inheriting from ApplicationTable.
|
@@ -23,11 +27,15 @@ class UserTable < ApplicationTable
|
|
23
27
|
definition do
|
24
28
|
model User # implicit from name
|
25
29
|
|
26
|
-
order
|
30
|
+
order name: :desc
|
27
31
|
|
28
32
|
column(:name) do
|
29
33
|
attribute :name # Optional, we can deduct this from the column name
|
30
|
-
|
34
|
+
sortable true
|
35
|
+
sanitize true
|
36
|
+
internal false
|
37
|
+
method nil
|
38
|
+
visible true
|
31
39
|
filter do
|
32
40
|
collection -> { }
|
33
41
|
scope -> { where(name: ...) }
|
@@ -38,6 +46,20 @@ class UserTable < ApplicationTable
|
|
38
46
|
attribute "roles_count" # We use a database column here
|
39
47
|
end
|
40
48
|
|
49
|
+
# You can add one or more actions to a row
|
50
|
+
action :delete do
|
51
|
+
link { |user| user_path(user) }
|
52
|
+
icon "fa fa-trash"
|
53
|
+
link_attributes data: {"turbo-confirm": "Are you sure you want to delete the user?", "turbo-method": :delete}
|
54
|
+
show ->(user) { true }
|
55
|
+
end
|
56
|
+
|
57
|
+
link { |user| edit_user_path(user) }
|
58
|
+
supports_views true # This table supports custom views
|
59
|
+
show_header true
|
60
|
+
view_columns_sorting false # Disabled for now
|
61
|
+
view_condensed false # Default false
|
62
|
+
view_condensed_toggle true # Whether to show the toggle, default true
|
41
63
|
end
|
42
64
|
end
|
43
65
|
```
|
@@ -1,3 +1,5 @@
|
|
1
|
+
@import 'paging.css';
|
2
|
+
|
1
3
|
.mensa-table {
|
2
4
|
@apply bg-white dark:bg-gray-500 dark:border-gray-700;
|
3
5
|
|
@@ -32,45 +34,11 @@
|
|
32
34
|
}
|
33
35
|
}
|
34
36
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
@apply flex space-x-1 text-sm text-gray-500;
|
41
|
-
|
42
|
-
a:not(.gap) {
|
43
|
-
@apply block rounded-lg px-3 py-1 bg-gray-200 no-underline;
|
44
|
-
|
45
|
-
&:hover {
|
46
|
-
@apply bg-gray-300;
|
47
|
-
}
|
48
|
-
|
49
|
-
&:not([href]) {
|
50
|
-
/* disabled links */
|
51
|
-
@apply text-gray-300 bg-gray-100 cursor-default;
|
52
|
-
}
|
53
|
-
|
54
|
-
&.current {
|
55
|
-
@apply text-white bg-primary-600;
|
56
|
-
}
|
57
|
-
}
|
58
|
-
|
59
|
-
label {
|
60
|
-
@apply inline-block whitespace-nowrap bg-gray-200 rounded-lg px-3 py-0.5;
|
61
|
-
|
62
|
-
input {
|
63
|
-
@apply bg-gray-100 border-none rounded-md;
|
64
|
-
}
|
65
|
-
}
|
66
|
-
}
|
67
|
-
|
68
|
-
&__condensed {
|
69
|
-
table {
|
70
|
-
tbody {
|
71
|
-
td {
|
72
|
-
@apply pl-4 py-2;
|
73
|
-
}
|
37
|
+
&__condensed {
|
38
|
+
table {
|
39
|
+
tbody {
|
40
|
+
td {
|
41
|
+
@apply pl-4 py-2;
|
74
42
|
}
|
75
43
|
}
|
76
44
|
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
.mensa-table {
|
2
|
+
.paging {
|
3
|
+
@apply flex items-center justify-between border-t border-gray-200 dark:border-gray-600 bg-white dark:bg-gray-800 px-4 py-3 sm:px-6;
|
4
|
+
|
5
|
+
.pagy {
|
6
|
+
@apply flex space-x-1 text-sm text-gray-500;
|
7
|
+
|
8
|
+
a:not(.gap) {
|
9
|
+
@apply block rounded-lg px-3 py-1 bg-gray-200 no-underline;
|
10
|
+
|
11
|
+
&:hover {
|
12
|
+
@apply bg-gray-300;
|
13
|
+
}
|
14
|
+
|
15
|
+
&:not([href]) {
|
16
|
+
/* disabled links */
|
17
|
+
@apply text-gray-300 bg-gray-100 cursor-default;
|
18
|
+
}
|
19
|
+
|
20
|
+
&.current {
|
21
|
+
@apply text-white bg-primary-600;
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
label {
|
26
|
+
@apply inline-block whitespace-nowrap bg-gray-200 rounded-lg px-3 py-0.5;
|
27
|
+
|
28
|
+
input {
|
29
|
+
@apply bg-gray-100 border-none rounded-md;
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
33
|
+
}
|
34
|
+
}
|
data/app/tables/mensa/scope.rb
CHANGED
@@ -54,12 +54,6 @@ module Mensa
|
|
54
54
|
@selected_scope = ordered_scope
|
55
55
|
@selected_scope = @selected_scope.select([:id] + columns.map(&:attribute).compact)
|
56
56
|
|
57
|
-
Rails.logger.debug("*" * 80)
|
58
|
-
Rails.logger.debug("Selected scope")
|
59
|
-
Rails.logger.debug(@selected_scope.to_sql)
|
60
|
-
Rails.logger.debug("*" * 80)
|
61
|
-
|
62
|
-
|
63
57
|
@selected_scope
|
64
58
|
end
|
65
59
|
|
data/config/locales/en.yml
CHANGED
data/config/locales/nl.yml
CHANGED
data/lib/mensa/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mensa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom de Grunt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-04-
|
11
|
+
date: 2024-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: caxlsx_rails
|
@@ -190,6 +190,7 @@ files:
|
|
190
190
|
- app/components/mensa/view/component.css
|
191
191
|
- app/components/mensa/view/component.html.slim
|
192
192
|
- app/components/mensa/view/component.rb
|
193
|
+
- app/components/mensa/view/paging.css
|
193
194
|
- app/components/mensa/views/component.css
|
194
195
|
- app/components/mensa/views/component.html.slim
|
195
196
|
- app/components/mensa/views/component.rb
|