window_rails 0.2.0 → 0.2.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/CHANGELOG.rdoc +3 -0
- data/README.rdoc +37 -3
- data/lib/window_rails/version.rb +15 -1
- data/lib/window_rails/window_rails_generators.rb +0 -1
- metadata +4 -4
data/CHANGELOG.rdoc
CHANGED
data/README.rdoc
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
== WindowRails (for jQuery)
|
2
2
|
|
3
3
|
WindowRails is a plugin for Rails that provides easy to use AJAXy windows. It is based
|
4
|
-
completely on {
|
5
|
-
|
4
|
+
completely on {jQueryUI}[http://jquery-ui.com] with helpers for Rails to make it easy to
|
5
|
+
use from a Rails app.
|
6
|
+
|
7
|
+
WindowRails is now happily compatible with Rails 2 and Rails 3.
|
6
8
|
|
7
9
|
== Requirements
|
8
10
|
|
@@ -15,13 +17,45 @@ with helpers for Rails to make it easy to use from a Rails app.
|
|
15
17
|
|
16
18
|
=== Basic examples to get you started
|
17
19
|
|
20
|
+
=== Remote calls to create a window
|
21
|
+
|
22
|
+
# view
|
23
|
+
<%= link_to_remote('Link', :url => my_route_path) %>
|
24
|
+
|
25
|
+
|
26
|
+
# controller
|
27
|
+
|
28
|
+
def action
|
29
|
+
respond_to do |format|
|
30
|
+
format.html
|
31
|
+
format.js do
|
32
|
+
render :update do |page|
|
33
|
+
page.open_window(
|
34
|
+
{:partial => 'action_partial'},
|
35
|
+
:width => 400,
|
36
|
+
:height => 500,
|
37
|
+
:title => 'My Window',
|
38
|
+
:window => 'unique_window_name'
|
39
|
+
)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
18
45
|
==== Linking to a window
|
19
46
|
===== Load an entire HTML page into an IFrame
|
20
47
|
<%= link_to_window('Link', :iframe => {:controller => :my_controller, :action => :my_action}, :window => 'some_name') %>
|
21
48
|
|
49
|
+
With this approach the contents of the HTML respond to block will be loaded into the window
|
50
|
+
|
22
51
|
===== Load a partial page directly into the DOM within the window
|
23
52
|
<%= link_to_window('Link', :url => {:controller => :my_controller, :action => :my_action}, :width => 400, :height => 300, :window => 'some_name') %>
|
24
|
-
|
53
|
+
|
54
|
+
With this approach the content returned from the JS respond to block will be loaded into the window. No need for
|
55
|
+
requesting the window to be created from the controller.
|
56
|
+
|
57
|
+
== Window Interactions
|
58
|
+
|
25
59
|
==== Opening a window via AJAX
|
26
60
|
def open_my_window
|
27
61
|
respond_to do |format|
|
data/lib/window_rails/version.rb
CHANGED
@@ -1,3 +1,17 @@
|
|
1
1
|
module WindowRails
|
2
|
-
|
2
|
+
class Version
|
3
|
+
|
4
|
+
attr_reader :major, :minor, :tiny
|
5
|
+
|
6
|
+
def initialize(version)
|
7
|
+
version = version.split('.')
|
8
|
+
@major, @minor, @tiny = [version[0].to_i, version[1].to_i, version[2].to_i]
|
9
|
+
end
|
10
|
+
|
11
|
+
def to_s
|
12
|
+
"#{@major}.#{@minor}.#{@tiny}"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
VERSION = Version.new('0.2.1')
|
3
17
|
end
|
@@ -382,7 +382,6 @@ module WindowRailsGenerators
|
|
382
382
|
# NOTE: Currently does nothing
|
383
383
|
# NOTE: Deprecated (remaining temporarily for compatibility reasons)
|
384
384
|
def observe_dynamically_loaded_field(field_id, options={}) # :nodoc
|
385
|
-
return
|
386
385
|
f = options.delete(:function)
|
387
386
|
unless(f)
|
388
387
|
f = "function(event){ new Ajax.Request('#{escape_javascript(@context.url_for(options[:url]).to_s)}', {asynchronous:true, evalScripts:true,parameters:'#{escape_javascript(options[:with].to_s)}='+$('#{escape_javascript(options[:with].to_s)}').getValue()})}"
|
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:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 1
|
10
|
+
version: 0.2.1
|
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-07-
|
18
|
+
date: 2011-07-19 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|