katalyst-koi 4.20.0 → 4.20.1

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.
@@ -11,7 +11,7 @@ module Koi
11
11
  super()
12
12
 
13
13
  @resource = resource
14
- @title = title
14
+ @title = title
15
15
 
16
16
  @header = HeaderComponent.new(title: self.title)
17
17
  end
@@ -26,8 +26,8 @@ module Koi
26
26
  def initialize(cell:, url:, default_url:, **)
27
27
  super(**)
28
28
 
29
- @cell = cell
30
- @url = url
29
+ @cell = cell
30
+ @url = url
31
31
  @default_url = default_url
32
32
  end
33
33
 
@@ -71,7 +71,7 @@ module Admin
71
71
  private
72
72
 
73
73
  def set_admin
74
- @admin = Admin::User.with_archived.find(params[:id])
74
+ @admin = Admin::User.with_archived.find(params.expect(:id))
75
75
 
76
76
  request.variant << :self if @admin == current_admin_user
77
77
  end
@@ -52,7 +52,7 @@ module Admin
52
52
  end
53
53
 
54
54
  def destroy
55
- credential = @admin_user.credentials.find(params[:id])
55
+ credential = @admin_user.credentials.find(params.expect(:id))
56
56
  credential.destroy!
57
57
 
58
58
  respond_to do |format|
@@ -68,7 +68,7 @@ module Admin
68
68
  end
69
69
 
70
70
  def set_admin_user
71
- @admin_user = Admin::User.find(params[:admin_user_id])
71
+ @admin_user = Admin::User.find(params.expect(:admin_user_id))
72
72
 
73
73
  if current_admin == @admin_user
74
74
  request.variant = :self
@@ -40,7 +40,7 @@ module Admin
40
40
  end
41
41
 
42
42
  def set_admin_user
43
- @admin_user = Admin::User.find(params[:admin_user_id])
43
+ @admin_user = Admin::User.find(params.expect(:admin_user_id))
44
44
 
45
45
  if current_admin == @admin_user
46
46
  request.variant = :self
@@ -33,7 +33,7 @@ module Admin
33
33
  private
34
34
 
35
35
  def set_admin_user
36
- @admin_user = Admin::User.find(params[:admin_user_id])
36
+ @admin_user = Admin::User.find(params.expect(:admin_user_id))
37
37
  end
38
38
  end
39
39
  end
@@ -56,7 +56,7 @@ module Admin
56
56
  end
57
57
 
58
58
  def set_url_rewrite
59
- @url_rewrite = UrlRewrite.find(params[:id])
59
+ @url_rewrite = UrlRewrite.find(params.expect(:id))
60
60
  end
61
61
 
62
62
  class Collection < Admin::Collection
@@ -55,7 +55,7 @@ module Admin
55
55
 
56
56
  # Use callbacks to share common setup or constraints between actions.
57
57
  def set_well_known
58
- @well_known = ::WellKnown.find(params[:id])
58
+ @well_known = ::WellKnown.find(params.expect(:id))
59
59
  end
60
60
 
61
61
  class Collection < Admin::Collection
@@ -16,7 +16,7 @@ module Koi
16
16
  include HasAttachments
17
17
  include Katalyst::Tables::Backend
18
18
 
19
- if (pagy = "Pagy::Method".safe_constantize)
19
+ if (pagy = "Pagy::Method".safe_constantize)
20
20
  include pagy
21
21
  elsif (pagy = "Pagy::Backend".safe_constantize)
22
22
  # @deprecated Pagy <43
@@ -53,7 +53,7 @@ module Koi
53
53
 
54
54
  return unless admin_user
55
55
 
56
- session[:admin_user_id] = admin_user.id
56
+ session[:admin_user_id] = admin_user.id
57
57
  session[:admin_user_signed_in_at] = Time.current.iso8601(6)
58
58
 
59
59
  flash.delete(:redirect) if (redirect = flash[:redirect])
@@ -10,16 +10,16 @@ module Koi
10
10
 
11
11
  admin_user.current_sign_in_at = sign_in_at
12
12
  admin_user.current_sign_in_ip = request.remote_ip
13
- admin_user.sign_in_count += 1
13
+ admin_user.sign_in_count += 1
14
14
 
15
15
  admin_user.save!
16
16
 
17
- session[:admin_user_id] = admin_user.id
17
+ session[:admin_user_id] = admin_user.id
18
18
  session[:admin_user_signed_in_at] = sign_in_at.iso8601(6)
19
19
  end
20
20
 
21
21
  def destroy_admin_session!(admin_user)
22
- session[:admin_user_id] = nil
22
+ session[:admin_user_id] = nil
23
23
  session[:admin_user_signed_in_at] = nil
24
24
 
25
25
  return unless admin_user
@@ -28,7 +28,7 @@ module Koi
28
28
 
29
29
  update_last_sign_in(admin_user)
30
30
 
31
- admin_user.last_sign_out_at = sign_out_at
31
+ admin_user.last_sign_out_at = sign_out_at
32
32
  admin_user.current_sign_in_at = nil
33
33
  admin_user.current_sign_in_ip = nil
34
34
 
@@ -10,6 +10,6 @@ class WellKnownsController < ApplicationController
10
10
  private
11
11
 
12
12
  def set_well_known
13
- @well_known = WellKnown.find_by!(name: params[:name])
13
+ @well_known = WellKnown.find_by!(name: params.expect(:name))
14
14
  end
