window_rails 0.2.12 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/{CHANGELOG.rdoc → CHANGELOG.md} +25 -18
- data/LICENSE +1 -2
- data/README.md +69 -0
- data/app/assets/javascripts/window_rails.js +1 -0
- data/app/assets/javascripts/window_rails/base.js +458 -0
- data/app/assets/stylesheets/window_rails.css +3 -0
- data/app/assets/stylesheets/window_rails/csspinner.css +472 -0
- data/lib/window_rails.rb +8 -9
- data/lib/window_rails/engine.rb +4 -8
- data/lib/window_rails/generators.rb +118 -0
- data/lib/window_rails/holder.rb +40 -0
- data/lib/window_rails/version.rb +2 -6
- data/lib/window_rails/windows.rb +28 -0
- metadata +35 -30
- data/README.rdoc +0 -111
- data/app/controllers/window_rails_controller.rb +0 -50
- data/config/routes.rb +0 -9
- data/lib/window_rails/window_rails_generators.rb +0 -451
- data/lib/window_rails/window_rails_view.rb +0 -46
- data/lib/window_rails/window_rails_windows.rb +0 -47
- data/rails/init.rb +0 -1
@@ -1,46 +0,0 @@
|
|
1
|
-
module WindowRailsView
|
2
|
-
|
3
|
-
# name:: Name of the link
|
4
|
-
# options:: Hash of options values.
|
5
|
-
# Creates a link to a window. Content is defined by a url in the options hash using :url or :iframe.
|
6
|
-
# If :url is used, the content is loaded into the window within the page. If :iframe is used
|
7
|
-
# the content is loaded into the window within an IFrame on the page. Generally, if you are calling
|
8
|
-
# a method that simply renders out a partial, you want to use :url. If you are calling something
|
9
|
-
# that returns an entire page, :iframe will likely be the ticket.
|
10
|
-
def link_to_window(name, options={}, html_opts={})
|
11
|
-
frame_url = options.has_key?(:iframe) ? url_for(options.delete(:iframe)) : nil
|
12
|
-
window_url = options.has_key?(:url) ? url_for(options.delete(:url)) : nil
|
13
|
-
link_to_remote(
|
14
|
-
name, {:url =>
|
15
|
-
open_window_path(
|
16
|
-
:window_url => window_url,
|
17
|
-
:iframe_url => frame_url,
|
18
|
-
:window_options => options
|
19
|
-
)},
|
20
|
-
html_opts
|
21
|
-
)
|
22
|
-
end
|
23
|
-
|
24
|
-
# options:: Options hash supplied to windowing system
|
25
|
-
# Extra options include :method and :delay. :delay is the number
|
26
|
-
# of seconds to wait after page load to open window
|
27
|
-
def open_window_deprecated(options={})
|
28
|
-
frame_url = options.has_key?(:iframe) ? url_for(options.delete(:iframe)) : nil
|
29
|
-
window_url = options.has_key?(:url) ? url_for(options.delete(:url)) : nil
|
30
|
-
method = options.delete(:method) || 'get'
|
31
|
-
delay = options.delete(:delay) || 0.5
|
32
|
-
delay = delay * 1000
|
33
|
-
url = open_window_path(
|
34
|
-
:window_url => window_url,
|
35
|
-
:iframe_url => frame_url,
|
36
|
-
:window_options => options
|
37
|
-
).html_safe
|
38
|
-
javascript_tag{
|
39
|
-
"setTimeout(function(){
|
40
|
-
jQuery.#{method}('#{url}');
|
41
|
-
}, #{delay.to_i});".html_safe
|
42
|
-
}
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
46
|
-
ActionView::Base.send :include, WindowRailsView
|
@@ -1,47 +0,0 @@
|
|
1
|
-
require 'window_rails/window_rails_generators'
|
2
|
-
|
3
|
-
module WindowRails
|
4
|
-
class Holder
|
5
|
-
include WindowRailsGenerators
|
6
|
-
|
7
|
-
attr_accessor :context
|
8
|
-
|
9
|
-
def initialize(args={})
|
10
|
-
@context = args[:context]
|
11
|
-
@buffer = ''
|
12
|
-
end
|
13
|
-
|
14
|
-
def << (string)
|
15
|
-
@buffer << string.to_s
|
16
|
-
end
|
17
|
-
|
18
|
-
def window_flush
|
19
|
-
buf = @buffer.dup
|
20
|
-
@buffer = ''
|
21
|
-
buf
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
module WindowRails
|
27
|
-
module Windows
|
28
|
-
def self.included(base)
|
29
|
-
WindowRailsGenerators.instance_methods(false).each do |method|
|
30
|
-
base.class_eval do
|
31
|
-
def _window_rails_holder
|
32
|
-
@_window_rails_holder ||= WindowRails::Holder.new
|
33
|
-
end
|
34
|
-
|
35
|
-
define_method method do |*args|
|
36
|
-
_window_rails_holder.context = self
|
37
|
-
_window_rails_holder.send(method, *args)
|
38
|
-
_window_rails_holder.window_flush.html_safe
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
ActionView::Base.send(:include, WindowRails::Windows)
|
data/rails/init.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require 'window_rails'
|