make 0.2.9 → 0.3.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 +8 -6
  3. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7bcc508e38182d88b21adc2c6e071d361fd41591
4
- data.tar.gz: a157388fabe661e035b6bd0801a46456979bc094
3
+ metadata.gz: 04792a26bac9776862679ea78c6451de9b955a41
4
+ data.tar.gz: 747cfe1b615afe13a3e5af67bf970938b51724ea
5
5
  SHA512:
6
- metadata.gz: 96901320b5bdd5a306039d8a7a8a01725405c4890d679ec4f73ba9da13182710395b58bcf943e825604564f0f89dfec1e002673dca75aa7c550778842e739058
7
- data.tar.gz: 8a67532d917365db39a2ed53a5722f899e7b8e8657c911e992d58232ff7a1adc512b78340d43bec9d5a2242c94666391b270001a04cb86346010d271573659d3
6
+ metadata.gz: 8ca25d91b609c87f5bd9dd42e115fda83a45553ef5313eb86bfe4019fa217b535618c3a93c158dad8e48745fc2ab652533f02a11b41f67e513f7f650c69005b9
7
+ data.tar.gz: da223904d126f9b338d61cdc3e77f5490f37aedd0632bc636286cda260ae1ffbf085688618e290b7eb202773bd2019d1ce50a2a0862aae2d345ce4e8d9f9e620
@@ -63,10 +63,12 @@ class Form
63
63
  return self
64
64
  end
65
65
  # Similar to default, but instead of a hidden specific value you pass in an array and create a select/option field.
66
- def select column, array, assoc = false
66
+ def select column, array
67
67
  columnName = column.titleize
68
- input = "\n\t<label>" + columnName + "\n\t</label>\n\t<select name=\"" + @modelName + "[" + column + "]\">"
69
- input += "\n\t\t\t<option value=\"" + item.to_s + "\">" + item.to_s + "</option>"
68
+ input = "\n\t<label>" + columnName + "</label>\n\t<select name=\"" + @modelName + "[" + column + "]\">"
69
+ array.each |item| do
70
+ input += "\n\t\t<option value=\"" + item.to_s + "\">" + item.to_s + "</option>"
71
+ end
70
72
  @potential_keys_to_ignore.push(column)
71
73
  input += "\n\t</select>"
72
74
  @formMiddle.push(input)
@@ -77,7 +79,7 @@ class Form
77
79
  # titleize column
78
80
  columnName = column.titleize
79
81
  # Create for input
80
- input = "\n\t<label>" + columnName + "\n\t</label>\n\t<select name=\"" + @modelName + "[" + column + "]\">"
82
+ input = "\n\t<label>" + columnName + "</label>\n\t<select name=\"" + @modelName + "[" + column + "]\">"
81
83
  # Remove _id and take the assocModel unless assocModel exists
82
84
  if assoc_model
83
85
  assoc_model = assoc_model.capitalize.constantize
@@ -90,7 +92,7 @@ class Form
90
92
  counter = 1
91
93
  while counter <= total do
92
94
  val = assoc_model.find(counter).attributes[assoc_column]
93
- input += "\n\t\t\t<option value=\"" + counter.to_s + "\">" + val.to_s + "</option>"
95
+ input += "\n\t\t<option value=\"" + counter.to_s + "\">" + val.to_s + "</option>"
94
96
  counter+= 1
95
97
  end
96
98
  input += "\n\t</select>"
@@ -129,7 +131,7 @@ class Form
129
131
  input = "\n\t<label>"+column.titleize+"</label>\n\t<input type=\"date\" name=\"" + @modelName + "[" + column + "]\">"
130
132
  @formMiddle.push(input)
131
133
  else
132
- input = "\n\t<label>" + column.titleize + "\n\t</label>\n\t<input type=\"text\" name=\"" + @modelName + "[" + column + "]\">"
134
+ input = "\n\t<label>" + column.titleize + "</label>\n\t<input type=\"text\" name=\"" + @modelName + "[" + column + "]\">"
133
135
  @formMiddle.push(input)
134
136
  end
135
137
  end
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.2.9
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sara Wong
@@ -12,10 +12,10 @@ cert_chain: []
12
12
  date: 2014-02-09 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A gem that shortcuts typing out forms and tables for SQL users. Assuming
15
- your model is named ModelName, just type Make.form.model(ModelName).now! in your
16
- controller and it will return an html-safe string from your column names for creating
17
- a new record. In addition, you can type Make.table.model("ModelName").now! to automatically
18
- generate a table. Use Make.header("Title") to make a default header.
15
+ your model is named ModelName, just type Make.form.model("ModelName").now! in your
16
+ controller and it will return an html-safe form based on your column names for creating
17
+ a new record in your view. In addition, you can type Make.table.model("ModelName").now!
18
+ to automatically generate a table.
19
19
  email:
20
20
  - swong2@wellesley.edu
21
21
  - utemoc@gmail.com