headmin 0.3.2 → 0.3.3

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 (62) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/Gemfile +1 -1
  4. data/Gemfile.lock +27 -23
  5. data/app/assets/images/document.docx +0 -0
  6. data/app/assets/images/document.pdf +0 -0
  7. data/app/assets/images/image.jpg +0 -0
  8. data/app/assets/images/spreadsheet.xls +0 -0
  9. data/app/assets/images/video.mp4 +0 -0
  10. data/app/assets/javascripts/headmin/controllers/table_actions_controller.js +2 -2
  11. data/app/assets/javascripts/headmin/controllers/table_controller.js +28 -13
  12. data/app/assets/javascripts/headmin/index.js +0 -4
  13. data/app/assets/javascripts/headmin.js +33 -696
  14. data/app/assets/stylesheets/headmin/form.scss +4 -4
  15. data/app/assets/stylesheets/headmin/vendor/tom-select-bootstrap.css +1 -2
  16. data/app/assets/stylesheets/headmin.css +3 -3
  17. data/app/controllers/concerns/headmin/authentication.rb +1 -1
  18. data/app/controllers/concerns/headmin/searchable.rb +1 -1
  19. data/app/controllers/concerns/headmin/sortable.rb +7 -7
  20. data/app/helpers/headmin/admin_helper.rb +1 -1
  21. data/app/helpers/headmin/bootstrap_helper.rb +2 -24
  22. data/app/helpers/headmin/documentation_helper.rb +1 -1
  23. data/app/helpers/headmin/filter_helper.rb +1 -1
  24. data/app/helpers/headmin/form_helper.rb +3 -3
  25. data/app/helpers/headmin/notification_helper.rb +21 -21
  26. data/app/helpers/headmin/request_helper.rb +3 -3
  27. data/app/models/concerns/headmin/block.rb +1 -2
  28. data/app/models/concerns/headmin/blockable.rb +1 -1
  29. data/app/models/concerns/headmin/field.rb +1 -1
  30. data/app/models/concerns/headmin/fieldable.rb +8 -8
  31. data/app/models/headmin/documentation_renderer.rb +4 -4
  32. data/app/models/headmin/form/base.rb +1 -2
  33. data/app/models/headmin/form/text.rb +5 -7
  34. data/app/models/headmin/thumbnail.rb +61 -0
  35. data/app/services/block_service.rb +53 -53
  36. data/app/views/headmin/_thumbnail.html.erb +42 -40
  37. data/app/views/headmin/dropdown/_item.html.erb +1 -1
  38. data/app/views/headmin/forms/_checkbox.html.erb +1 -1
  39. data/app/views/headmin/forms/_file.html.erb +1 -1
  40. data/app/views/headmin/forms/_repeater.html.erb +1 -1
  41. data/app/views/headmin/forms/actions/_destroy.html.erb +3 -3
  42. data/app/views/headmin/forms/fields/_group.html.erb +1 -1
  43. data/app/views/headmin/nav/item/_devise.html.erb +1 -1
  44. data/app/views/headmin/table/_actions.html.erb +1 -1
  45. data/app/views/headmin/views/devise/registrations/_edit.html.erb +2 -2
  46. data/config/initializers/customize_input_error.rb +4 -4
  47. data/lib/generators/headmin/blocks_generator.rb +8 -8
  48. data/lib/generators/headmin/devise_generator.rb +4 -4
  49. data/lib/generators/headmin/fields_generator.rb +9 -9
  50. data/lib/generators/templates/controllers/auth/confirmations_controller.rb +1 -1
  51. data/lib/generators/templates/controllers/auth/omniauth_callbacks_controller.rb +1 -1
  52. data/lib/generators/templates/controllers/auth/passwords_controller.rb +1 -1
  53. data/lib/generators/templates/controllers/auth/registrations_controller.rb +1 -1
  54. data/lib/generators/templates/controllers/auth/sessions_controller.rb +1 -1
  55. data/lib/generators/templates/controllers/auth/unlocks_controller.rb +1 -1
  56. data/lib/generators/templates/models/block.rb +1 -1
  57. data/lib/headmin/engine.rb +6 -6
  58. data/lib/headmin/version.rb +1 -1
  59. data/package.json +0 -1
  60. data/yarn.lock +1 -258
  61. metadata +9 -4
  62. data/.rubocop.yml +0 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c1d43ff2f3fab40b3a597c30f26552353fc7889ea75c44b53eca02bfe877982d
