scaffolding_extensions 1.3.8 → 1.3.9
Sign up to get free protection for your applications and to get access to all the features.
@@ -75,10 +75,8 @@ module ScaffoldingExtensions
|
|
75
75
|
|
76
76
|
# Class methods for Ramaze::Controller related necessary for Scaffolding Extensions
|
77
77
|
module MetaRamazeController
|
78
|
-
DENY_LAYOUT_RE = %r{\A(scaffold_auto_complete_for|associations|add|remove)_}
|
79
78
|
|
80
79
|
private
|
81
|
-
# Denies the layout to names that match DENY_LAYOUT_RE (the Ajax methods).
|
82
80
|
# Sets request.params['id'] if it was given as part of the request path.
|
83
81
|
# Checks nonidempotent requests require POST.
|
84
82
|
def scaffold_define_method(name, &block)
|
@@ -98,7 +96,7 @@ module ScaffoldingExtensions
|
|
98
96
|
map_views '/'
|
99
97
|
map_layouts '/'
|
100
98
|
engine :Erubis
|
101
|
-
layout(:layout){|name, wish|
|
99
|
+
layout(:layout){|name, wish| !request.xhr? }
|
102
100
|
|
103
101
|
o = Ramaze::App[:scaffolding_extensions].options
|
104
102
|
o.roots = [scaffold_template_dir]
|
@@ -94,7 +94,7 @@ module ScaffoldingExtensions::MetaModel
|
|
94
94
|
:search_limit=>:scaffold_search_results_limit}.each do |default, iv|
|
95
95
|
ivs = "@#{iv}"
|
96
96
|
define_method(iv) do
|
97
|
-
if
|
97
|
+
if instance_variable_defined?(ivs)
|
98
98
|
instance_variable_get(ivs)
|
99
99
|
else
|
100
100
|
instance_variable_set(ivs, SCAFFOLD_OPTIONS[default])
|
@@ -549,10 +549,19 @@ module ScaffoldingExtensions::MetaModel
|
|
549
549
|
end
|
550
550
|
|
551
551
|
# Filters the provided attributes to just the ones given by scaffold_attributes for
|
552
|
-
# the given action
|
552
|
+
# the given action, and converts foreign key fields to integers so that autocompleting
|
553
|
+
# works correctly.
|
553
554
|
def scaffold_filter_attributes(action, attributes)
|
554
|
-
allowed_attributes =
|
555
|
-
|
555
|
+
convert_attributes, allowed_attributes = scaffold_fields(action).partition{|x| scaffold_association(x)}.map{|x| x.map{|y| scaffold_field_id(y).to_s}}
|
556
|
+
h = {}
|
557
|
+
attributes.each do |k,v|
|
558
|
+
if allowed_attributes.include?(k)
|
559
|
+
h[k] = v
|
560
|
+
elsif convert_attributes.include?(k)
|
561
|
+
h[k] = v.to_i.to_s
|
562
|
+
end
|
563
|
+
end
|
564
|
+
h
|
556
565
|
end
|
557
566
|
|
558
567
|
# The associations to include when loading the association
|
@@ -17,7 +17,7 @@ module ScaffoldingExtensions
|
|
17
17
|
meth = "scaffold_#{action}_#{m}"
|
18
18
|
if respond_to?(meth, true)
|
19
19
|
Proc.new{send(meth)}
|
20
|
-
elsif
|
20
|
+
elsif instance_variable_defined?(meth = "@#{meth}")
|
21
21
|
Proc.new{instance_variable_get(meth)}
|
22
22
|
end
|
23
23
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scaffolding_extensions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Evans
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-06-
|
12
|
+
date: 2009-06-26 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -105,7 +105,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
105
105
|
requirements:
|
106
106
|
- - ">="
|
107
107
|
- !ruby/object:Gem::Version
|
108
|
-
version:
|
108
|
+
version: 1.8.6
|
109
109
|
version:
|
110
110
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
111
|
requirements:
|