revelry_core 0.1.8.5 → 0.1.8.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a324ec06106a98b91e552c5ab73cea21db1dfab7
4
- data.tar.gz: 4d946a5cb3ad544904e748648b3aa5092c1f97fd
3
+ metadata.gz: 8d1c5bae2ead04314059f61e155f62d899b64cde
4
+ data.tar.gz: 05fb5a222e9fd616931a23bb32de9bcafb46e24e
5
5
  SHA512:
6
- metadata.gz: 68043e9e242c83d5f62f4229d06d236d26a7e3f990d1cfbfdda6cb3ccc3801ab71ccb72fccbd314fee1e7ddb4de3fe1168e8e792cf343be2ed92ec41ed75b189
7
- data.tar.gz: a8c3a48ab36030a00b24358c9d8d27fc88e81efa1b60ced672fac0406865a5ac216a03f9852e967d8204fb438b6c95124413f3c44a6c71f7af23c18af1b9fc9e
6
+ metadata.gz: c6028506e32c7fb7dab9fa66c852a462834e22faa70c59f5e3f13300431b0815133aac8232c6b7534f1001fbdae671575b1e245bdd7ed280134af3327e80982e
7
+ data.tar.gz: ed06af74b8acf0667d6910f195bfdf9b082ae670c8cbb235207ea71d619eb4ce7169fe7c823d30b5efdee48d7d716952c6f624ef2b7a5e1a28cf26e8f4c764dc
@@ -2,8 +2,6 @@
2
2
  <%# Ensure routes are loaded during precompile. %>
3
3
  <% Rails.application.reload_routes! %>
4
4
 
5
- CSSTransitionGroup = React.addons.CSSTransitionGroup
6
-
7
5
  Rev.registerComponent 'Router',
8
6
  ### CLASS METHODS ###
9
7
 
@@ -45,31 +43,12 @@ Rev.registerComponent 'Router',
45
43
 
46
44
  mixins: [Backbone.Events]
47
45
 
48
- getDefaultProps: ->
49
- loadingScreenDelay: 800
50
-
51
46
  getInitialState: ->
52
47
  bbRouter: new Backbone.Router(Rev.Components.Router.routerConfig())
53
48
  # Seed the path and options (which we pass down to child components) from
54
49
  # the initial props we received. Updates will come from the AJAX prop fetch.
55
50
  path: @props.path
56
51
  options: @props.options
57
- isLoading: false
58
-
59
- # Loading state is just used to show the loading screen or not.
60
- # Best practice is to introduce a delay before showing a loading screen.
61
- # Below a certain time threshold, users actually prefer to not see that crap.
62
- # Configure the delay with @props.loadingScreenDelay
63
- setLoading: (isLoading) ->
64
- if isLoading
65
- unless @_loadingTimeoutHandle?
66
- fn = () => @setState isLoading: true
67
- @_loadingTimeoutHandle = setTimeout fn, @props.loadingScreenDelay
68
- else
69
- if @_loadingTimeoutHandle?
70
- clearTimeout @_loadingTimeoutHandle
71
- delete @_loadingTimeoutHandle
72
- @setState isLoading: false
73
52
 
74
53
  componentDidMount: ->
75
54
  # Start history to pay attention to pushState and hashChange events
@@ -89,7 +68,7 @@ Rev.registerComponent 'Router',
89
68
  "/#{baseUrl}?#{if query? and query.length then '&' else ''}#{encodeURIComponent '__props'}"
90
69
 
91
70
  # Fall back to full page navigation request
92
- doFailureFallback: ->
71
+ onPropsFetchFailure: ->
93
72
  window.location = @locationURL()
94
73
 
95
74
  # Make a handler for successful props fetching of a given templatePath
@@ -98,57 +77,27 @@ Rev.registerComponent 'Router',
98
77
  return (data, textStatus, xhr)=>
99
78
  try
100
79
  @setState path: templatePath, options: JSON.parse(data)
101
- @setLoading false
102
80
  window.scrollTo 0, 0
103
81
  catch err
104
- @doFailureFallback()
82
+ @onPropsFetchFailure()
105
83
 
106
84
  routeChangeHandler: (templatePath, params)->
107
- @setLoading true
108
85
  # Request the same props from the server that we would get for a server-side
109
86
  # render. If we get them back successfully, swap the page. If we fail, fall
