katalyst-koi 4.18.0 → 4.19.0

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.
@@ -1,23 +1,24 @@
1
1
  import { Controller } from "@hotwired/stimulus";
2
2
 
3
- import {
4
- get,
5
- parseRequestOptionsFromJSON,
6
- } from "@github/webauthn-json/browser-ponyfill";
7
-
8
3
  export default class WebauthnAuthenticationController extends Controller {
9
4
  static targets = ["response"];
10
- static values = { options: Object };
5
+ static values = {
6
+ options: Object,
7
+ };
8
+
9
+ async authenticate() {
10
+ const credential = await navigator.credentials.get(this.options);
11
11
 
12
- authenticate() {
13
- get(this.options).then((response) => {
14
- this.responseTarget.value = JSON.stringify(response);
12
+ this.responseTarget.value = JSON.stringify(credential.toJSON());
15
13
 
16
- this.element.requestSubmit();
17
- });
14
+ this.element.requestSubmit();
18
15
  }
19
16
 
20
17
  get options() {
21
- return parseRequestOptionsFromJSON(this.optionsValue);
18
+ return {
19
+ publicKey: PublicKeyCredential.parseRequestOptionsFromJSON(
20
+ this.optionsValue.publicKey,
21
+ ),
22
+ };
22
23
  }
23
24
  }
@@ -1,29 +1,27 @@
1
1
  import { Controller } from "@hotwired/stimulus";
2
2
 
3
- import {
4
- create,
5
- parseCreationOptionsFromJSON,
6
- } from "@github/webauthn-json/browser-ponyfill";
7
-
8
3
  export default class WebauthnRegistrationController extends Controller {
9
4
  static values = {
10
5
  options: Object,
11
- response: String,
6
+ response: Object,
12
7
  };
13
8
  static targets = ["intro", "nickname", "response"];
14
9
 
15
10
  submit(e) {
16
- if (this.responseTarget.value === "") {
11
+ if (
12
+ this.responseTarget.value === "" &&
13
+ e.submitter.formMethod !== "dialog"
14
+ ) {
17
15
  e.preventDefault();
18
- this.createCredential();
16
+ this.createCredential().then();
19
17
  }
20
18
  }
21
19
 
22
20
  async createCredential() {
23
- const response = await create(this.options);
21
+ const credential = await navigator.credentials.create(this.options);
24
22
 
25
- this.responseValue = JSON.stringify(response);
26
- this.responseTarget.value = JSON.stringify(response);
23
+ this.responseValue = credential.toJSON();
24
+ this.responseTarget.value = JSON.stringify(credential.toJSON());
27
25
  }
28
26
 
29
27
  responseValueChanged(response) {
@@ -33,6 +31,10 @@ export default class WebauthnRegistrationController extends Controller {
33
31
  }
34
32
 
35
33
  get options() {
36
- return parseCreationOptionsFromJSON(this.optionsValue);
34
+ return {
35
+ publicKey: PublicKeyCredential.parseCreationOptionsFromJSON(
36
+ this.optionsValue.publicKey,
37
+ ),
38
+ };
37
39
  }
38
40
  }
@@ -1,6 +1,7 @@
1
1
  @use "../base/button" as *;
2
2
 
3
- .pagy.nav a {
3
+ .pagy.nav a,
4
+ .pagy.series-nav a {
4
5
  @include button-text;
5
6
  border: 2px solid transparent;
6
7
 
@@ -2,7 +2,6 @@
2
2
 
3
3
  @use "katalyst/govuk/formbuilder" with (
4
4
  $govuk-font-family: "Inter",
5
- $govuk-text-colour: #{var(--site-text-color)},
6
5
  $govuk-typography-scale: (
7
6
  80: govuk-definition(h1),
8
7
  48: govuk-definition(h2),
@@ -12,10 +11,14 @@
12
11
  19: govuk-definition(h6),
13
12
  16: govuk-definition(paragraph),
14
13
  14: govuk-definition(small),
15
- ),
16
- $govuk-input-border-colour: #{var(--site-text-color)}
14
+ )
17
15
  );
18
16
 
17
+ :root {
18
+ --govuk-text-colour: var(--site-text-color);
19
+ --govuk-input-border-colour: var(--site-text-color);
20
+ }
21
+
19
22
  .govuk-input,
20
23
  .govuk-textarea {
21
24
  color: var(--site-text-color);
@@ -8,7 +8,7 @@ module Koi
8
8
  delegate :with_breadcrumb, :with_action, to: :@header
9
9
 
10
10
  def initialize(resource:, title: nil)
11
- super
11
+ super()
12
12
 
13
13
  @resource = resource
14
14
  @title = title
@@ -8,7 +8,7 @@ module Koi
8
8
  delegate :with_breadcrumb, :with_action, to: :@header
9
9
 
10
10
  def initialize(model:, title: model.model_name.human.pluralize)
11
- super
11
+ super()
12
12
 
13
13
  @header = HeaderComponent.new(title:)
14
14
  @model = model
@@ -8,7 +8,7 @@ module Koi
8
8
  delegate :with_breadcrumb, :with_action, to: :@header
9
9
 
10
10
  def initialize(model:, title: nil)
11
- super
11
+ super()
12
12
 
13
13
  @model = model
14
14
  @title = title
@@ -8,7 +8,7 @@ module Koi
8
8
  delegate :with_breadcrumb, :with_action, to: :@header
9
9
 
10
10
  def initialize(resource:, title: nil)
11
- super
11
+ super()
12
12
 
13
13
  @title = title
14
14
  @resource = resource
@@ -6,14 +6,14 @@ module Koi
6
6
  renders_many :breadcrumbs, "LinkComponent"
7
7
 
8
8
  def initialize(title:)
9
- super
9
+ super()
10
10
 
11
11
  @title = title
12
12
  end
13
13
 
14
14
  class LinkComponent < ViewComponent::Base
15
15
  def initialize(name, path, **options)
16
- super
16
+ super()
17
17
 
18
18
  @name = name
19
19
  @path = path
@@ -17,8 +17,8 @@ module Koi
17
17
  item: SummaryList::ItemComponent,
18
18
  }
19
19
 
20
- def initialize(model: nil, skip_blank: true, **attributes)
21
- super(**attributes)
20
+ def initialize(model: nil, skip_blank: true, **)
21
+ super(**)
22
22
 
23
23
  @model = model
24
24
  @skip_blank = skip_blank
@@ -53,13 +53,13 @@ module Admin
53
53
  def archive
54
54
  Admin::User.where(id: params[:id]).where.not(id: current_admin.id).each(&:archive!)
55
55
 
56
- redirect_back(fallback_location: admin_admin_users_path, status: :see_other)
56
+ redirect_back_or_to(admin_admin_users_path, status: :see_other)
57
57
  end
58
58
 
59
59
  def restore
60
60
  Admin::User.archived.where(id: params[:id]).each(&:restore!)
61
61
 
62
- redirect_back(fallback_location: admin_admin_users_path, status: :see_other)
62
+ redirect_back_or_to(admin_admin_users_path, status: :see_other)
63
63
  end
64
64
 
65
65
  def destroy
@@ -5,7 +5,7 @@ module Admin
5
5
  def destroy
6
6
  Rails.logger.warn("[CACHE CLEAR] - Cleaning entire cache manually by #{current_admin} request")
7
7
  Rails.cache.clear
8
- redirect_back(fallback_location: admin_dashboard_path)
8
+ redirect_back_or_to(admin_dashboard_path)
9
9
  end
10
10
  end
11
11
  end
@@ -15,7 +15,15 @@ module Koi
15
15
  include HasAdminUsers
16
16
  include HasAttachments
17
17
  include Katalyst::Tables::Backend
18
- include ::Pagy::Backend
18
+
19
+ if (pagy = "Pagy::Method".safe_constantize)
20
+ include pagy
21
+ elsif (pagy = "Pagy::Backend".safe_constantize)
22
+ # @deprecated Pagy <43
23
+ include pagy
24
+
25
+ helper "::Pagy::Frontend".safe_constantize
26
+ end
19
27
 
20
28
  default_form_builder "Koi::FormBuilder"
21
29
  default_table_component Koi::TableComponent
@@ -25,7 +33,6 @@ module Koi
25
33
  helper Katalyst::GOVUK::Formbuilder::Frontend
26
34
  helper Katalyst::Navigation::FrontendHelper
27
35
  helper Katalyst::Tables::Frontend
28
- helper ::Pagy::Frontend
29
36
  helper Koi::Pagy::Frontend
30
37
  helper IndexActionsHelper
31
38
  helper :all
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Koi
4
+ module Controller
5
+ extend ActiveSupport::Concern
6
+
7
+ included do
8
+ include Koi::Controller::IsAdminController
9
+
10
+ authenticate_local_admins Rails.env.development?
11
+
12
+ helper Koi::ApplicationHelper
13
+ helper Koi::DefinitionListHelper
14
+ end
15
+ end
16
+ end
data/config/importmap.rb CHANGED
@@ -3,7 +3,6 @@
3
3
  pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true
4
4
  pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true
5
5
  pin "@hotwired/turbo-rails", to: "turbo.min.js", preload: true
6
- pin "@github/webauthn-json/browser-ponyfill", to: "https://ga.jspm.io/npm:@github/webauthn-json@2.1.1/dist/esm/webauthn-json.browser-ponyfill.js"
7
6
  pin "@rails/actiontext", to: "actiontext.js", preload: true
8
7
  pin "trix"
9
8
 
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ Koi.config.admin_stylesheet = "admin"
4
+
5
+ Rails.application.config.dartsass.builds = {
6
+ "application.scss" => "application.css",
7
+ "admin.scss" => "admin.css",
8
+ }
9
+
10
+ Rails.application.config.dartsass.build_options << "--quiet-deps"
@@ -0,0 +1,24 @@
1
+ en:
2
+ pagy:
3
+ p11n: 'OneOther'
4
+ aria_label:
5
+ nav:
6
+ one: "Pagination"
7
+ other: "Pagination"
8
+ prev: "Previous page"
9
+ previous: "Previous page" # @deprecated
10
+ next: "Next page"
11
+ prev: "←&nbsp;&nbsp;Previous" # @deprecated
12
+ previous: "←&nbsp;&nbsp;Previous"
13
+ next: "Next&nbsp;&nbsp;→"
14
+ gap: "&hellip;"
15
+ item_name:
16
+ one: "item"
17
+ other: "items"
18
+ info_tag:
19
+ no_count: "Page %{page} of %{pages}"
20
+ no_items: "No %{item_name} found"
21
+ single_page: "Displaying %{count} %{item_name}"
22
+ multiple_pages: "Displaying %{item_name} %{from}-%{to} of %{count} in total"
23
+ input_nav_js: "Page %{page_input} of %{pages}"
24
+ limit_tag_js: "Show %{limit_input} %{item_name} per page"
data/lib/koi/engine.rb CHANGED
@@ -71,7 +71,12 @@ module Koi
71
71
  end
72
72
 
73
73
  initializer "koi.pagination" do
74
- Pagy::I18n.load(locale: "en", filepath: root.join("config/locales/pagy.en.yml"))
74
+ if Pagy::I18n.respond_to?(:pathnames)
75
+ Pagy::I18n.pathnames << root.join("config/locales/pagy")
76
+ else
77
+ # @deprecated support for Pagy <43
78
+ Pagy::I18n.load(locale: "en", filepath: root.join("config/locales/pagy/en.yml"))
79
+ end
75
80
  end
76
81
 
77
82
  initializer "koi.views" do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: katalyst-koi
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.18.0
4
+ version: 4.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katalyst Interactive
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-04-22 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rails
@@ -195,16 +195,16 @@ dependencies:
195
195
  name: katalyst-kpop
196
196
  requirement: !ruby/object:Gem::Requirement
197
197
  requirements:
198
- - - ">="
198
+ - - "<"
199
199
  - !ruby/object:Gem::Version
200
- version: '3.1'
200
+ version: '4'
201
201
  type: :runtime
202
202
  prerelease: false
203
203
  version_requirements: !ruby/object:Gem::Requirement
204
204
  requirements:
205
- - - ">="
205
+ - - "<"
206
206
  - !ruby/object:Gem::Version
207
- version: '3.1'
207
+ version: '4'
208
208
  - !ruby/object:Gem::Dependency
209
209
  name: katalyst-navigation
210
210
  requirement: !ruby/object:Gem::Requirement
@@ -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
@@ -374,6 +378,7 @@ files:
374
378
  - app/controllers/admin/tokens_controller.rb
375
379
  - app/controllers/admin/url_rewrites_controller.rb
376
380
  - app/controllers/admin/well_knowns_controller.rb
381
+ - app/controllers/concerns/koi/controller.rb
377
382
  - app/controllers/concerns/koi/controller/has_admin_users.rb
378
383
  - app/controllers/concerns/koi/controller/has_attachments.rb
379
384
  - app/controllers/concerns/koi/controller/has_webauthn.rb
@@ -457,11 +462,12 @@ files:
457
462
  - app/views/layouts/koi/frame.html.erb
458
463
  - app/views/layouts/koi/login.html.erb
459
464
  - config/importmap.rb
465
+ - config/initializers/dartsass.rb
460
466
  - config/initializers/extensions.rb
461
467
  - config/initializers/flipper.rb
462
468
  - config/initializers/inflections.rb
463
469
  - config/locales/koi.en.yml
464
- - config/locales/pagy.en.yml
470
+ - config/locales/pagy/en.yml
465
471
  - config/routes.rb
466
472
  - db/migrate/20120220130849_devise_create_admins.rb
467
473
  - db/migrate/20130509235316_add_url_rewriter.rb
@@ -531,7 +537,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
531
537
  - !ruby/object:Gem::Version
532
538
  version: '0'
533
539
  requirements: []
534
- rubygems_version: 3.6.2
540
+ rubygems_version: 4.0.3
535
541
  specification_version: 4
536
542
  summary: Koi CMS admin framework
537
543
  test_files: []
@@ -1,11 +0,0 @@
1
- en:
2
- pagy:
3
- aria_label:
4
- nav:
5
- one: "Pagination"
6
- other: "Pagination"
7
- prev: "Previous page"
8
- next: "Next page"
9
- prev: "←&nbsp;&nbsp;Previous"
10
- next: "Next&nbsp;&nbsp;→"
11
- gap: "&hellip;"