window_rails 0.2.4 → 0.2.5

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.2.5
2
+ * Better height/width determination for resize methods
3
+
1
4
  == v0.2.4
2
5
  * Add #resize_to_fit, #auto_resize and #center_window methods
3
6
 
@@ -13,5 +13,5 @@ module WindowRails
13
13
  end
14
14
  end
15
15
 
16
- VERSION = Version.new('0.2.4')
16
+ VERSION = Version.new('0.2.5')
17
17
  end
@@ -162,7 +162,7 @@ module WindowRailsGenerators
162
162
 
163
163
  # win:: Name of window
164
164
  # padding:: Extra padding to add to calculated height and width
165
- def resize_to_fit(win, padding=75)
165
+ def resize_to_fit(win, padding=20)
166
166
  if(padding.is_a?(Hash))
167
167
  w_pad = padding[:width_pad]
168
168
  h_pad = padding[:height_pad]
@@ -187,8 +187,9 @@ module WindowRailsGenerators
187
187
  win = win.start_with?('#') ? win : "##{win}"
188
188
  args.each do |item|
189
189
  self << "
190
- if(jQuery('#{win}').#{item}() < jQuery('#{win}_wr_content').#{item}() || jQuery('#{win}').#{item}() > jQuery('#{win}_wr_content').#{item}() + #{extra_padding.to_i}){"
191
- window(win) << ".dialog('option', '#{item}', jQuery('#{win}_wr_content').#{item}() + #{extra_padding.to_i});"
190
+ var _wr_max = Math.max.apply(Math, jQuery('#{win}_wr_content *').map(function(){ return jQuery(this).#{item}(); }).get());
191
+ if(jQuery('#{win}').#{item}() < _wr_max || jQuery('#{win}').#{item}() > _wr_max){"
192
+ window(win) << ".dialog('option', '#{item}', _wr_max + #{extra_padding.to_i});"
192
193
  self << "
193
194
  }"
194
195
  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: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 4
10
- version: 0.2.4
9
+ - 5
10
+ version: 0.2.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Chris Roberts
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-10-24 00:00:00 -07:00
18
+ date: 2011-10-26 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency