scaffolding_extensions 1.4.0 → 1.4.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/README
CHANGED
@@ -24,11 +24,11 @@ Scaffolding Extensions currently supports:
|
|
24
24
|
* Rails 2.3.5 (with or without RailsXss plugin)
|
25
25
|
* Ramaze 2009.06.12
|
26
26
|
* Camping 1.5
|
27
|
-
* Sinatra 0
|
27
|
+
* Sinatra 1.0
|
28
28
|
* Merb 1.0.4
|
29
29
|
* Object Relational Mappers
|
30
30
|
* ActiveRecord 2.3.5
|
31
|
-
* Sequel 3.
|
31
|
+
* Sequel 3.10.0
|
32
32
|
* DataMapper 0.10.2 (see doc/datamapper.txt for details)
|
33
33
|
* Javascript Libaries (used for Ajax/Autocompleting)
|
34
34
|
* Prototype 1.6.0.3
|
@@ -51,18 +51,14 @@ module ScaffoldingExtensions
|
|
51
51
|
response['Content-Type'] = 'text/javascript' if use_js
|
52
52
|
render(:erb, scaffold_fix_template(render_options[:inline]), :layout=>false)
|
53
53
|
else
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
template = scaffold_fix_template(File.read(scaffold_path(action)))
|
59
|
-
end
|
60
|
-
layout, filename, line_number = lookup_layout(:erb, :layout, views_dir)
|
61
|
-
layout ||= scaffold_fix_template(File.read(scaffold_path('layout'))).gsub('@content', 'yield')
|
54
|
+
views_path = render_options.delete(:views) || self.class.views || "./views"
|
55
|
+
views_dir = Dir.new(views_path) rescue nil
|
56
|
+
template = scaffold_template_code(views_dir, suffix_action, action)
|
57
|
+
layout = scaffold_template_code(views_dir, 'layout', 'layout'){|s| s.gsub('@content', 'yield')}
|
62
58
|
render(:erb, template, :layout=>layout)
|
63
59
|
end
|
64
60
|
end
|
65
|
-
|
61
|
+
|
66
62
|
def scaffold_request_action
|
67
63
|
@scaffold_method
|
68
64
|
end
|
@@ -90,6 +86,16 @@ module ScaffoldingExtensions
|
|
90
86
|
def scaffold_session
|
91
87
|
session
|
92
88
|
end
|
89
|
+
|
90
|
+
def scaffold_template_code(views_dir, sin_name, se_name)
|
91
|
+
if views_dir && views_dir.member?("#{sin_name}.erb")
|
92
|
+
sin_name.to_sym
|
93
|
+
else
|
94
|
+
code = scaffold_fix_template(File.read(scaffold_path(se_name)))
|
95
|
+
code = yield code if block_given?
|
96
|
+
code
|
97
|
+
end
|
98
|
+
end
|
93
99
|
|
94
100
|
# Treats the id option as special, appending it to the path.
|
95
101
|
# Uses the rest of the options as query string parameters.
|
@@ -37,9 +37,7 @@ module ScaffoldingExtensions::MetaSequel
|
|
37
37
|
# constraint, as it is assumed that all objects currently assocated with the given object
|
38
38
|
# have already met the criteria. If that is not the case, you should override this method.
|
39
39
|
def scaffold_associated_objects(association, object, options)
|
40
|
-
|
41
|
-
reflection = association_reflection(association)
|
42
|
-
reflection[:cache] || reflection[:type] == :many_to_one ? assoc : assoc.all
|
40
|
+
object.send(association)
|
43
41
|
end
|
44
42
|
|
45
43
|
# The association reflection for this association
|
@@ -51,9 +49,9 @@ module ScaffoldingExtensions::MetaSequel
|
|
51
49
|
# associated with the current object), :edit for :many_to_many (since you
|
52
50
|
# can edit the list of associated objects), or :one for :many_to_one.
|
53
51
|
def scaffold_association_type(association)
|
54
|
-
case scaffold_association(association)[:type]
|
52
|
+
case (a = scaffold_association(association))[:type]
|
55
53
|
when :one_to_many
|
56
|
-
:new
|
54
|
+
a[:one_to_one] ? :one : :new
|
57
55
|
when :many_to_many
|
58
56
|
:edit
|
59
57
|
else
|
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.4.
|
4
|
+
version: 1.4.1
|
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: 2010-03-
|
12
|
+
date: 2010-03-30 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|