katalyst-koi 4.7.3 → 4.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/builds/koi/admin.css +201 -150
  3. data/app/assets/builds/koi/admin.css.map +1 -1
  4. data/app/assets/javascripts/koi/controllers/index_actions_controller.js +0 -8
  5. data/app/assets/javascripts/koi/controllers/pagy_nav_controller.js +21 -0
  6. data/app/assets/stylesheets/koi/base/_index.scss +1 -0
  7. data/app/assets/stylesheets/koi/base/_tables.scss +15 -0
  8. data/app/assets/stylesheets/koi/components/_index.scss +0 -1
  9. data/app/components/concerns/koi/tables/cells.rb +85 -0
  10. data/app/components/koi/header/edit_component.rb +1 -1
  11. data/app/components/koi/header/show_component.rb +1 -1
  12. data/app/components/koi/summary_list/date_component.rb +2 -2
  13. data/app/components/koi/summary_list/datetime_component.rb +2 -2
  14. data/app/components/koi/summary_list/number_component.rb +2 -2
  15. data/app/components/koi/summary_table_component.rb +7 -0
  16. data/app/components/koi/table_component.rb +7 -0
  17. data/app/components/koi/tables/cells/enum_component.rb +27 -0
  18. data/app/components/koi/tables/table_component.rb +2 -54
  19. data/app/controllers/admin/admin_users_controller.rb +2 -2
  20. data/app/controllers/admin/sessions_controller.rb +8 -10
  21. data/app/controllers/admin/tokens_controller.rb +15 -13
  22. data/app/controllers/admin/url_rewrites_controller.rb +2 -2
  23. data/app/controllers/concerns/koi/controller/has_attachments.rb +1 -1
  24. data/app/controllers/concerns/koi/controller/is_admin_controller.rb +6 -4
  25. data/app/controllers/concerns/koi/controller/json_web_token.rb +1 -1
  26. data/app/helpers/koi/definition_list_helper.rb +2 -2
  27. data/app/helpers/koi/index_actions_helper.rb +2 -4
  28. data/app/helpers/koi/pagy.rb +15 -0
  29. data/app/models/url_rewrite.rb +1 -1
  30. data/app/views/admin/credentials/_credentials.html.erb +1 -1
  31. data/config/initializers/extensions.rb +1 -1
  32. data/config/initializers/flipper.rb +1 -1
  33. data/config/initializers/pagy.rb +2 -0
  34. data/config/locales/koi.en.yml +4 -0
  35. data/db/migrate/20130509235316_add_url_rewriter.rb +1 -1
  36. data/db/migrate/20230531063707_update_admin_users.rb +6 -3
  37. data/db/seeds.rb +1 -1
  38. data/lib/generators/koi/admin/admin_generator.rb +7 -1
  39. data/lib/generators/koi/admin_controller/admin_controller_generator.rb +6 -2
  40. data/lib/generators/koi/admin_controller/templates/controller.rb.tt +51 -53
  41. data/lib/generators/koi/admin_controller/templates/controller_spec.rb.tt +1 -1
  42. data/lib/generators/koi/admin_views/admin_views_generator.rb +8 -23
  43. data/lib/generators/koi/admin_views/templates/edit.html.erb.tt +1 -1
  44. data/lib/generators/koi/admin_views/templates/index.html.erb.tt +7 -7
  45. data/lib/generators/koi/admin_views/templates/new.html.erb.tt +1 -1
  46. data/lib/generators/koi/admin_views/templates/show.html.erb.tt +8 -4
  47. data/lib/govuk_design_system_formbuilder/elements/document.rb +5 -5
  48. data/lib/govuk_design_system_formbuilder/elements/image.rb +5 -5
  49. data/lib/koi/form_builder.rb +12 -12
  50. data/lib/koi/menu/builder.rb +6 -6
  51. metadata +9 -4
  52. data/app/assets/stylesheets/koi/components/_index-table.scss +0 -147
  53. data/app/assets/stylesheets/koi/components/index-table/_ordinal.scss +0 -38
@@ -15,14 +15,14 @@ module Koi
15
15
 
16
16
  def create_controller_files
