make 0.1.9 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/make/form.rb +7 -7
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ea47078e6009a20f31565d2f5cda2184833f456
|
4
|
+
data.tar.gz: ee51dd6c02f68363fe70fb1560ac7e300e300e8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0aa383646810b3e4f32250342ad5dd61aaa369f1bcd3f5bdcd00edab38dc7b57b97479a02f070b8fb80515b50a81967a37caa8439b8a0a7ab3753d60f9f9a041
|
7
|
+
data.tar.gz: 3ce14f8a8e09ffc83d6a823d7a30dc794d09851cdaa0c35871214931ef3c7e1bce35975b453df42c2808fbc28fa286a7162fcf90fa50ed6a144ec1d4c9b60476
|
data/lib/make/form.rb
CHANGED
@@ -58,15 +58,15 @@ class Form
|
|
58
58
|
# Similar to default, but instead of a hidden specific value you pass in an array and create a select/option field.
|
59
59
|
def select column, array, assoc = false
|
60
60
|
columnName = column.titleize
|
61
|
-
input = '<label>' + columnName + '</label><select name="' + column + '" value="' + column + '">'
|
61
|
+
input = '<label>' + columnName + '</label><select name="' + column + '" value="' + @modelName+'['column + ']">'
|
62
62
|
if assoc #if association is checked true
|
63
63
|
array.each do |id|
|
64
64
|
val = column[0...-3].capitalize.constantize.find(id).attributes.values[1]
|
65
|
-
input += '<option value="' + id.to_s + '">' + val.to_s + '</option>'
|
65
|
+
input += '<option value="' + @modelName+'[' + id.to_s + ']">' + val.to_s + '</option>'
|
66
66
|
end
|
67
67
|
else #if no associations exist for array
|
68
68
|
array.each do |item|
|
69
|
-
input += '<option value="' + item.to_s + '">' + item.to_s + '</option>'
|
69
|
+
input += '<option value="' + @modelName+'[' + item.to_s + ']">' + item.to_s + '</option>'
|
70
70
|
end
|
71
71
|
end
|
72
72
|
@potential_keys_to_ignore.push(column)
|
@@ -95,19 +95,19 @@ class Form
|
|
95
95
|
# Create text input labels
|
96
96
|
@columns.each do |column|
|
97
97
|
if column.include? 'password'
|
98
|
-
input = '<label>Password</label><input type="text" name="password">'
|
98
|
+
input = '<label>Password</label><input type="text" name="' + @modelName + '[password]">'
|
99
99
|
@formMiddle.push(input)
|
100
100
|
if @password_confirmation
|
101
|
-
input = '<label>Confirm Password</label><input type="text"
|
101
|
+
input = '<label>Confirm Password</label><input type="text"' + @modelName + '[password_confirmation]">'
|
102
102
|
@formMiddle.push(input)
|
103
103
|
end
|
104
104
|
else
|
105
|
-
input = '<label>' + column.titleize + '</label><input type="text" name="'+column+'">'
|
105
|
+
input = '<label>' + column.titleize + '</label><input type="text" name="'+ @modelName + '['+ column+']">'
|
106
106
|
@formMiddle.push(input)
|
107
107
|
end
|
108
108
|
end
|
109
109
|
@defaults.each_pair do |key, value|
|
110
|
-
input = '<input type="hidden" name="'+key.to_s+'" value="'+value.to_s+'">'
|
110
|
+
input = '<input type="hidden" name="'+ @modelName + '['+ key.to_s+']" value="'+value.to_s+'">'
|
111
111
|
puts input
|
112
112
|
puts @formMiddle
|
113
113
|
@formMiddle.push(input)
|