rlayout 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +5 -0
- data/README +1 -1
- data/Rakefile +1 -1
- data/init.rb +3 -1
- data/lib/rlayout/template.rb +1 -1
- data/lib/rlayout.rb +3 -44
- data/lib/rlayout_controller.rb +20 -0
- data/lib/rlayout_layout.rb +9 -0
- data/lib/rlayout_template.rb +35 -0
- metadata +5 -2
data/CHANGELOG
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
Changes in version 0.3.3 (2008-06-20)
|
2
|
+
-------------------------------------
|
3
|
+
fix a bugs occured when no options pass
|
4
|
+
seperate function call to let user choose what he/she need
|
5
|
+
|
1
6
|
Changes in version 0.3.1 (2008-06-16)
|
2
7
|
-------------------------------------
|
3
8
|
performance enchance, use thread local handle view binding to avoid request binding by 'send' method for each tag
|
data/README
CHANGED
data/Rakefile
CHANGED
data/init.rb
CHANGED
data/lib/rlayout/template.rb
CHANGED
@@ -106,7 +106,7 @@ module ActionView::Helpers::FormTagHelper
|
|
106
106
|
alias_method(new_method, m.to_sym) unless method_defined?(new_method)
|
107
107
|
class_eval %{
|
108
108
|
def #{m}(*args)
|
109
|
-
options = args[-1]
|
109
|
+
options = args[-1].is_a?(Hash) ? args[-1] : {}
|
110
110
|
name = #{['submit', 'image'].include?(m) ? '""' : 'args[0] ||= ""'}
|
111
111
|
context = {}
|
112
112
|
context[:name] = name
|
data/lib/rlayout.rb
CHANGED
@@ -1,47 +1,6 @@
|
|
1
1
|
=begin Rlayout
|
2
2
|
author: Leon Li(scorpio_leon@hotmail.com)
|
3
3
|
=end
|
4
|
-
require '
|
5
|
-
require '
|
6
|
-
require '
|
7
|
-
|
8
|
-
|
9
|
-
ActionController::Base.class_eval do
|
10
|
-
#for page layout
|
11
|
-
include Rlayout::Layout
|
12
|
-
include Rlayout::Template
|
13
|
-
#for field temlate
|
14
|
-
alias_method :process_cleanup_old4template, :process_cleanup
|
15
|
-
def process_cleanup
|
16
|
-
process_cleanup_old4template
|
17
|
-
Thread.current[:rlayout] = nil
|
18
|
-
end
|
19
|
-
def form_theme
|
20
|
-
self.class.get_form_theme
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
|
25
|
-
ActionView::Base.class_eval do
|
26
|
-
|
27
|
-
#for field temlate
|
28
|
-
alias_method :initialize_old4template, :initialize unless method_defined?(:initialize_old4template)
|
29
|
-
def initialize(*args)
|
30
|
-
initialize_old4template(*args)
|
31
|
-
Thread.current[:rlayout] ||= {}
|
32
|
-
Thread.current[:rlayout][:view_context] = self
|
33
|
-
Thread.current[:rlayout][:view_binding] = binding
|
34
|
-
end
|
35
|
-
|
36
|
-
#for page layout
|
37
|
-
def method_missing(method_id, *args)
|
38
|
-
ActionView::Base.class_eval %{
|
39
|
-
def #{method_id}(*args)
|
40
|
-
@controller.#{method_id}(*args)
|
41
|
-
end
|
42
|
-
}
|
43
|
-
send(method_id, *args)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
|
4
|
+
require 'rlayout_layout'
|
5
|
+
require 'rlayout_controller'
|
6
|
+
require 'rlayout_template'
|
@@ -0,0 +1,20 @@
|
|
1
|
+
=begin Rlayout
|
2
|
+
author: Leon Li(scorpio_leon@hotmail.com)
|
3
|
+
=end
|
4
|
+
require 'action_view'
|
5
|
+
|
6
|
+
|
7
|
+
ActionView::Base.class_eval do
|
8
|
+
|
9
|
+
#for using controller method in view
|
10
|
+
def method_missing(method_id, *args)
|
11
|
+
ActionView::Base.class_eval %{
|
12
|
+
def #{method_id}(*args)
|
13
|
+
@controller.#{method_id}(*args)
|
14
|
+
end
|
15
|
+
}
|
16
|
+
send(method_id, *args)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
|
@@ -0,0 +1,35 @@
|
|
1
|
+
=begin Rlayout
|
2
|
+
author: Leon Li(scorpio_leon@hotmail.com)
|
3
|
+
=end
|
4
|
+
require 'rlayout/template'
|
5
|
+
require 'action_view'
|
6
|
+
|
7
|
+
|
8
|
+
ActionController::Base.class_eval do
|
9
|
+
include Rlayout::Template
|
10
|
+
#for field temlate
|
11
|
+
alias_method :process_cleanup_old4template, :process_cleanup unless method_defined?(:process_cleanup_old4template)
|
12
|
+
def process_cleanup
|
13
|
+
process_cleanup_old4template
|
14
|
+
Thread.current[:rlayout] = nil
|
15
|
+
end
|
16
|
+
def form_theme
|
17
|
+
self.class.get_form_theme
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
ActionView::Base.class_eval do
|
23
|
+
|
24
|
+
#for field temlate
|
25
|
+
alias_method :initialize_old4template, :initialize unless method_defined?(:initialize_old4template)
|
26
|
+
def initialize(*args)
|
27
|
+
initialize_old4template(*args)
|
28
|
+
Thread.current[:rlayout] = {}
|
29
|
+
Thread.current[:rlayout][:view_context] = self
|
30
|
+
Thread.current[:rlayout][:view_binding] = binding
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rlayout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leon Li
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-06-
|
12
|
+
date: 2008-06-20 00:00:00 +08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -35,6 +35,9 @@ files:
|
|
35
35
|
- lib/rlayout/layout.rb
|
36
36
|
- lib/rlayout/template.rb
|
37
37
|
- lib/rlayout.rb
|
38
|
+
- lib/rlayout_controller.rb
|
39
|
+
- lib/rlayout_layout.rb
|
40
|
+
- lib/rlayout_template.rb
|
38
41
|
- example/templates
|
39
42
|
- example/templates/simple
|
40
43
|
- example/templates/simple/common.html.erb
|