17
17
  template("controller.rb",
18
- File.join("app/controllers/admin",
18
+ File.join("app/controllers",
19
19
  controller_class_path,
20
20
  "#{controller_file_name}_controller.rb"))
21
21
  end
22
22
 
23
23
  def create_spec_files
24
24
  template("controller_spec.rb",
25
- File.join("spec/requests/admin",
25
+ File.join("spec/requests",
26
26
  controller_class_path,
27
27
  "#{controller_file_name}_controller_spec.rb"))
28
28
  end
@@ -32,6 +32,10 @@ module Koi
32
32
 
33
33
  private
34
34
 
35
+ def controller_class_path
36
+ ["admin"] + super
37
+ end
38
+
35
39
  def permitted_params
36
40
  attachments, others = attributes_names.partition { |name| attachments?(name) }
37
41
  params = others.map { |name| ":#{name}" }
@@ -1,76 +1,74 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Admin
4
- class <%= controller_class_name %>Controller < ApplicationController
5
- before_action :set_<%= singular_name %>, only: %i[show edit update destroy]
3
+ class <%= controller_class_name %>Controller < ApplicationController
4
+ before_action :set_<%= singular_name %>, only: %i[show edit update destroy]
6
5
 
7
- def index
8
- collection = Collection.new.with_params(params).apply(::<%= class_name %>.strict_loading.all)
6
+ def index
7
+ collection = Collection.new.with_params(params).apply(::<%= class_name %>.strict_loading.all)
9
8
 
10
- render locals: { collection: }
11
- end
9
+ render locals: { collection: }
10
+ end
12
11
 
13
- def show
14
- render locals: { <%= singular_name %>: @<%= singular_name %> }
15
- end
12
+ def show
13
+ render locals: { <%= singular_name %>: @<%= singular_name %> }
14
+ end
16
15
 
17
- def new
18
- render locals: { <%= singular_name %>: ::<%= class_name %>.new }
19
- end
16
+ def new
17
+ render locals: { <%= singular_name %>: ::<%= class_name %>.new }
18
+ end
20
19
 
21
- def edit
22
- render locals: { <%= singular_name %>: @<%= singular_name %> }
23
- end
20
+ def edit
21
+ render locals: { <%= singular_name %>: @<%= singular_name %> }
22
+ end
24
23
 
25
- def create
26
- @<%= singular_name %> = ::<%= class_name %>.new(<%= singular_table_name %>_params)
24
+ def create
25
+ @<%= singular_name %> = ::<%= class_name %>.new(<%= singular_table_name %>_params)
27
26
 
28
- if @<%= singular_name %>.save
29
- redirect_to [:admin, @<%= singular_name %>], status: :see_other
30
- else
31
- render :new, locals: { <%= singular_name %>: @<%= singular_name %> }, status: :unprocessable_entity
32
- end
27
+ if @<%= singular_name %>.save
28
+ redirect_to [:admin, @<%= singular_name %>], status: :see_other
29
+ else
30
+ render :new, locals: { <%= singular_name %>: @<%= singular_name %> }, status: :unprocessable_content
33
31
  end
32
+ end
34
33
 
35
- def update
36
- if @<%= singular_name %>.update(<%= singular_table_name %>_params)
37
- redirect_to action: :show, status: :see_other
38
- else
39
- render :edit, locals: { <%= singular_name %>: @<%= singular_name %> }, status: :unprocessable_entity
40
- end
34
+ def update
35
+ if @<%= singular_name %>.update(<%= singular_table_name %>_params)
36
+ redirect_to action: :show, status: :see_other
37
+ else
38
+ render :edit, locals: { <%= singular_name %>: @<%= singular_name %> }, status: :unprocessable_content
41
39
  end
40
+ end
42
41
 
43
- def destroy
44
- @<%= singular_name %>.destroy!
42
+ def destroy
43
+ @<%= singular_name %>.destroy!
45
44
 
46
- redirect_to action: :index, status: :see_other
47
- end
45
+ redirect_to action: :index, status: :see_other
46
+ end
48
47
 
49
- private
48
+ private
50
49
 
51
- # Only allow a list of trusted parameters through.
52
- def <%= "#{singular_table_name}_params" %>
53
- <%- if attributes_names.empty? -%>
54
- params.fetch(:<%= singular_table_name %>, {})
55
- <%- else -%>
56
- params.require(:<%= singular_table_name %>).permit(<%= permitted_params %>)
57
- <%- end -%>
58
- end
50
+ # Only allow a list of trusted parameters through.
51
+ def <%= "#{singular_table_name}_params" %>
52
+ <%- if attributes_names.empty? -%>
53
+ params.fetch(:<%= singular_table_name %>, {})
54
+ <%- else -%>
55
+ params.require(:<%= singular_table_name %>).permit(<%= permitted_params %>)
56
+ <%- end -%>
57
+ end
59
58
 
60
- # Use callbacks to share common setup or constraints between actions.
61
- def set_<%= singular_name %>
62
- @<%= singular_name %> = ::<%= class_name %>.find(params[:id])
63
- end
59
+ # Use callbacks to share common setup or constraints between actions.
60
+ def set_<%= singular_name %>
61
+ @<%= singular_name %> = ::<%= class_name %>.find(params[:id])
62
+ end
64
63
 
65
- class Collection < Katalyst::Tables::Collection::Base
66
- attribute :search, :string
64
+ class Collection < Katalyst::Tables::Collection::Base
65
+ attribute :search, :string
67
66
 
68
- config.sorting = :<%= search_attribute %>
69
- config.paginate = true
67
+ config.sorting = :<%= search_attribute %>
68
+ config.paginate = true
70
69
 
71
- def filter
72
- self.items = items.admin_search(search) if search.present?
73
- end
70
+ def filter
71
+ self.items = items.admin_search(search) if search.present?
74
72
  end
75
73
  end
76
74
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "rails_helper"
4
4
 
5
- RSpec.describe Admin::<%= controller_class_name %>Controller do
5
+ RSpec.describe <%= controller_class_name %>Controller do
6
6
  let(:admin) { create(:admin) }
7
7
  let(:model) { create(:<%= singular_name %>) }
8
8
 
@@ -12,13 +12,13 @@ module Koi
12
12
  argument :attributes, type: :array, default: [], banner: "field:type field:type"
13
13
 
14
14
  def create_root_folder
15
- empty_directory File.join("app/views/admin", controller_file_path)
15
+ empty_directory File.join("app/views", controller_file_path)
16
16
  end
17
17
 
18
18
  def copy_view_files
19
19
  available_views.each do |filename|
20
20
  target = filename.gsub("record", singular_name)
21
- template filename, File.join("app/views/admin", controller_file_path, target)
21
+ template filename, File.join("app/views", controller_file_path, target)
22
22
  end
23
23
  end
24
24
 
@@ -28,6 +28,10 @@ module Koi
28
28
  %w(index.html.erb edit.html.erb show.html.erb new.html.erb _fields.html.erb)
29
29
  end
30
30
 
31
+ def controller_class_path
32
+ ["admin"] + super
33
+ end
34
+
31
35
  def govuk_input_for(attribute)
32
36
  case attribute.type
33
37
  when :string
@@ -47,27 +51,6 @@ module Koi
47
51
  end
48
52
  end
49
53
 
50
- def summary_attribute_for(attribute)
51
- case attribute.type
52
- when :string
53
- %(<% dl.text :#{attribute.name} %>)
54
- when :integer
55
- %(<% dl.number :#{attribute.name} %>)
56
- when :boolean
57
- %(<% dl.boolean :#{attribute.name} %>)
58
- when :date
59
- %(<% dl.date :#{attribute.name} %>)
60
- when :datetime
61
- %(<% dl.datetime :#{attribute.name} %>)
62
- when :rich_text
63
- %(<% dl.rich_text :#{attribute.name} %>)
64
- when :attachment
65
- %(<% dl.attachment :#{attribute.name} %>)
66
- else
67
- %(<% dl.text :#{attribute.name} %>)
68
- end
69
- end
70
-
71
54
  def index_attribute_for(attribute)
72
55
  case attribute.type
73
56
  when :integer
@@ -87,6 +70,8 @@ module Koi
87
70
  end
88
71
  end
89
72
 
73
+ alias_method :summary_attribute_for, :index_attribute_for
74
+
90
75
  def index_attributes
91
76
  attributes
92
77
  end
@@ -2,7 +2,7 @@
2
2
  <%%= render(Koi::Header::EditComponent.new(resource: <%= singular_name %>)) %>
3
3
  <%% end %>
4
4
 
5
- <%%= form_with(model: <%= singular_name %>, url: [:admin, <%= singular_name %>], builder: Koi::FormBuilder) do |form| %>
5
+ <%%= form_with(model: <%= singular_name %>, url: <%= show_helper(singular_name, type: :path) %>) do |form| %>
6
6
  <%%= render "fields", form: %>
7
7
 
8
8
  <div class="actions">
@@ -5,13 +5,13 @@
5
5
  <%%= koi_index_actions create: true, search: true %>
6
6
 
7
7
  <%%= table_with(collection:) do |row, <%= singular_name %>| %>
8
- <% index_attributes.each_with_index do |attribute, index| %>
9
- <% if index.zero? %>
10
- <%% row.link :<%= attribute.name %> %>
11
- <% else %>
12
- <%= index_attribute_for attribute %>
13
- <% end %>
14
- <% end %>
8
+ <%- index_attributes.each_with_index do |attribute, index| -%>
9
+ <%- if index.zero? -%>
10
+ <%% row.link :<%= attribute.name %> %>
11
+ <%- else -%>
12
+ <%= index_attribute_for attribute %>
13
+ <%- end -%>
14
+ <%- end -%>
15
15
  <%% end %>
16
16
 
17
17
  <%%== pagy_nav(collection.pagination) %>
@@ -2,7 +2,7 @@
2
2
  <%%= render(Koi::Header::NewComponent.new(model: <%= class_name %>)) %>
3
3
  <%% end %>
4
4
 
5
- <%%= form_with(model: <%= singular_name %>, url: [:admin, <%= class_name %>], builder: Koi::FormBuilder) do |form| %>
5
+ <%%= form_with(model: <%= singular_name %>, url: <%= index_helper(type: :path) %>) do |form| %>
6
6
  <%%= render "fields", form: %>
7
7
 
8
8
  <div class="actions">
@@ -4,14 +4,18 @@
4
4
 
5
5
  <h2>Summary</h2>
6
6
 
7
- <%%= render Koi::SummaryListComponent.new(model: <%= singular_name %>) do |dl| %>
8
- <%- attributes.each do |attribute| -%>
7
+ <%%= summary_table_with(model: <%= singular_name %>) do |row| %>
8
+ <%- attributes.each_with_index do |attribute, index| -%>
9
+ <%- if index.zero? -%>
10
+ <%% row.link :<%= attribute.name %> %>
11
+ <%- else -%>
9
12
  <%= summary_attribute_for attribute %>
10
- <%- end -%>
13
+ <%- end -%>
14
+ <%- end -%>
11
15
  <%% end %>
12
16
 
13
17
  <div class="actions">
14
- <%%= button_to "Delete", [:admin, <%= singular_name %>],
18
+ <%%= button_to "Delete", <%= show_helper(singular_name, type: :path) %>,
15
19
  class: "button button--secondary",
16
20
  method: :delete,
17
21
  form: { data: { turbo_confirm: "Are you sure?" } } %>
@@ -8,8 +8,8 @@ module GOVUKDesignSystemFormBuilder
8
8
  include FileElement
9
9
 
10
10
  def initialize(builder, object_name, attribute_name, hint:, label:, caption:, form_group:, mime_types:,
11
- **kwargs, &block)
12
- super(builder, object_name, attribute_name, &block)
11
+ **kwargs, &)
12
+ super(builder, object_name, attribute_name, &)
13
13
 
14
14
  @mime_types = mime_types
15
15
  @label = label
@@ -59,10 +59,10 @@ module GOVUKDesignSystemFormBuilder
59
59
  hint: {},
60
60
  form_group: {},
61
61
  mime_types: Koi.config.document_mime_types,
62
- **kwargs,
63
- &block)
62
+ **,
63
+ &)
64
64
  Elements::Document.new(
65
- self, object_name, attribute_name, label:, caption:, hint:, form_group:, mime_types:, **kwargs, &block
65
+ self, object_name, attribute_name, label:, caption:, hint:, form_group:, mime_types:, **, &
66
66
  ).html
67
67
  end
68
68
  end
@@ -9,8 +9,8 @@ module GOVUKDesignSystemFormBuilder
9
9
  include FileElement
10
10
 
11
11
  def initialize(builder, object_name, attribute_name, hint:, label:, caption:, form_group:, mime_types:,
12
- **kwargs, &block)
13
- super(builder, object_name, attribute_name, &block)
12
+ **kwargs, &)
13
+ super(builder, object_name, attribute_name, &)
14
14
 
15
15
  @mime_types = mime_types
16
16
  @label = label
@@ -89,10 +89,10 @@ module GOVUKDesignSystemFormBuilder
89
89
  hint: {},
90
90
  form_group: {},
91
91
  mime_types: Koi.config.image_mime_types,
92
- **kwargs,
93
- &block)
92
+ **,
93
+ &)
94
94
  Elements::Image.new(
95
- self, object_name, attribute_name, label:, caption:, hint:, form_group:, mime_types:, **kwargs, &block
95
+ self, object_name, attribute_name, label:, caption:, hint:, form_group:, mime_types:, **, &
96
96
  ).html
97
97
  end
98
98
  end
@@ -7,31 +7,31 @@ module Koi
7
7
  include GOVUKDesignSystemFormBuilder::Builder
8
8
 
9
9
  # Generates a submit button for saving admin resources.
10
- def admin_save(text = "Save", name: :commit, value: :save, class: "button button--primary", **kwargs)
11
- button(text, name:, value:, class:, **kwargs)
10
+ def admin_save(text = "Save", name: :commit, value: :save, class: "button button--primary", **)
11
+ button(text, name:, value:, class:, **)
12
12
  end
13
13
 
14
14
  # Generates a delete link formatted as a button that will perform a turbo
15
15
  # delete with a confirmation.
16
- def admin_delete(text = "Delete", url: nil, confirm: "Are you sure?", data: {}, **kwargs)
16
+ def admin_delete(text = "Delete", url: nil, confirm: "Are you sure?", data: {}, **)
17
17
  return unless object.persisted?
18
18
 
19
19
  link_to(text, url || url_for(action: :destroy),
20
20
  class: "button button--secondary",
21
21
  data: data.reverse_merge(turbo_method: :delete, turbo_confirm: confirm),
22
- **kwargs)
22
+ **)
23
23
  end
24
24
 
25
25
  # Generates an archive link formatted as a button that will perform a turbo
26
26
  # delete with a confirmation.
27
- def admin_archive(text = "Archive", **kwargs)
28
- admin_delete(text, **kwargs)
27
+ def admin_archive(text = "Archive", **)
28
+ admin_delete(text, **)
29
29
  end
30
30
 
31
31
  # Generates a discard changes link formatted as a text button that navigates
32
32
  # the user back to the previous page.
33
- def admin_discard(text = "Discard", url: :back, **kwargs)
34
- link_to(text, url, class: "button button--text", **kwargs)
33
+ def admin_discard(text = "Discard", url: :back, **)
34
+ link_to(text, url, class: "button button--text", **)
35
35
  end
36
36
 
37
37
  # @api internal
@@ -42,7 +42,7 @@ module Koi
42
42
  hint[:text] ||= t("helpers.hint.default.document", max_size: @template.number_to_human_size(max_size))
43
43
  end
44
44
 
45
- super(attribute_name, hint:, **, &)
45
+ super
46
46
  end
47
47
 
48
48
  # @api internal
@@ -53,20 +53,20 @@ module Koi
53
53
  hint[:text] ||= t("helpers.hint.default.document", max_size: @template.number_to_human_size(max_size))
54
54
  end
55
55
 
56
- super(attribute_name, hint:, **, &)
56
+ super
57
57
  end
58
58
 
59
59
  # Use content editor trix setup by default.
60
60
  #
61
61
  # @api internal
62
62
  # @see GOVUKDesignSystemFormBuilder::Builder#govuk_rich_text_area
63
- def govuk_rich_text_area(attribute_name, data: {}, **kwargs, &block)
63
+ def govuk_rich_text_area(attribute_name, data: {}, **, &)
64
64
  data = data.reverse_merge(
65
65
  direct_upload_url: @template.katalyst_content.direct_uploads_url,
66
66
  controller: "content--editor--trix",
67
67
  action: "trix-initialize->content--editor--trix#trixInitialize",
68
68
  )
69
- super(attribute_name, data:, **kwargs, &block)
69
+ super
70
70
  end
71
71
  end
72
72
  end
@@ -27,10 +27,10 @@ module Koi
27
27
  end
28
28
  end
29
29
 
30
- def add_menu(title:, **options, &)
30
+ def add_menu(title:, **, &)
31
31
  @menu.items.build(type: Katalyst::Navigation::Heading.name,
32
32
  title:,
33
- **options,
33
+ **,
34
34
  index: @index,
35
35
  depth: @depth)
36
36
  @index += 1
@@ -39,21 +39,21 @@ module Koi
39
39
  @depth -= 1
40
40
  end
41
41
 
42
- def add_link(title:, url:, **options)
42
+ def add_link(title:, url:, **)
43
43
  @menu.items.build(type: Katalyst::Navigation::Link.name,
44
44
  title:,
45
45
  url:,
46
- **options,
46
+ **,
47
47
  index: @index,
48
48
  depth: @depth)
49
49
  @index += 1
50
50
  end
51
51
 
52
- def add_button(title:, url:, **options)
52
+ def add_button(title:, url:, **)
53
53
  @menu.items.build(type: Katalyst::Navigation::Button.name,
54
54
  title:,
55
55
  url:,
56
- **options,
56
+ **,
57
57
  index: @index,
58
58
  depth: @depth)
59
59
  @index += 1
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: katalyst-koi
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.7.3
4
+ version: 4.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katalyst Interactive
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-30 00:00:00.000000000 Z
11
+ date: 2024-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -260,6 +260,7 @@ files:
260
260
  - app/assets/javascripts/koi/controllers/keyboard_controller.js
261
261
  - app/assets/javascripts/koi/controllers/navigation_controller.js
262
262
  - app/assets/javascripts/koi/controllers/navigation_toggle_controller.js
263
+ - app/assets/javascripts/koi/controllers/pagy_nav_controller.js
263
264
  - app/assets/javascripts/koi/controllers/show_hide_controller.js
264
265
  - app/assets/javascripts/koi/controllers/sluggable_controller.js
265
266
  - app/assets/javascripts/koi/controllers/webauthn_authentication_controller.js
@@ -272,17 +273,16 @@ files:
272
273
  - app/assets/stylesheets/koi/base/_input.scss
273
274
  - app/assets/stylesheets/koi/base/_link.scss
274
275
  - app/assets/stylesheets/koi/base/_list.scss
276
+ - app/assets/stylesheets/koi/base/_tables.scss
275
277
  - app/assets/stylesheets/koi/base/_typography.scss
276
278
  - app/assets/stylesheets/koi/components/_actions-group.scss
277
279
  - app/assets/stylesheets/koi/components/_clipboard.scss
278
280
  - app/assets/stylesheets/koi/components/_document-field.scss
279
281
  - app/assets/stylesheets/koi/components/_image-field.scss
280
282
  - app/assets/stylesheets/koi/components/_index-actions.scss
281
- - app/assets/stylesheets/koi/components/_index-table.scss
282
283
  - app/assets/stylesheets/koi/components/_index.scss
283
284
  - app/assets/stylesheets/koi/components/_pagy.scss
284
285
  - app/assets/stylesheets/koi/components/_summary-list.scss
285
- - app/assets/stylesheets/koi/components/index-table/_ordinal.scss
286
286
  - app/assets/stylesheets/koi/layouts/_banner.scss
287
287
  - app/assets/stylesheets/koi/layouts/_content.scss
288
288
  - app/assets/stylesheets/koi/layouts/_flash.scss
@@ -303,6 +303,7 @@ files:
303
303
  - app/assets/stylesheets/koi/utils/_hide.scss
304
304
  - app/assets/stylesheets/koi/utils/_index.scss
305
305
  - app/assets/stylesheets/koi/utils/_typography.scss
306
+ - app/components/concerns/koi/tables/cells.rb
306
307
  - app/components/koi/content/editor/errors_component.html.erb
307
308
  - app/components/koi/content/editor/errors_component.rb
308
309
  - app/components/koi/content/editor/item_form_component.html.erb
@@ -326,7 +327,10 @@ files:
326
327
  - app/components/koi/summary_list/text_component.rb
327
328
  - app/components/koi/summary_list_component.html.erb
328
329
  - app/components/koi/summary_list_component.rb
330
+ - app/components/koi/summary_table_component.rb
331
+ - app/components/koi/table_component.rb
329
332
  - app/components/koi/tables/cells/attachment_component.rb
333
+ - app/components/koi/tables/cells/enum_component.rb
330
334
  - app/components/koi/tables/cells/link_component.rb
331
335
  - app/components/koi/tables/table_component.rb
332
336
  - app/controllers/admin/admin_users_controller.rb
@@ -346,6 +350,7 @@ files:
346
350
  - app/helpers/koi/date_helper.rb
347
351
  - app/helpers/koi/definition_list_helper.rb
348
352
  - app/helpers/koi/index_actions_helper.rb
353
+ - app/helpers/koi/pagy.rb
349
354
  - app/jobs/koi/application_job.rb
350
355
  - app/mailers/koi/application_mailer.rb
351
356
  - app/models/admin/credential.rb
@@ -1,147 +0,0 @@
1
- @use "index-table/ordinal" as *;
2
-
3
- @mixin sort-icon {
4
- display: inline-block;
5
- content: " ";
6
- position: relative;
7
- right: -1rem;
8
- background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 13'%3E%3Cpath d='M.541 0l11.125 12.573a.5.5 0 00.749 0L23.541 0h-23z' fill='%23000' fill-rule='evenodd'/%3E%3C/svg%3E");
9
- background-size: 14px 14px;
10
- height: 14px;
11
- width: 14px;
12
- }
13
-
14
- $grey: #f0ecf3 !default;
15
-
16
- $table-header-color: transparent !default;
17
- $row-border-color: $grey !default;
18
- $row-height: 48px !default;
19
- $cell-spacing: 0.5rem !default;
20
-
21
- $width-small: 6rem !default;
22
- $width-medium: 12rem !default;
23
- $width-large: 16rem !default;
24
-
25
- .index-table {
26
- --row-height: #{$row-height};
27
- --cell-spacing: #{$cell-spacing};
28
- --table-header-color: #{$table-header-color};
29
- --row-border-color: #{$row-border-color};
30
-
31
- --width-small: #{$width-small};
32
- --width-medium: #{$width-medium};
33
- --width-large: #{$width-large};
34
- }
35
-
36
- .index-table {
37
- border: none;
38
- table-layout: fixed;
39
- border-collapse: collapse;
40
- text-align: left;
41
- width: 100%;
42
-
43
- thead {
44
- background: var(--table-header-color);
45
- }
46
-
47
- tr {
48
- height: var(--row-height);
49
- line-height: var(--row-height);
50
- }
51
-
52
- th,
53
- td {
54
- border: none;
55
- box-shadow: inset 0px -1px 0px var(--row-border-color);
56
- overflow: hidden;
57
- text-overflow: ellipsis;
58
- vertical-align: top;
59
- white-space: nowrap;
60
- background-color: white;
61
- padding-right: var(--cell-spacing);
62
-
63
- &:last-child {
64
- padding-right: 0;
65
- }
66
-
67
- > a {
68
- display: block;
69
- overflow: hidden;
70
- white-space: nowrap;
71
- text-overflow: ellipsis;
72
- text-decoration: none;
73
- }
74
-
75
- > img,
76
- > a > img {
77
- max-height: 3rem;
78
- padding: 0;
79
- }
80
-
81
- > .trix-content {
82
- overflow: hidden;
83
- text-overflow: ellipsis;
84
- }
85
- }
86
-
87
- th {
88
- font-weight: bold;
89
- }
90
-
91
- thead th {
92
- // types defined first so they can be overridden with width classes
93
- &.type-boolean,
94
- &.type-number {
95
- width: var(--width-small);
96
- }
97
-
98
- &.type-date,
99
- &.type-currency {
100
- width: var(--width-medium);
101
- }
102
-
103
- &.type-datetime {
104
- width: var(--width-large);
105
- }
106
-
107
- &.width-s {
108
- width: var(--width-small);
109
- }
110
-
111
- &.width-m {
112
- width: var(--width-medium);
113
- }
114
-
115
- &.width-l {
116
- width: var(--width-large);
117
- }
118
- }
119
-
120
- td {
121
- &.type-currency,
122
- &.type-number {
123
- text-align: right;
124
- }
125
- }
126
-
127
- thead a.ascending:after,
128
- [data-sort="asc"] a::after {
129
- @include sort-icon;
130
- top: 0;
131
- transform: rotate(180deg);
132
- }
133
-
134
- thead a.descending:after,
135
- [data-sort="desc"] a::after {
136
- @include sort-icon;
137
- top: 4px;
138
- }
139
-
140
- .button_to {
141
- line-height: 1.5;
142
- }
143
-
144
- caption {
145
- margin: 2rem 0;
146
- }
147
- }