110
87
  # back to server side render.
111
- @_xhr.abort() if @_xhr?
112
- @_xhr = Backbone.ajax
88
+ Backbone.ajax
113
89
  url: @locationURL()
114
90
  beforeSend: (xhr) ->
115
91
  xhr.setRequestHeader "Content-Type", "text/reactprops"
116
92
  xhr.setRequestHeader "Accept", "text/reactprops"
117
93
  success: @makePropsFetchSuccessHandler(templatePath)
118
- error: @onRouteChangeError
94
+ error: @onPropsFetchFailure
119
95
  true
120
96
 
121
- onRouteChangeError: (xhr) ->
122
- # Aborts aren't really errors.
123
- @doFailureFallback unless xhr.statusText == "abort"
124
-
125
- getKey: (isInCSSTransitionGroup) ->
126
- # We never need to compute any keys at all unless we're not using CSSTransitionGroup.
127
- if isInCSSTransitionGroup
128
- # We can use a generic key for the loading screen.
129
- if @state.isLoading
130
- 'GENERIC_ROUTER_KEY'
131
- # Actual screens need a unique computed key to tell the CSSTransitionGroup something changed.
132
- else
133
- JSON.stringify path: @state.path, options: @state.options
134
-
135
- # Show a loading screen if we're loading. Show the content if we're done.
136
- renderInner: (isInCSSTransitionGroup = false) ->
137
- <div className="RevRouter" key={@getKey isInCSSTransitionGroup}>
97
+ render: ->
98
+ <div className="RevRouter">
138
99
  {
139
- if @state.isLoading
140
- @props.loadingScreen or <h1 className="RevRouter-loadingScreen">Loading...</h1>
141
- else
142
- React.Children.map @props.children, (child)=>
143
- React.addons.cloneWithProps child, { path: @state.path, options: @state.options }
100
+ React.Children.map @props.children, (child)=>
101
+ React.addons.cloneWithProps child, { path: @state.path, options: @state.options }
144
102
  }
145
103
  </div>
146
-
147
- render: ->
148
- # If you give it a transitionName, it will wrap everything in a CSSTransitionGroup
149
- # All props are passed down, so Router can take any props that a CSSTransitionGroup can.
150
- if @props.transitionName
151
- <CSSTransitionGroup {...@props}>{@renderInner(true)}</CSSTransitionGroup>
152
- # No transitionName? Don't do anything fancy.
153
- else
154
- @renderInner()
@@ -1,5 +1,5 @@
1
1
  module Revelry
2
2
  module Core
3
- VERSION = "0.1.8.5"
3
+ VERSION = "0.1.8.6"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: revelry_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8.5
4
+ version: 0.1.8.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Revelry Labs, LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-29 00:00:00.000000000 Z
11
+ date: 2015-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -1791,7 +1791,6 @@ files:
1791
1791
  - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/zYuAn7ok3miLpnLjpj72Tuvb69JIuEwWpMMVROg_vEk.cache
1792
1792
  - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/zyXy4f2iOKrEzsb1Irn7ye_Kfhqi0E081jwJ3q7een8.cache
1793
1793
  - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/zZLUfxFok429p9xqH1sKAQwSqVLN329IAWCfWYsAZhY.cache
1794
- - spec/dummy/tmp/pids/server.pid
1795
1794
  - spec/dummy/tmp/react-rails/JSXTransformer.js
1796
1795
  - spec/dummy/tmp/react-rails/react.js
1797
1796
  - spec/javascripts/components/main_spec.js
@@ -3191,7 +3190,6 @@ test_files:
3191
3190
  - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/zYuAn7ok3miLpnLjpj72Tuvb69JIuEwWpMMVROg_vEk.cache
3192
3191
  - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/zyXy4f2iOKrEzsb1Irn7ye_Kfhqi0E081jwJ3q7een8.cache
3193
3192
  - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/zZLUfxFok429p9xqH1sKAQwSqVLN329IAWCfWYsAZhY.cache
3194
- - spec/dummy/tmp/pids/server.pid
3195
3193
  - spec/dummy/tmp/react-rails/JSXTransformer.js
3196
3194
  - spec/dummy/tmp/react-rails/react.js
3197
3195
  - spec/javascripts/components/main_spec.js
@@ -1 +0,0 @@
1
- 49396