window_rails 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,6 @@
1
+ == v0.1.4
2
+ * Fix to #update_window method to accept content not key
3
+
1
4
  == v0.1.3
2
5
  * Rails init inclusion within gem package
3
6
 
@@ -1,3 +1,3 @@
1
1
  module WindowRails
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.4'
3
3
  end
@@ -37,7 +37,7 @@ module WindowRailsGenerators
37
37
  self << "Dialog.setInfoMessage('#{escape_javascript(msg)}');"
38
38
  end
39
39
 
40
- # key:: Key of updated contents
40
+ # content:: content
41
41
  # options:: Hash of options
42
42
  # * window -> Name of the window to update (defaults to last window)
43
43
  # * error -> Show error if window is not found (defaults false)
@@ -45,9 +45,10 @@ module WindowRailsGenerators
45
45
  # be placed into the window. If it is a Hash, it will be fed to render and the
46
46
  # result will be placed in the window (basically an easy way to integrate partials:
47
47
  # page.update_window(:partial => 'my_parital'))
48
- def update_window(key, options={})
48
+ def update_window(content, options={})
49
49
  win = options.delete(:window)
50
50
  error = options.delete(:error)
51
+ key = store_content(content)
51
52
  self << check_for_window(win, error){ update_window_contents(key, win) }
52
53
  end
53
54
 
@@ -196,10 +197,10 @@ module WindowRailsGenerators
196
197
  end
197
198
 
198
199
  def store_content(content)
199
- self << "if(typeof(window_rails_contents) == 'undefined'){ var window_rails_contents = new Hash(); }"
200
200
  key = rand.to_s
201
201
  key.slice!(0,2)
202
202
  c = content.is_a?(Hash) ? render(content) : content.to_s
203
+ self << "if(typeof(window_rails_contents) == 'undefined'){ var window_rails_contents = new Hash(); }"
203
204
  self << "window_rails_contents.set('#{key}', '#{escape_javascript(c)}')"
204
205
  key
205
206
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: window_rails
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 3
10
- version: 0.1.3
9
+ - 4
10
+ version: 0.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Chris Roberts