inesita 0.0.7 → 0.0.8

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: 586b44f53758981d474a33605fdca12c01fbb1ab
4
- data.tar.gz: a7e71cd60cdbb4741b08ce77aac599dc14f996f9
3
+ metadata.gz: a6cbf39b243230b8e9a44c7ee475a19fa8589c5f
4
+ data.tar.gz: f22ba1827671d5e05629c97fd400ba745bf162fc
5
5
  SHA512:
6
- metadata.gz: c514f42391b811439ef6144c1f9a46096d57208a4802f0e98d30e0d58d2763da443c1f28d218a19ec602737dd1676ed0791449ee9045d7ad5ff498dce2214ef4
7
- data.tar.gz: e41e94a6d8c82f9601e6cead98b5f406396e8af47f6238027cd742eb9071ff146abbdb2aa54af1d86e99364d20aa433adbc0416d679aaab91ff5349fac78fab2
6
+ metadata.gz: 02b386388c4404405b4e52d7fa4eeca179cd1b8323ead435b3a1120e824ca228b86a6203cd56fa91280315eb0e191981b9fba0f556ed6b7babc91c92193c3697
7
+ data.tar.gz: bebd8120f2b2844af9bc082aa72709615ab6a68cc7ecea9b5aeecc51b8147d57fc23c8966cdb08216a97b729b87feaa25d932040d1a52380bc57ef358f4edd20
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'inesita'
3
- s.version = '0.0.7'
3
+ s.version = '0.0.8'
4
4
  s.authors = [ 'Michał Kalbarczyk' ]
5
5
  s.email = 'fazibear@gmail.com'
6
6
  s.homepage = 'http://github.com/fazibear/inesita'
@@ -3,11 +3,11 @@ html
3
3
  head
4
4
  title Inesita
5
5
  - if $DEVELOPMENT_MODE
6
- link href=asset_path('application.css') rel='stylesheet' type='text/css'
6
+ link href=asset_path('stylesheet.css') rel='stylesheet' type='text/css'
7
7
  - $SCRIPT_FILES.each do |file|
8
8
  script src=asset_path(file)
9
9
  - else
10
- link href='application.css' rel='stylesheet' type='text/css'
10
+ link href='stylesheet.css' rel='stylesheet' type='text/css'
11
11
  script src='application.js'
12
12
  javascript:
13
13
  #{{$LOAD_ASSETS_CODE}}
@@ -1,6 +1,7 @@
1
1
  module Inesita
2
2
  class Router
3
3
  include Inesita::Component
4
+ class << self; attr_accessor :handle_browser_history; end
4
5
  attr_reader :routes
5
6
 
6
7
  def initialize(routes)
@@ -12,16 +13,18 @@ module Inesita
12
13
  @routes[route] = component.new
13
14
  @routes[route].parent(self)
14
15
  end
16
+
17
+ handle_browser_history
15
18
  end
16
19
 
17
20
  def render
18
21
  component routes[url]
19
22
  end
20
23
 
21
- def mount
22
- `window.onpopstate = function(){#{handle_link}}`
23
- `window.addEventListener("hashchange", function(){#{handle_link}})`
24
- super
24
+ def handle_browser_history
25
+ `window.onpopstate = function(){#{update}}`
26
+ `window.addEventListener("hashchange", function(){#{update}})`
27
+ self.class.handle_browser_history = true
25
28
  end
26
29
 
27
30
  def self.handle_link(path, component)
@@ -5,8 +5,7 @@ module VirtualDOM
5
5
  end
6
6
 
7
7
  def a(params, &block)
8
- #TODO: Only if router is configured
9
- params = { onclick: -> { Inesita::Router.handle_link(params[:href], @parent) } }.merge(params) if params[:href]
8
+ params = { onclick: -> { Inesita::Router.handle_link(params[:href], @parent) } }.merge(params) if params[:href] && Inesita::Router.handle_browser_history
10
9
  @nodes << VirtualNode.new(
11
10
  'a',
12
11
  process_params(params),
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inesita
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michał Kalbarczyk
@@ -128,7 +128,6 @@ files:
128
128
  - lib/inesita/cli/server.rb
129
129
  - lib/inesita/cli/template/.gitignore
130
130
  - lib/inesita/cli/template/Gemfile
131
- - lib/inesita/cli/template/app/application.css.sass
132
131
  - lib/inesita/cli/template/app/application.js.rb
133
132
  - lib/inesita/cli/template/app/components/goodbye.rb
134
133
  - lib/inesita/cli/template/app/components/home.rb
@@ -136,6 +135,7 @@ files:
136
135
  - lib/inesita/cli/template/app/components/navbar.rb
137
136
  - lib/inesita/cli/template/app/components/welcome.rb
138
137
  - lib/inesita/cli/template/app/index.html.slim
138
+ - lib/inesita/cli/template/app/stylesheet.css.sass
139
139
  - lib/inesita/cli/template/config.ru
140
140
  - lib/inesita/server.rb
141
141
  - opal/inesita.rb