compony 0.5.1 → 0.5.2

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 (71) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/README.md +31 -0
  4. data/VERSION +1 -1
  5. data/compony.gemspec +4 -4
  6. data/config/routes.rb +9 -6
  7. data/doc/ComponentGenerator.html +3 -3
  8. data/doc/Components.html +3 -3
  9. data/doc/ComponentsGenerator.html +3 -3
  10. data/doc/Compony/Component.html +3 -3
  11. data/doc/Compony/ComponentMixins/Default/Labelling.html +3 -3
  12. data/doc/Compony/ComponentMixins/Default/Standalone/ResourcefulVerbDsl.html +3 -3
  13. data/doc/Compony/ComponentMixins/Default/Standalone/StandaloneDsl.html +40 -28
  14. data/doc/Compony/ComponentMixins/Default/Standalone/VerbDsl.html +3 -3
  15. data/doc/Compony/ComponentMixins/Default/Standalone.html +3 -3
  16. data/doc/Compony/ComponentMixins/Default.html +3 -3
  17. data/doc/Compony/ComponentMixins/Resourceful.html +3 -3
  18. data/doc/Compony/ComponentMixins.html +3 -3
  19. data/doc/Compony/Components/Button.html +3 -3
  20. data/doc/Compony/Components/Destroy.html +3 -3
  21. data/doc/Compony/Components/Edit.html +3 -3
  22. data/doc/Compony/Components/Form.html +3 -3
  23. data/doc/Compony/Components/New.html +3 -3
  24. data/doc/Compony/Components/WithForm.html +3 -3
  25. data/doc/Compony/Components.html +3 -3
  26. data/doc/Compony/ControllerMixin.html +3 -3
  27. data/doc/Compony/Engine.html +3 -3
  28. data/doc/Compony/MethodAccessibleHash.html +3 -3
  29. data/doc/Compony/ModelFields/Anchormodel.html +3 -3
  30. data/doc/Compony/ModelFields/Association.html +4 -4
  31. data/doc/Compony/ModelFields/Attachment.html +3 -3
  32. data/doc/Compony/ModelFields/Base.html +3 -3
  33. data/doc/Compony/ModelFields/Boolean.html +3 -3
  34. data/doc/Compony/ModelFields/Color.html +3 -3
  35. data/doc/Compony/ModelFields/Currency.html +3 -3
  36. data/doc/Compony/ModelFields/Date.html +3 -3
  37. data/doc/Compony/ModelFields/Datetime.html +3 -3
  38. data/doc/Compony/ModelFields/Decimal.html +3 -3
  39. data/doc/Compony/ModelFields/Email.html +3 -3
  40. data/doc/Compony/ModelFields/Float.html +3 -3
  41. data/doc/Compony/ModelFields/Integer.html +3 -3
  42. data/doc/Compony/ModelFields/Percentage.html +3 -3
  43. data/doc/Compony/ModelFields/Phone.html +3 -3
  44. data/doc/Compony/ModelFields/RichText.html +3 -3
  45. data/doc/Compony/ModelFields/String.html +3 -3
  46. data/doc/Compony/ModelFields/Text.html +3 -3
  47. data/doc/Compony/ModelFields/Time.html +3 -3
  48. data/doc/Compony/ModelFields/Url.html +3 -3
  49. data/doc/Compony/ModelFields.html +3 -3
  50. data/doc/Compony/ModelMixin.html +3 -3
  51. data/doc/Compony/NaturalOrdering.html +3 -3
  52. data/doc/Compony/RequestContext.html +3 -3
  53. data/doc/Compony/Version.html +3 -3
  54. data/doc/Compony/ViewHelpers.html +3 -3
  55. data/doc/Compony.html +3 -3
  56. data/doc/ComponyController.html +3 -3
  57. data/doc/_index.html +4 -4
  58. data/doc/class_list.html +6 -3
  59. data/doc/css/full_list.css +3 -3
  60. data/doc/css/style.css +6 -0
  61. data/doc/file.README.html +33 -3
  62. data/doc/file_list.html +5 -2
  63. data/doc/frames.html +10 -5
  64. data/doc/index.html +33 -3
  65. data/doc/js/app.js +294 -264
  66. data/doc/js/full_list.js +30 -4
  67. data/doc/method_list.html +5 -2
  68. data/doc/top-level-namespace.html +3 -3
  69. data/lib/compony/component_mixins/default/standalone/standalone_dsl.rb +7 -1
  70. data/lib/compony/model_fields/association.rb +1 -1
  71. metadata +3 -3
data/doc/js/full_list.js CHANGED
@@ -62,8 +62,25 @@ function enableToggles() {
62
62
  evt.stopPropagation();
63
63
  evt.preventDefault();
64
64
  $(this).parent().parent().toggleClass('collapsed');
65
+ $(this).attr('aria-expanded', function (i, attr) {
66
+ return attr == 'true' ? 'false' : 'true'
67
+ });
65
68
  highlight();
66
69
  });
70
+
71
+ // navigation of nested classes using keyboard
72
+ $('#full_list a.toggle').on('keypress',function(evt) {
73
+ // enter key is pressed
74
+ if (evt.which == 13) {
75
+ evt.stopPropagation();
76
+ evt.preventDefault();
77
+ $(this).parent().parent().toggleClass('collapsed');
78
+ $(this).attr('aria-expanded', function (i, attr) {
79
+ return attr == 'true' ? 'false' : 'true'
80
+ });
81
+ highlight();
82
+ }
83
+ });
67
84
  }
