make 0.1.9 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/make/form.rb +7 -7
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 035d5c815e1b884c05b5f081161873c5f9b67ea9
4
- data.tar.gz: 29cb4a36ebc3370c9a7f2a24c2270660c795aefd
3
+ metadata.gz: 1ea47078e6009a20f31565d2f5cda2184833f456
4
+ data.tar.gz: ee51dd6c02f68363fe70fb1560ac7e300e300e8e
5
5
  SHA512:
6
- metadata.gz: 225e70762995508be506fc5dc4c5e06cdeeeea1022ad8bfe997e98748b3bfab88ab2e541dddd562360bc6e0ab0de0d356680578baa5b3bc36eaca1e00bc96f99
7
- data.tar.gz: e0635632134bdbd3544e60493c79c977ab6ef530289914656b9786c8ab47c1a160b81a7b68a4700ff49c93860dac8cd29e8ff1c9fd17d37ff3e6188ef3fef5f9
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" name="password_confirmation">'
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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: make
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sara Wong