loco-rails-core 0.2.0 → 0.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a1b9b27d3833f479412e2468bc55a09f807efd1da6d4c1e5bfd49d43759820c4
4
- data.tar.gz: 3c01e866a531feb3809f809627f7560d5e3486e185c6c4a33e9c32285659a166
3
+ metadata.gz: 51f07df5c4346244b0062ac19d817cca00a03f631bfbdf474c73134241883f2f
4
+ data.tar.gz: e146c72bfd6d6b35e1623272c10b5fc6b5ab1a7953e398d00149bb5caa42de3d
5
5
  SHA512:
6
- metadata.gz: 3209f52b8b481143698234bea1f5df5dba6588d274c9e6b13fe3e893337b135fcd1e4e1004965a6c857272a0132d19bbd338b167fbbb1eaac9a6d4f9046fac02
7
- data.tar.gz: 040b754199dd232da1c98381bf702edd7c80c578ff008487a0debb55a21cab93924019370ad83070c16cea094a04b718dfabbc1461871073860a1ab3aff50853
6
+ metadata.gz: 11d9e55e2a829b7d5d6ba0beeca8fee7596408927d80e3bfb6f5c247be2be6170e7ef2d55fb7274b6d7bf6330a50e62bf675530c0f54ea00617d9252bfe6b9a6
7
+ data.tar.gz: 29ff1f95846b419a2d4e84dad24c1a36438b5469c895e4e9774d2086f30fbd5369722172f493084a89da4ed043cc0b5d13a4320f520957b4e2bd5043702d3936
data/README.md CHANGED
@@ -3,21 +3,21 @@
3
3
  # 🧐 What is Loco-Rails-Core?
4
4
 
