ajaxify_rails 0.5 → 0.5.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.
data/README.md CHANGED
@@ -131,7 +131,7 @@ about your url structure to not get confused (it creates endless redirects other
131
131
  paths.
132
132
 
133
133
  Example: if your app's root url potentially redirects to `your_domain.com/en/` and `your_domain.com/de/`
134
- you need to hint Ajaxyfiy like this:
134
+ you need to hint Ajaxify like this:
135
135
 
136
136
  Ajaxify.init
137
137
  base_paths = ['de', 'en']
@@ -150,7 +150,7 @@ To use this feature you need to provide a method `ajaxify_extra_content` in your
150
150
  ... your extra html ...
151
151
  end
152
152
 
153
- For example you could provide url for a widget in the layout like this:
153
+ For example you could provide html for a widget in the layout like this:
154
154
 
155
155
  def ajaxify_extra_content
156
156
  "<div id='my_fancy_widget_html'> some html </div>"
@@ -41,7 +41,7 @@ module ActionControllerAdditions
41
41
  # Store current path for redirect url changes. Also used to remove the ajaxify parameter that gets added to some auto generated urls
42
42
  # like e.g. pagination links see (ajaxify.js -> on_ajaxify_success())
43
43
  #
44
- current_url_tag = view_context.content_tag(:span, request.fullpath.sub(/\?ajaxified=true&(.*)/, '?\1').sub(/(&|\?)ajaxified=true/, ''),
44
+ current_url_tag = view_context.content_tag(:span, remove_ajaxify_params(request.fullpath),
45
45
  id: 'ajaxify_location')
46
46
 
47
47
  response_body[0] += view_context.content_tag(:div, current_url_tag + extra_content,
@@ -52,7 +52,7 @@ module ActionControllerAdditions
52
52
  return
53
53
  end
54
54
  super
55
- # Correcting urls for non histori api browsers wont work for post requests so add a meta tag to the response body to communicate this to
55
+ # Correcting urls for non history api browsers wont work for post requests so add a meta tag to the response body to communicate this to
56
56
  # the ajaxify javascript
57
57
  if request.post? and not request.xhr?
58
58
  response.body = response_body[0].sub('<head>', "<head>\n <meta name='ajaxify:dont_correct_url' content='true'>")
@@ -83,6 +83,14 @@ module ActionControllerAdditions
83
83
  def ajaxify_redirect_to url
84
84
  render inline: "<%= javascript_tag(\"Ajaxify.load({url: '#{url}'});\") %>", layout: true
85
85
  end
86
+
87
+
88
+ def remove_ajaxify_params url
89
+ url.sub(/\?ajaxified=true&(.*)/, '?\1').
90
+ sub(/\?ajaxify_redirect=true&(.*)/, '?\1').
91
+ sub(/(&|\?)ajaxified=true/, '').
92
+ sub(/(&|\?)ajaxify_redirect=true/, '')
93
+ end
86
94
  end
87
95
 
88
96
  end
@@ -1,3 +1,3 @@
1
1
  module AjaxifyRails
2
- VERSION = "0.5"
2
+ VERSION = "0.5.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ajaxify_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.5'
4
+ version: 0.5.1
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-02-22 00:00:00.000000000 Z
12
+ date: 2013-02-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -260,7 +260,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
260
260
  version: '0'
261
261
  segments:
262
262
  - 0
263
- hash: 1291222513041922099
263
+ hash: -2839210237401114454
264
264
  required_rubygems_version: !ruby/object:Gem::Requirement
265
265
  none: false
266
266
  requirements:
@@ -269,7 +269,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
269
269
  version: '0'
270
270
  segments:
271
271
  - 0
272
- hash: 1291222513041922099
272
+ hash: -2839210237401114454
273
273
  requirements: []
274
274
  rubyforge_project:
275
275
  rubygems_version: 1.8.25