68
85
 
69
86
  function populateSearchCache() {
@@ -91,7 +108,7 @@ function enableSearch() {
91
108
  }
92
109
  });
93
110
 
94
- $('#full_list').after("<div id='noresults' style='display:none'></div>");
111
+ $('#full_list').after("<div id='noresults' role='status' style='display: none'></div>");
95
112
  }
96
113
 
97
114
  function ignoredKeyPress(event) {
@@ -154,11 +171,14 @@ function partialSearch(searchString, offset) {
154
171
  function searchDone() {
155
172
  searchTimeout = null;
156
173
  highlight();
157
- if ($('#full_list li:visible').size() === 0) {
158
- $('#noresults').text('No results were found.').hide().fadeIn();
174
+ var found = $('#full_list li:visible').size();
175
+ if (found === 0) {
176
+ $('#noresults').text('No results were found.');
159
177
  } else {
160
- $('#noresults').text('').hide();
178
+ // This is read out to screen readers
179
+ $('#noresults').text('There are ' + found + ' results.');
161
180
  }
181
+ $('#noresults').show();
162
182
  $('#content').removeClass('insearch');
163
183
  }
164
184
 
@@ -188,6 +208,12 @@ function expandTo(path) {
188
208
  $target.addClass('clicked');
189
209
  $target.removeClass('collapsed');
190
210
  $target.parentsUntil('#full_list', 'li').removeClass('collapsed');
211
+
212
+ $target.find('a.toggle').attr('aria-expanded', 'true')
213
+ $target.parentsUntil('#full_list', 'li').each(function(i, el) {
214
+ $(el).find('> div > a.toggle').attr('aria-expanded', 'true');
215
+ });
216
+
191
217
  if($target[0]) {
192
218
  window.scrollTo(window.scrollX, $target.offset().top - 250);
193
219
  highlight();
data/doc/method_list.html CHANGED
@@ -1,5 +1,5 @@
1
1
  <!DOCTYPE html>
2
- <html>
2
+ <html >
3
3
  <head>
4
4
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
5
5
  <meta charset="utf-8" />
@@ -38,7 +38,10 @@
38
38
 
39
39
  </div>
40
40
 
41
- <div id="search">Search: <input type="text" /></div>
41
+ <div id="search">
42
+ <label for="search-class">Search:</label>
43
+ <input id="search-class" type="text" />
44
+ </div>
42
45
  </div>
43
46
 
44
47
  <ul id="full_list" class="method">
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Top Level Namespace
8
8
 
9
- &mdash; Documentation by YARD 0.9.34
9
+ &mdash; Documentation by YARD 0.9.37
10
10
 
11
11
  </title>
12
12
 
@@ -102,9 +102,9 @@
102
102
  </div>
103
103
 
104
104
  <div id="footer">
105
- Generated on Mon Sep 16 14:57:51 2024 by
105
+ Generated on Wed Nov 20 10:54:24 2024 by
106
106
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
107
- 0.9.34 (ruby-3.3.5).
107
+ 0.9.37 (ruby-3.3.5).
108
108
  </div>
109
109
 
110
110
  </div>
@@ -6,12 +6,15 @@ module Compony
6
6
  # Wrapper and DSL helper for component's standalone config
7
7
  # Pass `provide_defaults` true if this is the first standalone DSL of a component. Pass false if it is a subsequent one (e.g. if subclassed comp)
8
8
  class StandaloneDsl < Dslblend::Base
9
- def initialize(component, name = nil, provide_defaults:, path: nil)
9
+ def initialize(component, name = nil, provide_defaults:, path: nil, constraints: nil, scope: nil, scope_args: {})
10
10
  super()
11
11
  @component = component
12
12
  @name = name&.to_sym
13
13
  @provide_defaults = provide_defaults
14
14
  @path = path
15
+ @constraints = constraints
16
+ @scope = scope
17
+ @scope_args = scope_args
15
18
  @verbs = {}
16
19
  @skip_authentication = false
17
20
  @layout = true # can be overriden by false or a string
@@ -24,6 +27,9 @@ module Compony
24
27
  return {
25
28
  name: @name,
26
29
  path: @path,
30
+ constraints: @constraints,
31
+ scope: @scope,
32
+ scope_args: @scope_args,
27
33
  verbs: @verbs,
28
34
  rails_action_name: Compony.rails_action_name(comp_name, family_name, @name),
29
35
  path_helper_name: Compony.path_helper_name(comp_name, family_name, @name),
@@ -44,7 +44,7 @@ module Compony
44
44
  end
45
45
 
46
46
  def simpleform_input(form, _component, name: nil, **input_opts)
47
- return form.association name || @name, **input_opts
47
+ return form.association name || @name, **{ label_method: :label }.deep_merge(input_opts)
48
48
  end
49
49
 
50
50
  def simpleform_input_hidden(form, _component, name: nil, **input_opts)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: compony
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sandro Kalbermatter
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-09-16 00:00:00.000000000 Z
12
+ date: 2024-11-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: yard
@@ -330,7 +330,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
330
330
  - !ruby/object:Gem::Version
331
331
  version: '0'
332
332
  requirements: []
333
- rubygems_version: 3.5.18
333
+ rubygems_version: 3.5.22
334
334
  signing_key:
335
335
  specification_version: 4
336
336
  summary: Compony is a Gem that allows you to write your Rails application in component-style