5
5
  **Loco-Rails-Core** is a Rails plugin that has been extracted from [Loco-Rails](https://github.com/locoframework/loco-rails).
6
- The reason for this extraction was to pull out the functionality that can be used as a stand-alone lib.
6
+ The reason for this extraction was to pull out functionality that can be used as a stand-alone lib.
7
7
  This functionality was the origin of the [Loco-Rails](https://github.com/locoframework/loco-rails) project.
8
8
 
9
- I wanted to provide a logical structure for JavaScript code that would be corresponding with Rails` controllers and views.
10
- The same controller's action would be called on the JavaScript level that renders a response for a given request on the [Rails](https://rubyonrails.org) side.
9
+ I wanted to provide a logical structure for a JavaScript code that corresponds to Rails` controllers and views.
10
+ The same controller's action that renders a response for a given request on the [Rails](https://rubyonrails.org) side would be called on the JavaScript level.
11
11
  By _"the same"_ - I mean action with the same name and defined in an (optionally namespaced) controller with the corresponding name as the one on the server-side.
12
12
 
13
- The **Loco-Rails-Core** by itself does not provide a lot of value. It has to be used with its JavaScript complementary library - [Loco-JS](https://github.com/locoframework/loco-js).
13
+ The **Loco-Rails-Core**, by itself, does not provide a lot of value. It should be used with its JavaScript complementary library - [Loco-JS-Core](https://github.com/locoframework/loco-js-core).
14
14
  **Loco-Rails-Core**'s single generator adds `Loco::Core::Helpers` module to `ApplicationHelper`.
15
15
  It also updates the `application.html.erb` layout by adding `data-*` attributes to HTML `<body>` element.
16
- **Loco-Rails-Core** does this via methods defined in the aforementioned `Loco::Core::Helpers` module.
16
+ **Loco-Rails-Core** does this via methods defined in the mentioned above `Loco::Core::Helpers` module.
17
17
 
18
- These attributes store the information about namespace, controller and action names involved in handing a given request.
19
- [Loco-JS](https://github.com/locoframework/loco-js) looks at those attributes to call out method from the corresponding location but inside the JavaScript code.
20
- In other words - [Loco-JS](https://github.com/locoframework/loco-js) will call a JavaScript controller's action with the same name and located inside the same namespace.
18
+ These attributes store the information about the namespace, controller, and action names involved in handing a given request.
19
+ [Loco-JS-Core](https://github.com/locoframework/loco-js-core) looks at these attributes to call out a method from the corresponding location but inside the JavaScript code.
20
+ In other words - [Loco-JS-Core](https://github.com/locoframework/loco-js-core) calls a JavaScript controller's action with the same name and located inside the same namespace.
21
21
 
22
22
  _Example:_
23
23
 
@@ -29,10 +29,10 @@ Given that the `index` action from `Main::PagesControllers` handles a given requ
29
29
  </body>
30
30
  ```
31
31
 
32
- **Loco-JS** will act in the similar fashion (simplified version):
32
+ **Loco-JS-Core** will act similarly (simplified version):
33
33
 
34
34
  ```javascript
35
- import { Controllers } from "loco-js";
35
+ // all JavaScript controllers are assigned to the Controllers object
36
36
 
37
37
  namespaceController = new Controllers.Main;
38
38
  namespaceController.initialize();
@@ -42,11 +42,11 @@ controller.initialize();
42
42
  controller.index();
43
43
  ```
44
44
 
45
- If you don't define a namespace controlller - it will be skipped.
46
- If you don't define an `initialize` or `index` actions - **Loco-JS** won't call them.
47
- You can define a JavaScript counterparts only for those actions that you want to augment with JavaScript features.
45
+ If you don't define a namespace controller - it will be skipped.
46
+ If you don't define an `initialize` or `index` actions - **Loco-JS-Core** won't call them.
47
+ You can define JavaScript counterparts only for those actions that you want to augment with JavaScript features.
48
48
 
49
- **Loco-Rails-Core** is a good choice if you don't need all the features that [Loco-Rails](https://github.com/locoframework/loco-rails) provides.
49
+ **Loco-Rails-Core** is the right choice if you don't need all features that [Loco-Rails](https://github.com/locoframework/loco-rails) provides.
50
50
 
51
51
 
52
52
  # 📥 Installation
@@ -4,7 +4,7 @@ module Loco
4
4
  module Core
5
5
  module Helpers
6
6
  def loco_body_data
7
- data_controller = controller_name.split('_').map(&:capitalize).join ''
7
+ data_controller = controller_name.split('_').map(&:capitalize).join
8
8
  {
9
9
  'data-namespace' => namespace_name,
10
10
  'data-controller' => data_controller,
@@ -15,11 +15,14 @@ module Loco
15
15
  private
16
16
 
17
17
  def namespace_name
18
- path = controller_path.split '/'
19
- if path.size > 1
18
+ path = controller_path.split('/')
19
+ case path.size
20
+ when 1
21
+ 'Main'
22
+ when 2
20
23
  path.first
21
24
  else
22
- 'Main'
25
+ path[0..-2][-1]
23
26
  end.capitalize
24
27
  end
25
28
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Loco
4
4
  module Core
5
- VERSION = '0.2.0'
5
+ VERSION = '0.3.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loco-rails-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zbigniew Humeniuk
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-27 00:00:00.000000000 Z
11
+ date: 2024-02-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -24,76 +24,6 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '5.0'
27
- - !ruby/object:Gem::Dependency
28
- name: capybara
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: 3.28.0
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: 3.28.0
41
- - !ruby/object:Gem::Dependency
42
- name: puma
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '4.2'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '4.2'
55
- - !ruby/object:Gem::Dependency
56
- name: rubocop
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: rubocop-rails
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: selenium-webdriver
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '3.142'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '3.142'
97
27
  description: It enhances layout's body element with attributes containing information
98
28
  about the current namespace, controller and action.
99
29
  email:
@@ -115,7 +45,8 @@ licenses:
115
45
  - MIT
116
46
  metadata:
117
47
  allowed_push_host: https://rubygems.org
118
- post_install_message:
48
+ rubygems_mfa_required: 'true'
49
+ post_install_message:
119
50
  rdoc_options: []
120
51
  require_paths:
121
52
  - lib
@@ -123,15 +54,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
123
54
  requirements:
124
55
  - - ">="
125
56
  - !ruby/object:Gem::Version
126
- version: '0'
57
+ version: 3.0.0
127
58
  required_rubygems_version: !ruby/object:Gem::Requirement
128
59
  requirements:
129
60
  - - ">="
130
61
  - !ruby/object:Gem::Version
131
62
  version: '0'
132
63
  requirements: []
133
- rubygems_version: 3.1.2
134
- signing_key:
64
+ rubygems_version: 3.5.6
65
+ signing_key:
135
66
  specification_version: 4
136
67
  summary: The core part of the Loco framework. It needs Loco-JS to work.
137
68
  test_files: []