inesita 0.3.0 → 0.3.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/CHANGELOG.md +6 -1
- data/inesita.gemspec +1 -1
- data/lib/inesita/cli/template/Gemfile.tt +5 -0
- data/lib/inesita/cli/template/README.md.tt +7 -0
- data/lib/inesita/cli/template/app/application.js.rb.tt +6 -1
- data/lib/inesita/cli/template/app/components/home.rb.tt +1 -1
- data/opal/inesita.rb +1 -0
- data/opal/inesita/component.rb +1 -0
- data/opal/inesita/component_helpers.rb +11 -0
- data/opal/inesita/router.rb +23 -11
- data/opal/inesita/routes.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c0a64bb895728681f357fb737fedc3131c966ad
|
4
|
+
data.tar.gz: 2c8b318940f34a93001956c590a90f05da36b882
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c655ef4d2cab0cc422c0dfc5d9e6a77d238c5634c2e047c064860614d8d2381c9c0bf8f7e88b9634b5c3f692c5761827f95c820c60284af53708d159473a40ac
|
7
|
+
data.tar.gz: d1c65668cfe5e1112668a70b771f5279cd09f2decc67197fc45ba91313b1b5cd52d988dfa3b7fe095a2c476ce9ef49cd7f7df5a9fba5d6dd3c3aeb9a4c7e175d
|
data/CHANGELOG.md
CHANGED
data/inesita.gemspec
CHANGED
@@ -1,13 +1,18 @@
|
|
1
|
+
# require Inesita
|
1
2
|
require 'inesita'
|
2
3
|
|
4
|
+
# require main parts of application
|
3
5
|
require 'router'
|
4
6
|
require 'store'
|
5
7
|
require 'layout'
|
6
8
|
|
9
|
+
# require all components
|
7
10
|
require_tree './components'
|
8
11
|
|
12
|
+
# when document is ready render application to <body>
|
9
13
|
$document.ready do
|
10
|
-
|
14
|
+
# setup Inesita application
|
15
|
+
Inesita::Application.new(
|
11
16
|
router: Router,
|
12
17
|
store: Store,
|
13
18
|
layout: Layout
|
data/opal/inesita.rb
CHANGED
@@ -11,6 +11,7 @@ require 'virtual_dom'
|
|
11
11
|
require 'inesita/error'
|
12
12
|
require 'inesita/component_virtual_dom_extension'
|
13
13
|
require 'inesita/component_properties'
|
14
|
+
require 'inesita/component_helpers'
|
14
15
|
require 'inesita/component'
|
15
16
|
require 'inesita/routes'
|
16
17
|
require 'inesita/router'
|
data/opal/inesita/component.rb
CHANGED
data/opal/inesita/router.rb
CHANGED
@@ -10,10 +10,10 @@ module Inesita
|
|
10
10
|
fail Error, 'Add #routes method to router!' unless respond_to?(:routes)
|
11
11
|
routes
|
12
12
|
fail Error, 'Add #route to your #routes method!' if @routes.routes.empty?
|
13
|
-
|
13
|
+
add_listeners
|
14
14
|
end
|
15
15
|
|
16
|
-
def
|
16
|
+
def add_listeners
|
17
17
|
$window.on(:popstate) { render! }
|
18
18
|
$window.on(:hashchange) { render! }
|
19
19
|
end
|
@@ -53,14 +53,18 @@ module Inesita
|
|
53
53
|
params
|
54
54
|
end
|
55
55
|
|
56
|
-
def url_for(name)
|
57
|
-
route =
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
56
|
+
def url_for(name, params = nil)
|
57
|
+
route = @routes.routes.find do |r|
|
58
|
+
case name
|
59
|
+
when String
|
60
|
+
r[:name] == name
|
61
|
+
when Object
|
62
|
+
r[:component] == name
|
63
|
+
else
|
64
|
+
false
|
65
|
+
end
|
66
|
+
end
|
67
|
+
route ? url_with_params(route, params) : fail(Error, "Route '#{name}' not found.")
|
64
68
|
end
|
65
69
|
|
66
70
|
def path
|
@@ -68,7 +72,15 @@ module Inesita
|
|
68
72
|
end
|
69
73
|
|
70
74
|
def current_url?(name)
|
71
|
-
path == url_for(name)
|
75
|
+
path == url_for(name, params)
|
76
|
+
end
|
77
|
+
|
78
|
+
def url_with_params(route, params)
|
79
|
+
path = route[:path]
|
80
|
+
params.each do |key, value|
|
81
|
+
path = path.gsub(":#{key}", "#{value}")
|
82
|
+
end if params
|
83
|
+
path
|
72
84
|
end
|
73
85
|
end
|
74
86
|
end
|
data/opal/inesita/routes.rb
CHANGED
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.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michał Kalbarczyk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opal
|
@@ -179,6 +179,7 @@ files:
|
|
179
179
|
- opal/inesita.rb
|
180
180
|
- opal/inesita/application.rb
|
181
181
|
- opal/inesita/component.rb
|
182
|
+
- opal/inesita/component_helpers.rb
|
182
183
|
- opal/inesita/component_properties.rb
|
183
184
|
- opal/inesita/component_virtual_dom_extension.rb
|
184
185
|
- opal/inesita/error.rb
|
@@ -214,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
214
215
|
version: '0'
|
215
216
|
requirements: []
|
216
217
|
rubyforge_project:
|
217
|
-
rubygems_version: 2.
|
218
|
+
rubygems_version: 2.5.1
|
218
219
|
signing_key:
|
219
220
|
specification_version: 4
|
220
221
|
summary: Frontend web framework for Opal
|