4
- data.tar.gz: 162ce2db375e699dd251b7337eeb211bf8ed07376dfc35f4ca8d41307f879188
3
+ metadata.gz: 9030a5fb86be00d17cc66832c36991fe2af18d745c94737a548695ff572b1b6f
4
+ data.tar.gz: 786656902c0252efd3a2ea7b29df56f0c31b006dbdc1ee7bab4e2573711b617d
5
5
  SHA512:
6
- metadata.gz: 013eabe34e14a54f914bd4f64f7f83e7c3cd14f3e15442d8259264a8e783f42825e6a6a5e4ac2b70571a0a819c1297969814585e228945c7fee1ed6517824930
7
- data.tar.gz: d040ffa1c92d518d6aedf8c863b6ad942d5cb57da10f934f5e38574746265852823b7282a0203048abdea104d6d91244682ec1e619bf4864a0b930e4eca89d58
6
+ metadata.gz: 599ca9728a88c3a9cd210429d5864660eef92831602f3f4c1370d0b40a58640e288fc3682caff76463e43e43df86cf56844cc414e53ec260e12308e7be6ea76b
7
+ data.tar.gz: 8647e86331483620394e4ae0c0cf38c4ccac1ae89843de242a590af2bdb819104ffd0afd89bd77f5e6fb1264a9ead16dc8915c7ecf3dc7b740d52b65b73518a6
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-3.0.0
1
+ ruby-3.1.0
data/Gemfile CHANGED
@@ -8,4 +8,4 @@ gemspec
8
8
  gem "rake", "~> 13.0"
9
9
 
10
10
  gem "minitest", "~> 5.0"
11
- gem "rubocop", "~> 1.7"
11
+ gem "standard", "~> 1.7"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- headmin (0.3.2)
4
+ headmin (0.3.3)
5
5
  closure_tree (~> 7.4)
6
6
  inline_svg (~> 1.7)
7
7
  redcarpet (~> 3.5)
@@ -10,23 +10,22 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- activemodel (6.1.4.1)
14
- activesupport (= 6.1.4.1)
15
- activerecord (6.1.4.1)
16
- activemodel (= 6.1.4.1)
17
- activesupport (= 6.1.4.1)
18
- activesupport (6.1.4.1)
13
+ activemodel (7.0.1)
14
+ activesupport (= 7.0.1)
15
+ activerecord (7.0.1)
16
+ activemodel (= 7.0.1)
17
+ activesupport (= 7.0.1)
18
+ activesupport (7.0.1)
19
19
  concurrent-ruby (~> 1.0, >= 1.0.2)
20
20
  i18n (>= 1.6, < 2)
21
21
  minitest (>= 5.1)
22
22
  tzinfo (~> 2.0)
23
- zeitwerk (~> 2.3)
24
23
  ast (2.4.2)
25
24
  closure_tree (7.4.0)
26
25
  activerecord (>= 4.2.10)
27
26
  with_advisory_lock (>= 4.0.0)
28
27
  concurrent-ruby (1.1.9)
29
- i18n (1.8.11)
28
+ i18n (1.9.1)
30
29
  concurrent-ruby (~> 1.0)
31
30
  inline_svg (1.8.0)
32
31
  activesupport (>= 3.0)
@@ -34,34 +33,39 @@ GEM
34
33
  minitest (5.14.4)
35
34
  nokogiri (1.13.1-x86_64-darwin)
36
35
  racc (~> 1.4)
37
- parallel (1.20.1)
38
- parser (3.0.0.0)
36
+ parallel (1.21.0)
37
+ parser (3.1.0.0)
39
38
  ast (~> 2.4.1)
40
39
  racc (1.6.0)
41
- rainbow (3.0.0)
40
+ rainbow (3.1.1)
42
41
  rake (13.0.3)
43
42
  redcarpet (3.5.1)
44
- regexp_parser (2.1.1)
45
- rexml (3.2.4)
43
+ regexp_parser (2.2.0)
44
+ rexml (3.2.5)
46
45
  rouge (3.27.0)
47
- rubocop (1.11.0)
46
+ rubocop (1.25.0)
48
47
  parallel (~> 1.10)
49
- parser (>= 3.0.0.0)
48
+ parser (>= 3.1.0.0)
50
49
  rainbow (>= 2.2.2, < 4.0)
51
50
  regexp_parser (>= 1.8, < 3.0)
52
51
  rexml
53
- rubocop-ast (>= 1.2.0, < 2.0)
52
+ rubocop-ast (>= 1.15.1, < 2.0)
54
53
  ruby-progressbar (~> 1.7)
55
54
  unicode-display_width (>= 1.4.0, < 3.0)
