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.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/Gemfile.lock +3 -3
  4. data/README.md +13 -3
  5. data/app/assets/stylesheets/mensa/application.css +1 -1
  6. data/app/components/mensa/add_filter/component.html.slim +2 -2
  7. data/app/components/mensa/add_filter/component.rb +1 -1
  8. data/app/components/mensa/add_filter/component_controller.js +21 -23
  9. data/app/components/mensa/control_bar/component.html.slim +1 -1
  10. data/app/components/mensa/control_bar/component.rb +2 -2
  11. data/app/components/mensa/filter_pill/component.html.slim +6 -0
  12. data/app/components/mensa/filter_pill/component.rb +15 -0
  13. data/app/components/mensa/{filter → filter_pill}/component_controller.js +1 -1
  14. data/app/components/mensa/filter_pill_list/component.html.slim +8 -0
  15. data/app/components/mensa/{filter_list → filter_pill_list}/component.rb +1 -1
  16. data/app/components/mensa/filter_pill_list/component_controller.js +50 -0
  17. data/app/components/mensa/header/component.rb +1 -1
  18. data/app/components/mensa/row_action/component.rb +1 -1
  19. data/app/components/mensa/search/component.html.slim +1 -1
  20. data/app/components/mensa/search/component.rb +1 -1
  21. data/app/components/mensa/search/component_controller.js +2 -2
  22. data/app/components/mensa/table/component.html.slim +3 -3
  23. data/app/components/mensa/table/component_controller.js +14 -2
  24. data/app/components/mensa/table_row/component.rb +1 -1
  25. data/app/components/mensa/views/component.html.slim +1 -1
  26. data/app/controllers/mensa/application_controller.rb +1 -1
  27. data/app/controllers/mensa/tables/filters_controller.rb +2 -1
  28. data/app/controllers/mensa/tables_controller.rb +3 -9
  29. data/app/helpers/mensa/application_helper.rb +0 -1
  30. data/app/javascript/mensa/controllers/application_controller.js +5 -21
  31. data/app/javascript/mensa/controllers/index.js +4 -4
  32. data/app/jobs/mensa/export_job.rb +10 -11
  33. data/app/tables/mensa/action.rb +3 -1
  34. data/app/tables/mensa/base.rb +10 -15
  35. data/app/tables/mensa/cell.rb +6 -6
  36. data/app/tables/mensa/column.rb +16 -24
  37. data/app/tables/mensa/config/action_dsl.rb +1 -1
  38. data/app/tables/mensa/config/dsl_logic.rb +8 -4
  39. data/app/tables/mensa/config/table_dsl.rb +4 -1
  40. data/app/tables/mensa/config_readers.rb +15 -3
  41. data/app/tables/mensa/filter.rb +11 -14
  42. data/app/tables/mensa/row.rb +1 -1
  43. data/app/tables/mensa/scope.rb +3 -3
  44. data/app/views/mensa/tables/filters/show.turbo_stream.slim +7 -6
  45. data/app/views/mensa/tables/show.html.slim +2 -0
  46. data/app/views/mensa/tables/show.turbo_stream.slim +1 -1
  47. data/bin/setup +1 -1
  48. data/config/locales/en.yml +1 -1
  49. data/config/locales/nl.yml +1 -1
  50. data/lib/generators/mensa/tailwind_config_generator.rb +3 -3
  51. data/lib/generators/mensa/templates/config/initializers/mensa.rb +1 -1
  52. data/lib/mensa/configuration.rb +2 -3
  53. data/lib/mensa/engine.rb +9 -9
  54. data/lib/mensa/version.rb +1 -1
  55. data/lib/mensa.rb +2 -2
  56. data/lib/tasks/mensa_tasks.rake +1 -1
  57. data/mensa.gemspec +1 -1
  58. metadata +12 -9
  59. data/app/components/mensa/filter_list/component.html.slim +0 -14
  60. data/app/components/mensa/filter_list/component_controller.js +0 -14
  61. /data/{rubocop.yml → .rubocop.yml} +0 -0
  62. /data/app/components/mensa/{filter_list → filter_pill_list}/component.css +0 -0
@@ -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 :config, :params
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 :view_columns_sorting?
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(:all, config: {name: I18n.t("mensa.views.all")}, table: self)] +
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
@@ -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}".to_sym)
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, '', class: 'fa-solid fa-check')
38
+ content_tag(:i, "", class: "fa-solid fa-check")
39
39
  when FalseClass
40
- content_tag(:i, '', class: 'fa-solid fa-xmark')
40
+ content_tag(:i, "", class: "fa-solid fa-xmark")
41
41
  when Date
42
- respond_to?(:dt) ? dt(value) : value.strftime('%d.%m.%Y')
42
+ respond_to?(:dt) ? dt(value) : value.strftime("%d.%m.%Y")
43
43
  when Time, DateTime
44
- respond_to?(:ln) ? ln(value) : value.strftime('%d-%m-%Y %H:%M:%S')
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
@@ -3,7 +3,10 @@
3
3
  module Mensa
4
4
  class Column
5
5
  include ConfigReaders
6
- attr_reader :name, :table, :config
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
- "#{config[:attribute]} AS #{name}"
39
- elsif table.model.column_names.include? name.to_s
40
- name.to_s
41
- else
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
- config[:attribute]
51
- elsif table.model.column_names.include? name.to_s
52
- name.to_s
53
- else
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(:filters, name) || {}, table: table)
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: 'click') do |m|
77
+ Satis::Menus::Builder.build(:filter_menu, event: "click") do |m|
79
78
  if sortable?
