neat-pages 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -86,7 +86,14 @@ Create the file *app/views/products/index.neatpage.erb* and place the following
86
86
  <% self.formats = ["html"] %>
87
87
  <%= render 'products', products: @products %>
88
88
  ```
89
+ ### Events
89
90
 
91
+ #### `neat_pages:update`
92
+
93
+ Triggered on `'body'` whenever a page has changed, from cache or from server.
94
+ The event data is an object literal which holds those fields:
95
+
96
+ `noPage` The current page number
90
97
 
91
98
  Locales
92
99
  -------
@@ -72,8 +72,13 @@ class NeatPage
72
72
 
73
73
  if @pageIsCached noPage
74
74
  @updatePage @cachePages[noPage], noPage
75
+ $('body').trigger('neat_pages:update', {noPage: noPage})
75
76
  else
76
- $.get(@buildURL(noPage), (data) => @updatePage data, noPage)
77
+ $.get(
78
+ @buildURL(noPage), (data) => @updatePage data, noPage
79
+ ).done(() ->
80
+ $('body').trigger('neat_pages:update', {noPage: noPage})
81
+ )
77
82
 
78
83
 
79
84
  moveIsDisabled: (direction) -> $('#neat-pages-navigation li.' + direction).hasClass('disabled')
@@ -4,7 +4,7 @@ module NeatPages::Helpers
4
4
  end
5
5
 
6
6
  def neat_pages_base_url
7
- request.protocol + request.host + request.path_info
7
+ "#{request.protocol}#{request.host}#{request.port == 80 ? '' : ':' + request.port.to_s}#{request.path_info}"
8
8
  end
9
9
 
10
10
  def neat_pages_base_params
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neat-pages
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-22 00:00:00.000000000 Z
12
+ date: 2013-07-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -19,8 +19,8 @@ dependencies:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
21
  version: 0.8.7
22
- prerelease: false
23
22
  type: :development
23
+ prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
@@ -35,8 +35,8 @@ dependencies:
35
35
  - - ! '>='
36
36
  - !ruby/object:Gem::Version
37
37
  version: '2.0'
38
- prerelease: false
39
38
  type: :development
39
+ prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
@@ -51,8 +51,8 @@ dependencies:
51
51
  - - ! '>='
52
52
  - !ruby/object:Gem::Version
53
53
  version: '3.0'
54
- prerelease: false
55
54
  type: :development
55
+ prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  none: false
58
58
  requirements:
@@ -68,24 +68,24 @@ extra_rdoc_files:
68
68
  - LICENSE
69
69
  - README.md
70
70
  files:
71
+ - app/assets/javascripts/neat_pages/base.coffee
72
+ - app/assets/javascripts/neat_pages/index.js
71
73
  - app/assets/stylesheets/neat_pages/base.css.scss
72
74
  - app/assets/stylesheets/neat_pages/index.css
73
- - app/assets/javascripts/neat_pages/index.js
74
- - app/assets/javascripts/neat_pages/base.coffee
75
- - config/locales/fr.yml
76
75
  - config/locales/en.yml
76
+ - config/locales/fr.yml
77
+ - lib/neat-pages.rb
78
+ - lib/neat_pages/base.rb
77
79
  - lib/neat_pages/engine.rb
78
80
  - lib/neat_pages/errors.rb
79
- - lib/neat_pages/implants.rb
81
+ - lib/neat_pages/helpers/builder.rb
82
+ - lib/neat_pages/helpers/navigation.rb
83
+ - lib/neat_pages/helpers/status.rb
80
84
  - lib/neat_pages/helpers.rb
81
85
  - lib/neat_pages/implants/action_controller_implant.rb
82
86
  - lib/neat_pages/implants/mongoid_implant.rb
83
87
  - lib/neat_pages/implants/railtie.rb
84
- - lib/neat_pages/base.rb
85
- - lib/neat_pages/helpers/builder.rb
86
- - lib/neat_pages/helpers/status.rb
87
- - lib/neat_pages/helpers/navigation.rb
88
- - lib/neat-pages.rb
88
+ - lib/neat_pages/implants.rb
89
89
  - spec/neat-pages_spec.rb
90
90
  - spec/neat_pages/base_spec.rb
91
91
  - spec/spec_helper.rb
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
115
  version: '0'
116
116
  requirements: []
117
117
  rubyforge_project: neat-pages
118
- rubygems_version: 1.8.25
118
+ rubygems_version: 1.8.24
119
119
  signing_key:
120
120
  specification_version: 3
121
121
  summary: A simple pagination API to paginate Mongoid Models.