loco-rails-core 0.2.0 → 0.2.1
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 +4 -4
- data/README.md +14 -14
- data/lib/loco/core/helpers.rb +1 -1
- data/lib/loco/core/version.rb +1 -1
- metadata +22 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26dfb688861249f6eab817d589b6c2f4de7bae1fcb05218db33d69617940c741
|
4
|
+
data.tar.gz: 7514dd2f4ba4b8581a20e45cfe9d9a15925db01890ed2190c930cd88e396a629
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e82d8feab942392d9e8bdd8344a00feb7f8a8c95e254c7b005ade84e93c5c9b594fea5b35e89faaf26f6cb3933ef7d0d1fd5baac17b493bb9a3c66c83621c342
|
7
|
+
data.tar.gz: 8b3bb24380d95d267d55f08bad9a1b0bc6d7873d236a71ececb329f046b3e223e12c0eb36175910c7b48d5f6f6761a8faa1b26a2f6f1bbc4d97fc8c8317a675b
|
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
|
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
|
10
|
-
The same controller's action
|
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
|
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
|
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
|
20
|
-
In other words - [Loco-JS](https://github.com/locoframework/loco-js)
|
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
|
32
|
+
**Loco-JS-Core** will act similarly (simplified version):
|
33
33
|
|
34
34
|
```javascript
|
35
|
-
|
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
|
46
|
-
If you don't define an `initialize` or `index` actions - **Loco-JS** won't call them.
|
47
|
-
You can define
|
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
|
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
|
data/lib/loco/core/helpers.rb
CHANGED
@@ -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,
|
data/lib/loco/core/version.rb
CHANGED
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.
|
4
|
+
version: 0.2.1
|
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:
|
11
|
+
date: 2023-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -30,70 +30,70 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 3.
|
33
|
+
version: 3.38.0
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 3.
|
40
|
+
version: 3.38.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: puma
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 6.1.1
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 6.1.1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rubocop
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '1.48'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '1.48'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rubocop-rails
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 2.18.0
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 2.18.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: selenium-webdriver
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 4.8.1
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 4.8.1
|
97
97
|
description: It enhances layout's body element with attributes containing information
|
98
98
|
about the current namespace, controller and action.
|
99
99
|
email:
|
@@ -115,7 +115,8 @@ licenses:
|
|
115
115
|
- MIT
|
116
116
|
metadata:
|
117
117
|
allowed_push_host: https://rubygems.org
|
118
|
-
|
118
|
+
rubygems_mfa_required: 'true'
|
119
|
+
post_install_message:
|
119
120
|
rdoc_options: []
|
120
121
|
require_paths:
|
121
122
|
- lib
|
@@ -123,15 +124,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
123
124
|
requirements:
|
124
125
|
- - ">="
|
125
126
|
- !ruby/object:Gem::Version
|
126
|
-
version:
|
127
|
+
version: 3.0.0
|
127
128
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
129
|
requirements:
|
129
130
|
- - ">="
|
130
131
|
- !ruby/object:Gem::Version
|
131
132
|
version: '0'
|
132
133
|
requirements: []
|
133
|
-
rubygems_version: 3.
|
134
|
-
signing_key:
|
134
|
+
rubygems_version: 3.4.6
|
135
|
+
signing_key:
|
135
136
|
specification_version: 4
|
136
137
|
summary: The core part of the Loco framework. It needs Loco-JS to work.
|
137
138
|
test_files: []
|