habarico 7.3.0.pre.beta.9 → 7.3.0.pre.beta.11

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d4d4ae92bdfc004471375643191a1ca845fb27d8e5186906c185e683705e2277
4
- data.tar.gz: da980d711e305d3cf7b3fb892845068945d308bf0bda223d9ae8f8b5e48e803b
3
+ metadata.gz: 6c0c12a78eabc5ec2b734b49fe2631728bebfaaf0dccab0af628c195dc333880
4
+ data.tar.gz: 5bd53485346b0d43bef3791d74c69603a5b6ae8f005fed3eebacabeb4479affa
5
5
  SHA512:
6
- metadata.gz: 9b4846e10c4ca8541a121e8a552fd6dc6265e2de4716e50e9af4c97ed5a2b4a4e781b4b69f7e3edb2330374eaf90b80bb20f516fcefdd8474576ae08f9942a40
7
- data.tar.gz: 5592767aca7bd94f9748dea4e0770daaa110f5dd04ca61b21ec2472c7e838fbba74b77f0685e7f613a30c564116eb8aea2795db8922f45bb5337daf2a6635cff
6
+ metadata.gz: 554f357c1b5c47e163d4cbbb9fc441a921a116a05d360e3a01351f8cd120df1135603d512b31c92dd745ecb704347f478b4093b1d657568559407c50d8e66d5e
7
+ data.tar.gz: f1276d2569f91a2365dcdbf07d0c66d1eee8d24cdf39e9d34212b685f788baba7c70686aec9eca61ce0f508edc1ff870819ab5ff63ae2b6483dd729a421071d0
data/VERSION CHANGED
@@ -1 +1 @@
1
- 7.3.0-beta.9
1
+ 7.3.0-beta.11
@@ -1,5 +1,8 @@
1
1
  require "rails/generators"
2
2
  require "rails/generators/migration"
3
+ # Defines ActiveRecord::Generators::Base, whose next_migration_number is reused below. Railties
4
+ # does not autoload it, so without this require the generator fails with a NameError.
5
+ require "rails/generators/active_record"
3
6
 
4
7
  module Habarico
5
8
  module Preferences
@@ -53,8 +53,8 @@ module Habarico
53
53
  # Name of the method Habarico calls (via `send`) as its authentication before_action, on both
54
54
  # Habarico::Controller and Habarico::ApplicationController. Point this at an existing no-argument
55
55
  # auth method on your ApplicationController (e.g. `:authenticate_user!`) to reuse it directly. If
56
- # your auth method needs arguments (e.g. eluvia-auth's `authenticate(['public'])`), define a
57
- # one-line wrapper method instead and point this at that.
56
+ # your auth method takes arguments, define a one-line wrapper method instead and point this at
57
+ # that.
58
58
  mattr_accessor :authenticate_method
59
59
  @@authenticate_method = :authenticate_request
60
60
 
@@ -13,19 +13,19 @@ module Habarico
13
13
  dialog_width: generate_dialog_width(action, context),
14
14
  parameters: generate_parameters(action, context),
15
15
  choices: generate_choices(action, context),
16
- endpoint: generate_endpoint(action, context),
16
+ reference: generate_reference(action, context),
17
17
  keep_linked_parent: generate_keep_linked_parent(action, context)
18
18
  )
19
19
  end
20
20
 
21
21
  protected
22
22
 
23
- # What the view's endpoint addresses, left unaddressed when the action points at nothing of its
23
+ # What the view action addresses, left unaddressed when the action points at nothing of its
24
24
  # own. `action_name` and `record_pk` live inside the address, so an action that has either names
25
25
  # the resource it belongs to - the same rule the resource action endpoint follows. Only an
26
26
  # explicit `endpoint_record_pk` is carried: the record of the request is the one the frontend
27
27
  # already renders.
28
- def view_action_endpoint_reference(action, _context)
28
+ def view_action_reference(action, _context)
29
29
  action_name = target_view_action_name(action)
30
30
  record_pk = action.endpoint_record_pk.presence