56
- rubocop-ast (1.4.1)
57
- parser (>= 2.7.1.5)
55
+ rubocop-ast (1.15.1)
56
+ parser (>= 3.0.1.1)
57
+ rubocop-performance (1.13.2)
58
+ rubocop (>= 1.7.0, < 2.0)
59
+ rubocop-ast (>= 0.4.0)
58
60
  ruby-progressbar (1.11.0)
61
+ standard (1.7.0)
62
+ rubocop (= 1.25.0)
63
+ rubocop-performance (= 1.13.2)
59
64
  tzinfo (2.0.4)
60
65
  concurrent-ruby (~> 1.0)
61
- unicode-display_width (2.0.0)
66
+ unicode-display_width (2.1.0)
62
67
  with_advisory_lock (4.6.0)
63
68
  activerecord (>= 4.2)
64
- zeitwerk (2.5.3)
65
69
 
66
70
  PLATFORMS
67
71
  x86_64-darwin-19
@@ -70,7 +74,7 @@ DEPENDENCIES
70
74
  headmin!
71
75
  minitest (~> 5.0)
72
76
  rake (~> 13.0)
73
- rubocop (~> 1.7)
77
+ standard (~> 1.7)
74
78
 
75
79
  BUNDLED WITH
76
- 2.2.14
80
+ 2.3.3
Binary file
File without changes
Binary file
Binary file
Binary file
@@ -69,9 +69,9 @@ export default class extends Controller {
69
69
  const option = this.selectedOption()
70
70
  const confirm = option.dataset.confirm
71
71
  if (confirm) {
72
- this.buttonTarget.dataset.confirm = confirm
72
+ this.formTarget.dataset.turboConfirm = confirm
73
73
  } else {
74
- this.buttonTarget.removeAttribute('data-confirm')
74
+ this.formTarget.removeAttribute('data-turbo-confirm')
75
75
  }
76
76
  this.enableButton()
77
77
  }
@@ -1,6 +1,5 @@
1
1
  import {Controller} from "@hotwired/stimulus"
2
2
  import Sortable from "sortablejs";
3
- import Rails from "@rails/ujs";
4
3
 
5
4
  export default class extends Controller {
6
5
  static get values() {
@@ -18,23 +17,39 @@ export default class extends Controller {
18
17
  new Sortable(this.bodyTarget, {
19
18
  handle: '.table-drag-sort-handle',
20
19
  onEnd: (event) => {
21
- Rails.ajax({
22
- url: this.urlValue,
23
- type: "PATCH",
24
- data: this.getIdsDataString(),
25
- });
20
+ this.submitPositions()
26
21
  }
27
22
  })
28
23
  }
29
24
 
30
- getIdsDataString() {
31
- const table = this.tableTarget
32
- let data = ""
33
- const handles = [...table.querySelectorAll(".table-drag-sort-handle")]
34
- handles.map(handle => {
35
- data += `ids[]=${handle.dataset.id}&`
25
+ submitPositions() {
26
+ fetch(this.urlValue, {
27
+ method: 'PATCH',
28
+ body: this.idsFormData(),
29
+ headers: {
30
+ 'X-CSRF-Token': document.querySelector('meta[name="csrf-token"]').content
31
+ },
32
+ }).then((response) => {
33
+ return response.text()
34
+ }).catch((err) => {
35
+ console.warn('Fetch went wrong', err)
36
36
  })
37
- return data
37
+ }
38
+
39
+ positions() {
40
+ const handles = [...this.tableTarget.querySelectorAll(".table-drag-sort-handle")]
41
+ return handles.map((handle) => {
42
+ return handle.dataset.id
43
+ })
44
+ }
45
+
46
+ idsFormData() {
47
+ let formData = new FormData()
48
+ console.log(this.positions())
49
+ this.positions().forEach(id => {
50
+ formData.append('ids[]', id)
51
+ })
52
+ return formData
38
53
  }
39
54
 
40
55
  toggleIds(event) {
@@ -14,7 +14,6 @@ import RepeaterController from "./controllers/repeater_controller"
14
14
  import SelectController from "./controllers/select_controller"
15
15
  import TableActionsController from "./controllers/table_actions_controller"
16
16
  import TableController from "./controllers/table_controller"
17
- import Rails from "@rails/ujs";
18
17
 
19
18
  export class Headmin {
20
19
  static start() {
@@ -34,8 +33,5 @@ export class Headmin {
34
33
  Stimulus.register("select", SelectController)
35
34
  Stimulus.register("table", TableController)
36
35
  Stimulus.register("table-actions", TableActionsController)
37
-
38
- // Init Rails UJS
39
- Rails.start()
40
36
  }
41
37
  }