80
- m.item :sort_ascending, icon: 'fa-solid fa-arrow-up-short-wide'.freeze, link: table.path(order: { name => :asc }), link_attributes: { "data-turbo-frame": "_self" }
81
- m.item :sort_descending, icon: 'fa-solid fa-arrow-down-wide-short'.freeze, link: table.path(order: { name => :asc }), link_attributes: { "data-turbo-frame": "_self" }
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
@@ -4,7 +4,7 @@ module Mensa::Config
4
4
  class ActionDsl
5
5
  include DslLogic
6
6
 
7
- option :title, default: ->() { name }
7
+ option :title, default: -> { name }
8
8
  option :icon
9
9
  option :show, default: ->(record) { true }
10
10
  option :link
@@ -65,11 +65,11 @@ module Mensa::Config
65
65
  end
66
66
 
67
67
  ###
68
- # Define a DSL hash
69
- # by calling option :action, dsl: Mensa::ActionDsl
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 = config_name || option_name.to_s.pluralize.to_sym
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 = config_name || option_name.to_s.pluralize.to_sym
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
- option :view_columns_sorting, default: true
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.gsub("?", "").to_sym]
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
@@ -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
- config_reader :operator
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(to_be_filtered_scope)
35
+ def filter_scope(record_scope)
33
36
  if scope
34
- to_be_filtered_scope.instance_exec(normalize(value), &scope)
37
+ record_scope.instance_exec(normalize(value), &scope)
35
38
  else
36
39
  case operator
37
40
  when :matches
38
- to_be_filtered_scope.where("#{column.attribute_for_condition} LIKE ?", "%#{normalize(value)}%")
41
+ record_scope.where("#{column.attribute_for_condition} LIKE ?", "%#{normalize(value)}%")
39
42
  when :equals
40
- to_be_filtered_scope.where(column.attribute_for_condition => normalize(value))
43
+ record_scope.where(column.attribute_for_condition => normalize(value))
41
44
  else
42
45
  # Ignore unknown operators
43
- to_be_filtered_scope
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
@@ -26,7 +26,7 @@ module Mensa
26
26
  def link_attributes
27
27
  return {} unless link
28
28
 
29
- { href: link, data: { controller: "satis-link", action: "click->satis-link#follow tap->satis-link#follow" } }
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
@@ -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.map(&:attribute).compact)
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
- .reject { |name, direction| direction.blank? }
75
- .transform_values { |value| value.to_sym }
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
- - if @column.filter.collection
4
- = 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" }, label: @column.human_name
5
- - else
6
- = f.input :value, input_html: { "data-action"=> "keydown.esc->mensa-add-filter#reset keydown.enter->mensa-add-filter#filterValueEntered", autofocus: "autofocus" }, label: @column.human_name
7
- a.sts-table__add_filter__popover_container__clear
8
- | Clear
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
@@ -1,2 +1,4 @@
1
+ | Test
2
+ button.text-xs Esc
1
3
  turbo-frame id=@table.table_id target="_top"
2
4
  = render Mensa::View::Component.new(@table)
@@ -1,5 +1,5 @@
1
1
  = turbo_stream.update "filters-#{@table.table_id}" do
2
- = render Mensa::FilterList::Component.new(table: @table)
2
+ = render Mensa::FilterPillList::Component.new(table: @table)
3
3
 
4
4
  = turbo_stream.update @table.table_id do
5
5
  = render Mensa::View::Component.new(@table)
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 app:tailwindcss:config && pushd test/dummy && bin/rails tailwindcss:build && popd"
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'"
@@ -8,4 +8,4 @@ en:
8
8
  cancel: Cancel
9
9
  save: Save
10
10
  views:
11
- all: All
11
+ default: All
@@ -8,4 +8,4 @@ nl:
8
8
  cancel: Annuleer
9
9
  save: Bewaar
10
10
  views:
11
- all: Alles
11
+ default: Alles
@@ -1,10 +1,10 @@
1
- require 'rails/generators/base'
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('../templates', __dir__)
7
- desc 'Configures tailwind.config.js and application.tailwindcss.css'
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
@@ -18,6 +18,6 @@ Mensa.setup do |config|
18
18
  control_bar_compress: "fa-solid fa-compress",
19
19
  control_bar_export: "fa-solid fa-file-export",
20
20
  search: "fa-solid fa-magnifying-glass",
21
- filters_add_filter: "fa-solid fa-plus",
21
+ filters_add_filter: "fa-solid fa-plus"
22
22
  }
23
23
  end
@@ -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
- alias setup configure
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 'pagy'
2
- require 'satis'
3
- require 'textacular'
4
- require 'caxlsx_rails'
5
- require 'slim'
6
- require 'tailwindcss-rails'
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 'mensa.assets' do |app|
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 'mensa.importmap', before: "importmap" do |app|
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 'mensa.helper' do
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
@@ -1,3 +1,3 @@
1
1
  module Mensa
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.5"
3
3
  end
data/lib/mensa.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require "mensa/version"
2
2
  require "mensa/engine"
3
- require 'mensa/configuration'
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('_', 2).map(&:camelcase).join('::') + 'Table'
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}")
@@ -10,4 +10,4 @@ end
10
10
  if Rake::Task.task_defined?("tailwindcss:build")
11
11
  Rake::Task["tailwindcss:build"].enhance(["mensa:tailwindcss:config"])
12
12
  Rake::Task["tailwindcss:watch"].enhance(["mensa:tailwindcss:config"])
13
- end
13
+ end
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
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-12 00:00:00.000000000 Z
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/filter/component_controller.js
202
- - app/components/mensa/filter_list/component.css
203
- - app/components/mensa/filter_list/component.html.slim
204
- - app/components/mensa/filter_list/component.rb
205
- - app/components/mensa/filter_list/component_controller.js
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