mensa 0.2.4 → 0.2.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/CHANGELOG.md +6 -0
- data/Gemfile.lock +3 -3
- data/README.md +13 -3
- data/app/assets/stylesheets/mensa/application.css +1 -1
- data/app/components/mensa/add_filter/component.html.slim +2 -2
- data/app/components/mensa/add_filter/component.rb +1 -1
- data/app/components/mensa/add_filter/component_controller.js +21 -23
- data/app/components/mensa/control_bar/component.html.slim +1 -1
- data/app/components/mensa/control_bar/component.rb +2 -2
- data/app/components/mensa/filter_pill/component.html.slim +6 -0
- data/app/components/mensa/filter_pill/component.rb +15 -0
- data/app/components/mensa/{filter → filter_pill}/component_controller.js +1 -1
- data/app/components/mensa/filter_pill_list/component.html.slim +8 -0
- data/app/components/mensa/{filter_list → filter_pill_list}/component.rb +1 -1
- data/app/components/mensa/filter_pill_list/component_controller.js +50 -0
- data/app/components/mensa/header/component.rb +1 -1
- data/app/components/mensa/row_action/component.rb +1 -1
- data/app/components/mensa/search/component.html.slim +1 -1
- data/app/components/mensa/search/component.rb +1 -1
- data/app/components/mensa/search/component_controller.js +2 -2
- data/app/components/mensa/table/component.html.slim +3 -3
- data/app/components/mensa/table/component_controller.js +14 -2
- data/app/components/mensa/table_row/component.rb +1 -1
- data/app/components/mensa/views/component.html.slim +1 -1
- data/app/controllers/mensa/application_controller.rb +1 -1
- data/app/controllers/mensa/tables/filters_controller.rb +2 -1
- data/app/controllers/mensa/tables_controller.rb +3 -9
- data/app/helpers/mensa/application_helper.rb +0 -1
- data/app/javascript/mensa/controllers/application_controller.js +5 -21
- data/app/javascript/mensa/controllers/index.js +4 -4
- data/app/jobs/mensa/export_job.rb +10 -11
- data/app/tables/mensa/action.rb +3 -1
- data/app/tables/mensa/base.rb +10 -15
- data/app/tables/mensa/cell.rb +6 -6
- data/app/tables/mensa/column.rb +16 -24
- data/app/tables/mensa/config/action_dsl.rb +1 -1
- data/app/tables/mensa/config/dsl_logic.rb +8 -4
- data/app/tables/mensa/config/table_dsl.rb +4 -1
- data/app/tables/mensa/config_readers.rb +15 -3
- data/app/tables/mensa/filter.rb +11 -14
- data/app/tables/mensa/row.rb +1 -1
- data/app/tables/mensa/scope.rb +3 -3
- data/app/views/mensa/tables/filters/show.turbo_stream.slim +7 -6
- data/app/views/mensa/tables/show.html.slim +2 -0
- data/app/views/mensa/tables/show.turbo_stream.slim +1 -1
- data/bin/setup +1 -1
- data/config/locales/en.yml +1 -1
- data/config/locales/nl.yml +1 -1
- data/lib/generators/mensa/tailwind_config_generator.rb +3 -3
- data/lib/generators/mensa/templates/config/initializers/mensa.rb +1 -1
- data/lib/mensa/configuration.rb +2 -3
- data/lib/mensa/engine.rb +9 -9
- data/lib/mensa/version.rb +1 -1
- data/lib/mensa.rb +2 -2
- data/lib/tasks/mensa_tasks.rake +1 -1
- data/mensa.gemspec +1 -1
- metadata +12 -9
- data/app/components/mensa/filter_list/component.html.slim +0 -14
- data/app/components/mensa/filter_list/component_controller.js +0 -14
- /data/{rubocop.yml → .rubocop.yml} +0 -0
- /data/app/components/mensa/{filter_list → filter_pill_list}/component.css +0 -0
data/app/tables/mensa/base.rb
CHANGED
|
@@ -2,11 +2,13 @@ module Mensa
|
|
|
2
2
|
class Base
|
|
3
3
|
include Pagy::Method
|
|
4
4
|
include ConfigReaders
|
|
5
|
+
|
|
6
|
+
defined_by Mensa::Config::TableDsl
|
|
5
7
|
include Scope
|
|
6
8
|
|
|
7
9
|
attr_writer :original_view_context
|
|
8
10
|
attr_accessor :component, :name, :table_view, :request
|
|
9
|
-
attr_reader :
|
|
11
|
+
attr_reader :params
|
|
10
12
|
|
|
11
13
|
config_reader :model
|
|
12
14
|
config_reader :link, call: false
|
|
@@ -15,7 +17,7 @@ module Mensa
|
|
|
15
17
|
config_reader :supports_filters?
|
|
16
18
|
config_reader :view_condensed?
|
|
17
19
|
config_reader :view_condensed_toggle?
|
|
18
|
-
config_reader :
|
|
20
|
+
config_reader :view_columns_ordering?
|
|
19
21
|
config_reader :show_header?
|
|
20
22
|
config_reader :exportable?
|
|
21
23
|
config_reader :export_with_password?
|
|
@@ -55,7 +57,7 @@ module Mensa
|
|
|
55
57
|
end
|
|
56
58
|
|
|
57
59
|
def system_views
|
|
58
|
-
[Mensa::SystemView.new(:
|
|
60
|
+
config[:views]&.key?(:default) ? [] : [Mensa::SystemView.new(:default, config: {name: I18n.t("mensa.views.default")}, table: self)] +
|
|
59
61
|
(config[:views] || {}).keys.map { |view_name| Mensa::SystemView.new(view_name, config: config.dig(:views, view_name), table: self) }
|
|
60
62
|
end
|
|
61
63
|
|
|
@@ -64,6 +66,11 @@ module Mensa
|
|
|
64
66
|
columns.any?(&:filter?)
|
|
65
67
|
end
|
|
66
68
|
|
|
69
|
+
# Returns the active filters
|
|
70
|
+
def active_filters
|
|
71
|
+
(config[:filters] || {}).map { |column_name, filter_config| Mensa::Filter.new(column: column(column_name), config: filter_config, table: self) }
|
|
72
|
+
end
|
|
73
|
+
|
|
67
74
|
def actions?
|
|
68
75
|
config[:actions].present?
|
|
69
76
|
end
|
|
@@ -92,10 +99,6 @@ module Mensa
|
|
|
92
99
|
views
|
|
93
100
|
end
|
|
94
101
|
|
|
95
|
-
def active_filters
|
|
96
|
-
(config[:filters] || {}).map { |column_name, filter_config| Mensa::Filter.new(column: column(column_name), config: filter_config, table: self) }
|
|
97
|
-
end
|
|
98
|
-
|
|
99
102
|
def table_id
|
|
100
103
|
return @table_id if @table_id
|
|
101
104
|
|
|
@@ -105,13 +108,5 @@ module Mensa
|
|
|
105
108
|
def original_view_context
|
|
106
109
|
@original_view_context || component.original_view_context
|
|
107
110
|
end
|
|
108
|
-
|
|
109
|
-
private
|
|
110
|
-
|
|
111
|
-
class << self
|
|
112
|
-
def definition(&)
|
|
113
|
-
@definition ||= Mensa::Config::TableDsl.new(name, &).config
|
|
114
|
-
end
|
|
115
|
-
end
|
|
116
111
|
end
|
|
117
112
|
end
|
data/app/tables/mensa/cell.rb
CHANGED
|
@@ -24,7 +24,7 @@ module Mensa
|
|
|
24
24
|
if proc
|
|
25
25
|
row.table.original_view_context.instance_exec(row.record, &proc)
|
|
26
26
|
else
|
|
27
|
-
send("to_#{format}"
|
|
27
|
+
send(:"to_#{format}")
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
|
|
@@ -33,15 +33,15 @@ module Mensa
|
|
|
33
33
|
def to_html
|
|
34
34
|
case value
|
|
35
35
|
when NilClass
|
|
36
|
-
|
|
36
|
+
""
|
|
37
37
|
when TrueClass
|
|
38
|
-
content_tag(:i,
|
|
38
|
+
content_tag(:i, "", class: "fa-solid fa-check")
|
|
39
39
|
when FalseClass
|
|
40
|
-
content_tag(:i,
|
|
40
|
+
content_tag(:i, "", class: "fa-solid fa-xmark")
|
|
41
41
|
when Date
|
|
42
|
-
respond_to?(:dt) ? dt(value) : value.strftime(
|
|
42
|
+
respond_to?(:dt) ? dt(value) : value.strftime("%d.%m.%Y")
|
|
43
43
|
when Time, DateTime
|
|
44
|
-
respond_to?(:ln) ? ln(value) : value.strftime(
|
|
44
|
+
respond_to?(:ln) ? ln(value) : value.strftime("%d-%m-%Y %H:%M:%S")
|
|
45
45
|
else
|
|
46
46
|
column.sanitize? ? sanitize(value.to_s) : value.to_s.html_safe
|
|
47
47
|
end
|
data/app/tables/mensa/column.rb
CHANGED
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
module Mensa
|
|
4
4
|
class Column
|
|
5
5
|
include ConfigReaders
|
|
6
|
-
|
|
6
|
+
|
|
7
|
+
defined_by Mensa::Config::ColumnDsl
|
|
8
|
+
|
|
9
|
+
attr_reader :name, :table
|
|
7
10
|
|
|
8
11
|
def initialize(name, config:, table:)
|
|
9
12
|
@name = name
|
|
@@ -35,24 +38,20 @@ module Mensa
|
|
|
35
38
|
return @attribute if @attribute
|
|
36
39
|
|
|
37
40
|
@attribute = if config[:attribute].present?
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
nil
|
|
43
|
-
end
|
|
41
|
+
"#{config[:attribute]} AS #{name}"
|
|
42
|
+
elsif table.model.column_names.include? name.to_s
|
|
43
|
+
name.to_s
|
|
44
|
+
end
|
|
44
45
|
end
|
|
45
46
|
|
|
46
47
|
def attribute_for_condition
|
|
47
48
|
return @attribute_for_condition if @attribute_for_condition
|
|
48
49
|
|
|
49
50
|
@attribute_for_condition = if config[:attribute].present?
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
nil
|
|
55
|
-
end
|
|
51
|
+
config[:attribute]
|
|
52
|
+
elsif table.model.column_names.include? name.to_s
|
|
53
|
+
name.to_s
|
|
54
|
+
end
|
|
56
55
|
end
|
|
57
56
|
|
|
58
57
|
# Returns true if the column supports filtering
|
|
@@ -63,7 +62,7 @@ module Mensa
|
|
|
63
62
|
def filter
|
|
64
63
|
return unless filter?
|
|
65
64
|
|
|
66
|
-
@filter ||= Mensa::Filter.new(column: self, config: table.config.dig(:
|
|
65
|
+
@filter ||= Mensa::Filter.new(column: self, config: table.config.dig(:columns, name, :filter) || {}, table: table)
|
|
67
66
|
end
|
|
68
67
|
|
|
69
68
|
def human_name
|
|
@@ -75,19 +74,12 @@ module Mensa
|
|
|
75
74
|
end
|
|
76
75
|
|
|
77
76
|
def menu
|
|
78
|
-
Satis::Menus::Builder.build(:filter_menu, event:
|
|
77
|
+
Satis::Menus::Builder.build(:filter_menu, event: "click") do |m|
|
|
79
78
|
if sortable?
|
|
80
|
-
m.item :sort_ascending, icon:
|
|
81
|
-
m.item :sort_descending, icon:
|
|
79
|
+
m.item :sort_ascending, icon: "fa-solid fa-arrow-up-short-wide", link: table.path(order: {name => :asc}), link_attributes: {"data-turbo-frame": "_self"}
|
|
80
|
+
m.item :sort_descending, icon: "fa-solid fa-arrow-down-wide-short", link: table.path(order: {name => :asc}), link_attributes: {"data-turbo-frame": "_self"}
|
|
82
81
|
end
|
|
83
82
|
end
|
|
84
83
|
end
|
|
85
|
-
|
|
86
|
-
private
|
|
87
|
-
class << self
|
|
88
|
-
def definition(&)
|
|
89
|
-
@definition ||= Mensa::Config::ColumnDsl.new(self.name, &).config
|
|
90
|
-
end
|
|
91
|
-
end
|
|
92
84
|
end
|
|
93
85
|
end
|
|
@@ -65,11 +65,11 @@ module Mensa::Config
|
|
|
65
65
|
end
|
|
66
66
|
|
|
67
67
|
###
|
|
68
|
-
# Define a DSL hash
|
|
69
|
-
# by calling option :action,
|
|
68
|
+
# Define a DSL that builds a hash
|
|
69
|
+
# by calling option :action, dsl_hash: Mensa::ActionDsl
|
|
70
70
|
#
|
|
71
71
|
def dsl_hash(option_name, klass, config_name:)
|
|
72
|
-
config_name
|
|
72
|
+
config_name ||= option_name.to_s.pluralize.to_sym
|
|
73
73
|
|
|
74
74
|
@default_config ||= {}
|
|
75
75
|
@default_config[option_name.to_sym] = {}
|
|
@@ -80,8 +80,12 @@ module Mensa::Config
|
|
|
80
80
|
end
|
|
81
81
|
end
|
|
82
82
|
|
|
83
|
+
###
|
|
84
|
+
# Define a DSL that builds an array
|
|
85
|
+
# by calling option :action, dsl_array: Mensa::ActionDsl
|
|
86
|
+
#
|
|
83
87
|
def dsl_array(option_name, klass, config_name: option_name.to_s.pluralize.to_sym)
|
|
84
|
-
config_name
|
|
88
|
+
config_name ||= option_name.to_s.pluralize.to_sym
|
|
85
89
|
|
|
86
90
|
@default_config ||= {}
|
|
87
91
|
@default_config[name.to_sym] = []
|
|
@@ -76,8 +76,11 @@ module Mensa::Config
|
|
|
76
76
|
option :supports_custom_views, default: false
|
|
77
77
|
option :supports_filters, default: true
|
|
78
78
|
option :show_header, default: true
|
|
79
|
-
|
|
79
|
+
# Whether the table allows to change column ordering
|
|
80
|
+
option :view_columns_ordering, default: true
|
|
81
|
+
# Whether to show a condensed view by default
|
|
80
82
|
option :view_condensed, default: false
|
|
83
|
+
# Whether to show the toggle for condensed view
|
|
81
84
|
option :view_condensed_toggle, default: true
|
|
82
85
|
|
|
83
86
|
option :view, dsl_hash: Mensa::Config::ViewDsl
|
|
@@ -2,12 +2,24 @@ module Mensa
|
|
|
2
2
|
module ConfigReaders
|
|
3
3
|
extend ActiveSupport::Concern
|
|
4
4
|
|
|
5
|
+
included do
|
|
6
|
+
attr_reader :config
|
|
7
|
+
end
|
|
8
|
+
|
|
5
9
|
class_methods do
|
|
10
|
+
def defined_by(dsl_class)
|
|
11
|
+
define_singleton_method(:definition) do |&block|
|
|
12
|
+
@definition ||= dsl_class.new(name, &block).config
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
6
16
|
# Set call to false to avoid immediate execution of Procs
|
|
7
|
-
def config_reader(name, call: true)
|
|
17
|
+
def config_reader(name, call: true, cast: nil)
|
|
8
18
|
define_method name do
|
|
9
|
-
value = config[name.to_s.
|
|
10
|
-
call == true && value.is_a?(Proc) ? instance_exec(&value) : value
|
|
19
|
+
value = config[name.to_s.delete("?").to_sym]
|
|
20
|
+
value = (call == true && value.is_a?(Proc)) ? instance_exec(&value) : value
|
|
21
|
+
value = value.send(cast) if cast
|
|
22
|
+
value
|
|
11
23
|
end
|
|
12
24
|
end
|
|
13
25
|
end
|
data/app/tables/mensa/filter.rb
CHANGED
|
@@ -3,9 +3,12 @@
|
|
|
3
3
|
module Mensa
|
|
4
4
|
class Filter
|
|
5
5
|
include ConfigReaders
|
|
6
|
-
attr_reader :column, :config, :table
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
defined_by Mensa::Config::FilterDsl
|
|
8
|
+
|
|
9
|
+
attr_reader :column, :table
|
|
10
|
+
|
|
11
|
+
config_reader :operator, cast: :to_sym
|
|
9
12
|
config_reader :value
|
|
10
13
|
config_reader :scope
|
|
11
14
|
|
|
@@ -29,32 +32,26 @@ module Mensa
|
|
|
29
32
|
"#{column.human_name}: #{value}"
|
|
30
33
|
end
|
|
31
34
|
|
|
32
|
-
def filter_scope(
|
|
35
|
+
def filter_scope(record_scope)
|
|
33
36
|
if scope
|
|
34
|
-
|
|
37
|
+
record_scope.instance_exec(normalize(value), &scope)
|
|
35
38
|
else
|
|
36
39
|
case operator
|
|
37
40
|
when :matches
|
|
38
|
-
|
|
41
|
+
record_scope.where("#{column.attribute_for_condition} LIKE ?", "%#{normalize(value)}%")
|
|
39
42
|
when :equals
|
|
40
|
-
|
|
43
|
+
record_scope.where(column.attribute_for_condition => normalize(value))
|
|
41
44
|
else
|
|
42
45
|
# Ignore unknown operators
|
|
43
|
-
|
|
46
|
+
record_scope
|
|
44
47
|
end
|
|
45
48
|
end
|
|
46
49
|
end
|
|
47
50
|
|
|
48
51
|
private
|
|
49
52
|
|
|
50
|
-
class << self
|
|
51
|
-
def definition(&)
|
|
52
|
-
@definition ||= Mensa::Config::FilterDsl.new(self.name, &).config
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
|
|
56
53
|
def normalize(query)
|
|
57
|
-
query.to_s.gsub(/\s(?![
|
|
54
|
+
query.to_s.gsub(/\s(?![&!|])/, '\\\\ ')
|
|
58
55
|
end
|
|
59
56
|
end
|
|
60
57
|
end
|
data/app/tables/mensa/row.rb
CHANGED
|
@@ -26,7 +26,7 @@ module Mensa
|
|
|
26
26
|
def link_attributes
|
|
27
27
|
return {} unless link
|
|
28
28
|
|
|
29
|
-
{
|
|
29
|
+
{href: link, data: {controller: "satis-link", action: "click->satis-link#follow tap->satis-link#follow"}}
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
def link
|
data/app/tables/mensa/scope.rb
CHANGED
|
@@ -45,7 +45,7 @@ module Mensa
|
|
|
45
45
|
return @selected_scope if @selected_scope
|
|
46
46
|
|
|
47
47
|
@selected_scope = ordered_scope
|
|
48
|
-
@selected_scope = @selected_scope.select([:id] + columns.
|
|
48
|
+
@selected_scope = @selected_scope.select([:id] + columns.filter_map(&:attribute))
|
|
49
49
|
|
|
50
50
|
@selected_scope
|
|
51
51
|
end
|
|
@@ -71,8 +71,8 @@ module Mensa
|
|
|
71
71
|
# Though this works, perhaps moving this in column(s) is nicer
|
|
72
72
|
def order_hash(new_params = {})
|
|
73
73
|
(params[:order] || config[:order]).merge(new_params.symbolize_keys)
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
.compact_blank
|
|
75
|
+
.transform_values { |value| value.to_sym }
|
|
76
76
|
end
|
|
77
77
|
end
|
|
78
78
|
end
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
= turbo_stream.update params[:target] do
|
|
2
2
|
= sts.form_for(Mensa::Tables::FiltersController::Filter.new, url: '#') do |f|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
= f.input :value, collection: @column.filter.collection, input_html: { "data-action"=> "keydown.esc->mensa-add-filter#reset keydown.enter->mensa-add-filter#filterValueEntered", autofocus: "autofocus", "data-mensa-add-filter-target" => "value" }, label: @column.human_name
|
|
4
|
+
button.text-xs.ring-gray-300.ring-inset.ring-1.rounded.px-1.py-0.5 Esc
|
|
5
|
+
span.text-xs.pl-1.pr-2
|
|
6
|
+
| reset
|
|
7
|
+
button.text-xs.ring-gray-300.ring-inset.ring-1.rounded.px-1.py-0.5 Enter
|
|
8
|
+
span.text-xs.pl-1.pr-2
|
|
9
|
+
| submit
|
data/bin/setup
CHANGED
|
@@ -58,7 +58,7 @@ FileUtils.chdir APP_ROOT do
|
|
|
58
58
|
system! "bin/rails log:clear tmp:clear"
|
|
59
59
|
|
|
60
60
|
puts "\n== Configuring tailwindcss =="
|
|
61
|
-
system! "bin/rails
|
|
61
|
+
system! "pushd test/dummy && bin/rails tailwindcss:config && bin/rails tailwindcss:build && popd"
|
|
62
62
|
|
|
63
63
|
puts "\n== Done, welcome to Mensa =="
|
|
64
64
|
puts "To start the application, run 'bin/overmind s'"
|
data/config/locales/en.yml
CHANGED
data/config/locales/nl.yml
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "rails/generators/base"
|
|
2
2
|
|
|
3
3
|
module Mensa
|
|
4
4
|
module Generators
|
|
5
5
|
class TailwindConfigGenerator < Rails::Generators::Base
|
|
6
|
-
source_root File.expand_path(
|
|
7
|
-
desc
|
|
6
|
+
source_root File.expand_path("../templates", __dir__)
|
|
7
|
+
desc "Configures tailwind.config.js and application.tailwindcss.css"
|
|
8
8
|
|
|
9
9
|
def add_content_to_tailwind_config
|
|
10
10
|
inject_into_file "config/tailwind.config.js", before: "],\n theme: {" do
|
data/lib/mensa/configuration.rb
CHANGED
|
@@ -41,7 +41,7 @@ module Mensa
|
|
|
41
41
|
control_bar_compress: "fa-solid fa-compress",
|
|
42
42
|
control_bar_export: "fa-solid fa-file-export",
|
|
43
43
|
search: "fa-solid fa-magnifying-glass",
|
|
44
|
-
filters_add_filter: "fa-solid fa-plus"
|
|
44
|
+
filters_add_filter: "fa-solid fa-plus"
|
|
45
45
|
}
|
|
46
46
|
# PRO
|
|
47
47
|
# option :icons, default: {
|
|
@@ -81,11 +81,10 @@ module Mensa
|
|
|
81
81
|
yield(config)
|
|
82
82
|
end
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
alias_method :setup, :configure
|
|
85
85
|
|
|
86
86
|
def reset_config!
|
|
87
87
|
@config = Configuration.new
|
|
88
88
|
end
|
|
89
89
|
end
|
|
90
|
-
|
|
91
90
|
end
|
data/lib/mensa/engine.rb
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
require
|
|
2
|
-
require
|
|
3
|
-
require
|
|
4
|
-
require
|
|
5
|
-
require
|
|
6
|
-
require
|
|
1
|
+
require "pagy"
|
|
2
|
+
require "satis"
|
|
3
|
+
require "textacular"
|
|
4
|
+
require "caxlsx_rails"
|
|
5
|
+
require "slim"
|
|
6
|
+
require "tailwindcss-rails"
|
|
7
7
|
require "importmap-rails"
|
|
8
8
|
require "turbo-rails"
|
|
9
9
|
require "stimulus-rails"
|
|
@@ -12,21 +12,21 @@ module Mensa
|
|
|
12
12
|
class Engine < ::Rails::Engine
|
|
13
13
|
isolate_namespace Mensa
|
|
14
14
|
|
|
15
|
-
initializer
|
|
15
|
+
initializer "mensa.assets" do |app|
|
|
16
16
|
app.config.assets.paths << root.join("app/javascript")
|
|
17
17
|
app.config.assets.paths << root.join("app/components")
|
|
18
18
|
app.config.assets.paths << Mensa::Engine.root.join("vendor/javascript")
|
|
19
19
|
app.config.assets.precompile += %w[mensa_manifest]
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
initializer
|
|
22
|
+
initializer "mensa.importmap", before: "importmap" do |app|
|
|
23
23
|
app.config.importmap.paths << root.join("config/importmap.rb")
|
|
24
24
|
app.config.importmap.cache_sweepers << root.join("app/javascript")
|
|
25
25
|
app.config.importmap.cache_sweepers << root.join("app/components")
|
|
26
26
|
app.config.importmap.cache_sweepers << Mensa::Engine.root.join("vendor/javascript")
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
-
initializer
|
|
29
|
+
initializer "mensa.helper" do
|
|
30
30
|
Rails.application.reloader.to_prepare do
|
|
31
31
|
ActiveSupport.on_load(:action_controller) do
|
|
32
32
|
Satis.add_helper(:table, ::Mensa::Table::Component)
|
data/lib/mensa/version.rb
CHANGED
data/lib/mensa.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require "mensa/version"
|
|
2
2
|
require "mensa/engine"
|
|
3
|
-
require
|
|
3
|
+
require "mensa/configuration"
|
|
4
4
|
require "importmap-rails"
|
|
5
5
|
|
|
6
6
|
module Mensa
|
|
@@ -16,7 +16,7 @@ module Mensa
|
|
|
16
16
|
def class_for_name(name)
|
|
17
17
|
class_name = "#{name}_table".camelcase
|
|
18
18
|
unless class_name.safe_constantize
|
|
19
|
-
module_class_name = name.to_s.split(
|
|
19
|
+
module_class_name = name.to_s.split("_", 2).map(&:camelcase).join("::") + "Table"
|
|
20
20
|
class_name = module_class_name if module_class_name.safe_constantize
|
|
21
21
|
end
|
|
22
22
|
Kernel.const_get("::#{class_name}")
|
data/lib/tasks/mensa_tasks.rake
CHANGED
data/mensa.gemspec
CHANGED
|
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
|
23
23
|
|
|
24
24
|
spec.metadata["homepage_uri"] = spec.homepage
|
|
25
25
|
spec.metadata["source_code_uri"] = "https://github.com/entdec/mensa"
|
|
26
|
-
spec.metadata["changelog_uri"] = "https://github.com/entdec/mensa/CHANGELOG"
|
|
26
|
+
spec.metadata["changelog_uri"] = "https://github.com/entdec/mensa/blob/main/CHANGELOG.md"
|
|
27
27
|
|
|
28
28
|
spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
|
|
29
29
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
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.2.
|
|
4
|
+
version: 0.2.5
|
|
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: 2025-11-
|
|
11
|
+
date: 2025-11-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: caxlsx_rails
|
|
@@ -178,6 +178,8 @@ files:
|
|
|
178
178
|
- ".gem_release.yml"
|
|
179
179
|
- ".github/workflows/gem-push.yml"
|
|
180
180
|
- ".gitignore"
|
|
181
|
+
- ".rubocop.yml"
|
|
182
|
+
- CHANGELOG.md
|
|
181
183
|
- Gemfile
|
|
182
184
|
- Gemfile.lock
|
|
183
185
|
- MIT-LICENSE
|
|
@@ -198,11 +200,13 @@ files:
|
|
|
198
200
|
- app/components/mensa/control_bar/component.css
|
|
199
201
|
- app/components/mensa/control_bar/component.html.slim
|
|
200
202
|
- app/components/mensa/control_bar/component.rb
|
|
201
|
-
- app/components/mensa/
|
|
202
|
-
- app/components/mensa/
|
|
203
|
-
- app/components/mensa/
|
|
204
|
-
- app/components/mensa/
|
|
205
|
-
- app/components/mensa/
|
|
203
|
+
- app/components/mensa/filter_pill/component.html.slim
|
|
204
|
+
- app/components/mensa/filter_pill/component.rb
|
|
205
|
+
- app/components/mensa/filter_pill/component_controller.js
|
|
206
|
+
- app/components/mensa/filter_pill_list/component.css
|
|
207
|
+
- app/components/mensa/filter_pill_list/component.html.slim
|
|
208
|
+
- app/components/mensa/filter_pill_list/component.rb
|
|
209
|
+
- app/components/mensa/filter_pill_list/component_controller.js
|
|
206
210
|
- app/components/mensa/header/component.css
|
|
207
211
|
- app/components/mensa/header/component.html.slim
|
|
208
212
|
- app/components/mensa/header/component.rb
|
|
@@ -286,7 +290,6 @@ files:
|
|
|
286
290
|
- mensa.gemspec
|
|
287
291
|
- package-lock.json
|
|
288
292
|
- package.json
|
|
289
|
-
- rubocop.yml
|
|
290
293
|
- vendor/javascript/@rails--request.js.js
|
|
291
294
|
homepage: https://github.com/entdec/mensa
|
|
292
295
|
licenses:
|
|
@@ -294,7 +297,7 @@ licenses:
|
|
|
294
297
|
metadata:
|
|
295
298
|
homepage_uri: https://github.com/entdec/mensa
|
|
296
299
|
source_code_uri: https://github.com/entdec/mensa
|
|
297
|
-
changelog_uri: https://github.com/entdec/mensa/CHANGELOG
|
|
300
|
+
changelog_uri: https://github.com/entdec/mensa/blob/main/CHANGELOG.md
|
|
298
301
|
post_install_message: |
|
|
299
302
|
Mensa requires additional setup. Please run the following
|
|
300
303
|
command to install the necessary files:
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
.mensa-table__filters.hidden data-mensa-table-target="filterList"
|
|
2
|
-
.block
|
|
3
|
-
nav
|
|
4
|
-
.flex.space-x-2.overflow-none.whitespace-nowrap.scroll-p-0[aria-label="Tabs"]
|
|
5
|
-
/ existing filters first
|
|
6
|
-
- table.active_filters.each do |filter|
|
|
7
|
-
.relative data-controller="mensa-filter" data-mensa-filter-column-name-value=filter.column.name data-mensa-filter-value-value=filter.value data-mensa-filter-operator-value=filter.operator
|
|
8
|
-
button.relative.w-full.cursor-default.rounded-md.bg-white.dark:bg-gray-800.py-1.5.pl-3.text-left.text-gray-900.dark:text-gray-400.shadow-sm.ring-1.ring-inset.ring-gray-300.dark:ring-gray-600.focus:outline-none.focus:ring-2.focus:ring-primary-600.sm:text-sm.sm:leading-6[type="button" aria-haspopup="listbox" aria-expanded="true" aria-labelledby="listbox-label"]
|
|
9
|
-
span.block.truncate.pr-6
|
|
10
|
-
= filter
|
|
11
|
-
span.pointer-events-none.absolute.inset-y-0.right-0.flex.items-center.pr-2
|
|
12
|
-
.fa.fal.fa-angle-down
|
|
13
|
-
|
|
14
|
-
= render Mensa::AddFilter::Component.new(table: table)
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import ApplicationController from 'mensa/controllers/application_controller'
|
|
2
|
-
|
|
3
|
-
export default class FilterListComponentController extends ApplicationController {
|
|
4
|
-
static targets = [
|
|
5
|
-
'list',
|
|
6
|
-
]
|
|
7
|
-
static values = {
|
|
8
|
-
supportsViews: Boolean
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
connect() {
|
|
12
|
-
super.connect()
|
|
13
|
-
}
|
|
14
|
-
}
|
|
File without changes
|
|
File without changes
|