15
15
  end
@@ -5,8 +5,8 @@ module Koi
5
5
  # Returns a string representing the number of days ago or from now.
6
6
  # If the date is not 'recent' returns nil.
7
7
  def days_ago_in_words(value)
8
- from_time = value.to_time
9
- to_time = Date.current.to_time
8
+ from_time = value.to_time
9
+ to_time = Date.current.to_time
10
10
  distance_in_days = ((to_time - from_time) / (24.0 * 60.0 * 60.0)).round
11
11
 
12
12
  case distance_in_days
@@ -15,7 +15,7 @@ module Koi
15
15
 
16
16
  hook_for :admin_controller, in: :koi, as: :admin, type: :boolean, default: true do |instance, controller|
17
17
  args, opts, config = @_initializer
18
- opts ||= {}
18
+ opts ||= {}
19
19
 
20
20
  # setting model_name so that generators will use the controller_class_path
21
21
  instance.invoke controller, args, { model_name: instance.name, **opts }, config
@@ -42,7 +42,7 @@ module Koi
42
42
  def permitted_params
43
43
  attachments, others = attributes_names.partition { |name| attachments?(name) }
44
44
  params = others.map { |name| ":#{name}" }
45
- params += attachments.map { |name| "#{name}: []" }
45
+ params += attachments.map { |name| "#{name}: []" }
46
46
  params.join(", ")
47
47
  end
48
48
 
@@ -67,9 +67,10 @@ module Koi
67
67
  in_root do
68
68
  if (namespace_match = match_file(route_file, namespace_pattern))
69
69
  base_indent, *, existing_block_indent = namespace_match.captures.compact.map(&:length)
70
- existing_line_pattern = /^ {,#{existing_block_indent}}\S.+\n?/
71
- routing_code = rebase_indentation(routing_code, base_indent + 2).gsub(existing_line_pattern, "")
72
- namespace_pattern = /#{Regexp.escape namespace_match.to_s}/
70
+
71
+ existing_line_pattern = /^ {,#{existing_block_indent}}\S.+\n?/
72
+ routing_code = rebase_indentation(routing_code, base_indent + 2).gsub(existing_line_pattern, "")
73
+ namespace_pattern = /#{Regexp.escape namespace_match.to_s}/
73
74
  end
74
75
 
75
76
  inject_into_file route_file, routing_code, after: namespace_pattern, verbose: true, force: false
@@ -41,7 +41,7 @@ module Koi
41
41
  # @see GOVUKDesignSystemFormBuilder::Builder#govuk_document_field
42
42
  def govuk_document_field(attribute_name, hint: {}, **, &)
43
43
  if hint.is_a?(Hash)
44
- max_size = hint.fetch(:max_size, Koi.config.document_size_limit)
44
+ max_size = hint.fetch(:max_size, Koi.config.document_size_limit)
45
45
  hint[:text] ||= t("helpers.hint.default.document", max_size: @template.number_to_human_size(max_size))
46
46
  end
47
47
 
@@ -52,7 +52,7 @@ module Koi
52
52
  # @see GOVUKDesignSystemFormBuilder::Builder#govuk_image_field
53
53
  def govuk_image_field(attribute_name, hint: {}, **, &)
54
54
  if hint.is_a?(Hash)
55
- max_size = hint.fetch(:max_size, Koi.config.image_size_limit)
55
+ max_size = hint.fetch(:max_size, Koi.config.image_size_limit)
56
56
  hint[:text] ||= t("helpers.hint.default.document", max_size: @template.number_to_human_size(max_size))
57
57
  end
58
58
 
@@ -97,7 +97,7 @@ module Koi
97
97
  {
98
98
  id: field_id(link_errors: true),
99
99
  class: classes,
100
- aria: { describedby: combine_references(hint_id, error_id, supplemental_id) },
100
+ aria: { describedby: combine_references(hint_id, error_id) },
101
101
  }
102
102
  end
103
103
 
@@ -16,8 +16,8 @@ module Koi
16
16
  end
17
17
 
18
18
  def admin_call(env)
19
- request = ActionDispatch::Request.new(env)
20
- session = ActionDispatch::Request::Session.find(request)
19
+ request = ActionDispatch::Request.new(env)
20
+ session = ActionDispatch::Request::Session.find(request)
21
21
  authenticated = authenticated?(session)
22
22
 
23
23
  if requires_authentication?(request) && !authenticated
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: katalyst-koi
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.20.0
4
+ version: 4.20.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katalyst Interactive
@@ -242,6 +242,10 @@ files:
242
242
  - MIT-LICENSE
243
243
  - README.md
244
244
  - Upgrade.md
245
+ - app/assets/builds/katalyst/koi.esm.js
246
+ - app/assets/builds/katalyst/koi.js
247
+ - app/assets/builds/katalyst/koi.min.js
248
+ - app/assets/builds/katalyst/koi.min.js.map
245
249
  - app/assets/builds/koi/admin.css
246
250
  - app/assets/config/koi.js
247
251
  - app/assets/images/koi/application/chevron-right.svg
@@ -534,7 +538,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
534
538
  - !ruby/object:Gem::Version
535
539
  version: '0'
536
540
  requirements: []
537
- rubygems_version: 4.0.3
541
+ rubygems_version: 4.0.10
538
542
  specification_version: 4
539
543
  summary: Koi CMS admin framework
540
544
  test_files: []