inesita 0.4.1 → 0.4.4
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/CHANGELOG.md +13 -1
- data/inesita.gemspec +1 -1
- data/lib/inesita/cli/template/.gitignore.tt +1 -1
- data/lib/inesita/server.rb +15 -3
- data/opal/inesita/router.rb +8 -0
- data/opal/inesita/routes.rb +3 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fdaaffe2e4aafb5d72428c08684f3c3c2330611d
|
4
|
+
data.tar.gz: 6f1453ef8e9cdd016baf70935a2a719144fe1667
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26968cf01a88384d6eee6ee5a66f54e588437c652abbf18ec50fcd8c63a8fe3783c6ea11352ff4c0384a9e79f4466a9a2854e70b1a8cb3753e5a4e2d9fd6ca52
|
7
|
+
data.tar.gz: 112e86389819cd90b5b9f864ba59acd540e989f18a8bb27d962e7323ab71c5681cac57c1004e89ba44ac21ab07206b4af3a5d1e08daa6b5abf74c3135c57cd83
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
## [0.4.4] - 2016.10.4
|
2
|
+
|
3
|
+
### Added
|
4
|
+
- `on_enter` callback to Router
|
5
|
+
|
6
|
+
### Fixed
|
7
|
+
- sprockets deprecation warning
|
8
|
+
|
9
|
+
|
1
10
|
## [0.4.1] - 2016.07.15
|
2
11
|
|
3
12
|
### Added
|
@@ -65,7 +74,10 @@
|
|
65
74
|
- rename `update_dom` to `render!`
|
66
75
|
- use `opal-browser` instead of pure javascript
|
67
76
|
|
68
|
-
[Unreleased]: https://github.com/inesita-rb/inesita/compare/v0.4.
|
77
|
+
[Unreleased]: https://github.com/inesita-rb/inesita/compare/v0.4.4...HEAD
|
78
|
+
[0.4.4]: https://github.com/inesita-rb/inesita/compare/v0.4.1...v0.4.4
|
79
|
+
[0.4.1]: https://github.com/inesita-rb/inesita/compare/v0.4.0...v0.4.1
|
80
|
+
[0.4.0]: https://github.com/inesita-rb/inesita/compare/v0.3.5...v0.4.0
|
69
81
|
[0.4.0]: https://github.com/inesita-rb/inesita/compare/v0.3.5...v0.4.0
|
70
82
|
[0.3.5]: https://github.com/inesita-rb/inesita/compare/v0.3.2...v0.3.5
|
71
83
|
[0.3.2]: https://github.com/inesita-rb/inesita/compare/v0.3.1...v0.3.2
|
data/inesita.gemspec
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
<%= config[:build_dir] %>
|
data/lib/inesita/server.rb
CHANGED
@@ -7,7 +7,13 @@ module Inesita
|
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
|
-
|
10
|
+
class SlimTransformer
|
11
|
+
def self.call(input)
|
12
|
+
Slim::Template.new(input[:name]) { input[:data] }.render(nil)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class Server
|
11
17
|
attr_reader :assets_app
|
12
18
|
|
13
19
|
def initialize(opts = {})
|
@@ -81,8 +87,14 @@ module Inesita
|
|
81
87
|
end.sprockets
|
82
88
|
end
|
83
89
|
|
84
|
-
|
85
|
-
|
90
|
+
def configure_sprockets(sprockets)
|
91
|
+
if sprockets.respond_to?(:register_transformer)
|
92
|
+
sprockets.register_mime_type 'text/html', extensions: ['.slim', '.html.slim', '.slim.html']
|
93
|
+
sprockets.register_preprocessor 'text/html', SlimTransformer
|
94
|
+
elsif sprockets.respond_to?(:register_engine)
|
95
|
+
sprockets.register_engine '.slim', Slim::Template
|
96
|
+
end
|
97
|
+
|
86
98
|
sprockets.context_class.class_eval do
|
87
99
|
include SprocketsContext
|
88
100
|
end
|
data/opal/inesita/router.rb
CHANGED
@@ -33,6 +33,7 @@ module Inesita
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def find_component(route)
|
36
|
+
call_on_enter_callback(route)
|
36
37
|
@component_props = route[:component_props]
|
37
38
|
route[:component]
|
38
39
|
end
|
@@ -41,6 +42,13 @@ module Inesita
|
|
41
42
|
component find_component(@route), props: @component_props if @route
|
42
43
|
end
|
43
44
|
|
45
|
+
def call_on_enter_callback(route)
|
46
|
+
return unless route[:on_enter]
|
47
|
+
if route[:on_enter].respond_to?(:call)
|
48
|
+
route[:on_enter].call
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
44
52
|
def go_to(path)
|
45
53
|
Browser.push_state(path)
|
46
54
|
find_route
|
data/opal/inesita/routes.rb
CHANGED
@@ -16,7 +16,7 @@ module Inesita
|
|
16
16
|
if params.last[:redirect_to]
|
17
17
|
add_redirect(path, params.last[:redirect_to])
|
18
18
|
else
|
19
|
-
add_route(params.last[:as], path, params.last[:to], params.last[:props])
|
19
|
+
add_route(params.last[:as], path, params.last[:to], params.last[:props], params.last[:on_enter])
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
@@ -32,12 +32,13 @@ module Inesita
|
|
32
32
|
}.merge(build_params_and_regex(path))
|
33
33
|
end
|
34
34
|
|
35
|
-
def add_route(name, path, component, component_props)
|
35
|
+
def add_route(name, path, component, component_props, on_enter)
|
36
36
|
validate_component(component)
|
37
37
|
@routes << {
|
38
38
|
path: path,
|
39
39
|
component: component,
|
40
40
|
component_props: component_props,
|
41
|
+
on_enter: on_enter,
|
41
42
|
name: name || component.to_s.gsub(/(.)([A-Z])/, '\1_\2').downcase
|
42
43
|
}.merge(build_params_and_regex(path))
|
43
44
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inesita
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michał Kalbarczyk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opal
|