vertform 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vertform/version.rb +1 -1
- data/lib/vertform.rb +17 -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: 0db790126112c8e2b409c8ab017de5e1961670fb
|
4
|
+
data.tar.gz: d785537843b5a79bab39a8c781a98093bfa58fe1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6c92c4b9f15cfef27db84617ee93ed021dc7b39cb0162dd1a06db9ec46f3adb7214ed6dd40cc8efd9b91fd994b2dc4ced3eabefb9412eff465629ccce03de11
|
7
|
+
data.tar.gz: f2723b2133f97f9a70dacada4f3634a681fcff7eed9baf8658a662b8b46c59543cebe3b03b6fdfa9347ae17e8bf58c91722502badb2047cdc5189bed399d87f1
|
data/lib/vertform/version.rb
CHANGED
data/lib/vertform.rb
CHANGED
@@ -1,16 +1,22 @@
|
|
1
1
|
|
2
2
|
|
3
3
|
class VertForm
|
4
|
-
attr_accessor :
|
4
|
+
attr_accessor :table_params, :label_params, :form_fields
|
5
5
|
|
6
6
|
def initialize(form_fields = {})
|
7
|
-
@
|
7
|
+
@table_params = {
|
8
8
|
"class" => "table"
|
9
9
|
}
|
10
|
-
@
|
10
|
+
@td_label_params = {
|
11
|
+
"style" => "width: 32%;"
|
12
|
+
}
|
13
|
+
@label_params = {
|
11
14
|
"class" => "pull-right",
|
12
15
|
"style" => "margin-top: 4px;"
|
13
16
|
}
|
17
|
+
@td_input_params = {
|
18
|
+
"style" => "width: 68%;"
|
19
|
+
}
|
14
20
|
@form_fields = form_fields
|
15
21
|
end
|
16
22
|
|
@@ -18,16 +24,20 @@ class VertForm
|
|
18
24
|
out_string = ""
|
19
25
|
out_string .
|
20
26
|
concat "<table " .
|
21
|
-
concat pair_json(@
|
27
|
+
concat pair_json(@table_params) .
|
22
28
|
concat ">\n"
|
23
29
|
form_fields.each { |label,field|
|
24
30
|
out_string .
|
25
|
-
concat " <tr>\n <td
|
31
|
+
concat " <tr>\n <td " .
|
32
|
+
concat pair_json(@td_label_params) .
|
33
|
+
concat ">\n " .
|
26
34
|
concat "<span " .
|
27
|
-
concat pair_json(@
|
35
|
+
concat pair_json(@label_params) .
|
28
36
|
concat ">\n " .
|
29
37
|
concat(label) .
|
30
|
-
concat "\n </span>\n </td>\n <td
|
38
|
+
concat "\n </span>\n </td>\n <td " .
|
39
|
+
concat pair_json(@td_input_params) .
|
40
|
+
concat ">\n <%= " .
|
31
41
|
concat(field) .
|
32
42
|
concat " %>\n </td>\n </tr>\n"
|
33
43
|
}
|