inesita 0.4.1 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7a44e11d0c190bb12d48b6b885d12a914428f945
4
- data.tar.gz: 96b1d4dccc510facd9ae462b89b81630f2f14bf2
3
+ metadata.gz: fdaaffe2e4aafb5d72428c08684f3c3c2330611d
4
+ data.tar.gz: 6f1453ef8e9cdd016baf70935a2a719144fe1667
5
5
  SHA512:
6
- metadata.gz: ce02c2a6d3f600b8570d40fa1c18fb8bf3ddfcf2543afdde9a6c2d6a073035593cfd2dc0745079916e04a7751bc1245bcb680bc9e1e3618123c7038605f2ebc9
7
- data.tar.gz: 7a67e137796f047fc8cea9de2f96c8ecd9b1b6da7826b2c9a79f4cbcd2392d8f77ddeb08dbaf5648f875156c23fe6f89289c21000405bbdf996096149646ac1c
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.0...HEAD
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,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'inesita'
3
- s.version = '0.4.1'
3
+ s.version = '0.4.4'
4
4
  s.authors = ['Michał Kalbarczyk']
5
5
  s.email = 'fazibear@gmail.com'
6
6
  s.homepage = 'http://github.com/inesita-rb/inesita'
@@ -1 +1 @@
1
- /<%= config[:build_dir] %>
1
+ <%= config[:build_dir] %>
@@ -7,7 +7,13 @@ module Inesita
7
7
  end
8
8
  end
9
9
 
10
- class Server
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
- def configure_sprockets(sprockets)
85
- sprockets.register_engine '.slim', Slim::Template
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
@@ -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
@@ -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.1
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-07-15 00:00:00.000000000 Z
11
+ date: 2016-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opal