31
31
  reference = action.endpoint_reference
@@ -68,12 +68,12 @@ module Habarico
68
68
  Habarico::CallableHelper.resolve(action.view_choices, context)
69
69
  end
70
70
 
71
- def generate_endpoint(action, context)
72
- # A standard action of the current resource needs no endpoint - the frontend opens the view
73
- # over the record it already has. One that names its own target does: the endpoint is where
71
+ def generate_reference(action, context)
72
+ # A standard action of the current resource needs no reference - the frontend opens the view
73
+ # over the record it already has. One that names its own target does: the reference is where
74
74
  # the target resource and record are written down.
75
75
  return nil if Habarico::ActionHelper.is_standard_action?(action) && !Habarico::ActionHelper.has_explicit_target?(action)
76
- view_action_endpoint_reference(action, context)
76
+ view_action_reference(action, context)
77
77
  end
78
78
 
79
79
  def generate_keep_linked_parent(action, _context)
@@ -11,7 +11,7 @@ module Habarico
11
11
  name: generate_name(menu_item),
12
12
  mode: generate_mode(menu_item),
13
13
  dialog_width: generate_dialog_width(menu_item),
14
- endpoint: generate_endpoint(menu_item),
14
+ reference: generate_reference(menu_item),
15
15
  keep_linked_parent: generate_keep_linked_parent(menu_item)
16
16
  )
17
17
  end
@@ -38,7 +38,7 @@ module Habarico
38
38
  menu_item.dialog_width
39
39
  end
40
40
 
41
- def generate_endpoint(menu_item)
41
+ def generate_reference(menu_item)
42
42
  menu_view_endpoint_parameters_generator.generate(menu_item)
43
43
  end
44
44
 
@@ -89,9 +89,9 @@ module Habarico
89
89
  end
90
90
 
91
91
  def generate_endpoints(_context, endpoint_parameters)
92
- # Determine endpoint methods to be included, base for the selection ale endpoint parameters collected from the
93
- # actions and views without action name and without reference. Additionally, always include GET.
94
- methods = endpoint_parameters.select { |e| e.action_name.blank? && e.reference.blank? }.map { |e| e.method.to_sym }
92
+ # Determine endpoint methods to be included from the endpoint parameters of the actions and views that address
93
+ # the resource itself (no reference; an action name always comes with one). Additionally, always include GET.
94
+ methods = endpoint_parameters.select { |e| e.reference.blank? }.map { |e| e.method.to_sym }
95
95
  methods << :get # Ensure GET is always present
96
96
  methods = methods.uniq
97
97
 
@@ -14,9 +14,9 @@ module Habarico
14
14
  # Width of the dialog, only used when mode is dialog (MUI breakpoint or CSS width value)
15
15
  string_attr :dialog_width
16
16
 
17
- # What the view's endpoint addresses: which resource, which record, which action. `path` and
17
+ # What the view action addresses: which resource, which record, which action. `path` and
18
18
  # `method` have no place on a view action - how a thing is called is not part of where it is.
19
- has_one_attr :endpoint, 'Habarico::ResourceReference'
19
+ has_one_attr :reference, 'Habarico::ResourceReference'
20
20
 
21
21
  # Additional parameters to be passed to the view
22
22
  has_many_attr :parameters, 'String', underlying_type: :hash
data/lib/habarico.rb CHANGED
@@ -1,5 +1,11 @@
1
1
  require "eluvia-base"
2
2
 
3
+ # Runtime dependencies of the gemspec. Bundler.require in a host app only requires what that app
4
+ # lists itself, so without these a host gets `undefined method 'page'` on its first list request
5
+ # (kaminari) or an uninitialised constant from a permission callable (pundit).
6
+ require "kaminari"
7
+ require "pundit"
8
+
3
9
  # *****************************************************************************
4
10
  # Basic library
5
11
  # *****************************************************************************
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: habarico
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.3.0.pre.beta.9
4
+ version: 7.3.0.pre.beta.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matěj Outlý