formulate 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -42,12 +42,12 @@ module Formulate
42
42
  instructions = options.delete(:instructions)
43
43
  errors = errors_on(method)
44
44
 
45
- style = ['field']
46
- style << (options.delete(:required) ? 'required' : 'optional')
47
- style << 'checkbox' if type == :check_box
48
- style << 'radio' if type == :radio_button
49
- style << options.delete(:style) if options[:style]
50
- style.uniq!
45
+ classes = ['field']
46
+ classes << (options.delete(:required) ? 'required' : 'optional')
47
+ classes << 'checkbox' if type == :check_box
48
+ classes << 'radio' if type == :radio_button
49
+ classes << options.delete(:class) if options[:class]
50
+ classes.uniq!
51
51
 
52
52
  input = case type
53
53
  when :check_box
@@ -84,20 +84,20 @@ module Formulate
84
84
  send(type, method, priority_countries, options, html_options)
85
85
  else
86
86
  send(type, method, options)
87
- end
87
+ end unless block_given?
88
88
 
89
89
  label = options[:label] != false ? label(method, options[:label]) : nil
90
90
  markup = [label, input].compact
91
91
  markup.reverse! if type.in?(:check_box, :radio_button)
92
92
 
93
93
  markup << @template.capture_haml do
94
- yield(self) if block_given?
94
+ yield(object.send(method)) if block_given?
95
95
  errors_list(errors)
96
96
  instructions(instructions)
97
97
  end
98
98
 
99
99
  @template.capture_haml do
100
- @template.haml_tag(:div, class: style.join(' ')) do
100
+ @template.haml_tag(:div, class: classes.join(' ')) do
101
101
  @template.haml_concat(markup.join)
102
102
  end
103
103
  end
@@ -1,3 +1,3 @@
1
1
  module Formulate
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
@@ -0,0 +1,35 @@
1
+ $line-height: 1.5 !default
2
+ $spacer-size: 1.5em !default
3
+ $border-width: 0.125em !default
4
+
5
+ $fieldset-border-color: #EEE !default
6
+ $fieldset-legend-color: #999 !default
7
+
8
+ $input-background-color: #FFF !default
9
+ $input-border-color: #CCC !default
10
+ $input-disabled-border-color: #EEE !default
11
+ $input-focus-border-color: #666 !default
12
+
13
+ $button-color: #999 !default
14
+ $button-text-color: #FFF !default
15
+
16
+ $submit-border-color: #EEE !default
17
+ $submit-button-color: #999 !default
18
+
19
+ $label-color: #000
20
+ $label-optional-color: #666
21
+
22
+ $error-color: #F33 !default
23
+ $instructions-color: #666 !default
24
+
25
+ @mixin button($color: $button-color)
26
+ -webkit-appearance: none
27
+ background: $color
28
+ border: $border-width solid $color
29
+ color: $button-text-color
30
+ display: inline-block
31
+ font-weight: bold
32
+ line-height: 1.125em
33
+ margin-right: 0.25em
34
+ padding: 0.25em 0.5em
35
+ text-decoration: none
@@ -1,37 +1,4 @@
1
- $line-height: 1.5 !default
2
- $spacer-size: 1.5em !default
3
- $border-width: 0.125em !default
4
-
5
- $fieldset-border-color: #EEE !default
6
- $fieldset-legend-color: #999 !default
7
-
8
- $input-border-color: #CCC !default
9
- $input-readonly-border-color: #EEE !default
10
- $input-focus-border-color: #666 !default
11
-
12
- $button-color: #999 !default
13
- $button-text-color: #FFF !default
14
-
15
- $submit-border-color: #EEE !default
16
- $submit-button-color: #999 !default
17
-
18
- $label-color: #000
19
- $label-optional-color: #666
20
-
21
- $error-color: #F33 !default
22
- $instructions-color: #666 !default
23
-
24
- @mixin button($color: $button-color)
25
- -webkit-appearance: none
26
- background: $color
27
- border: $border-width solid $color
28
- color: $button-text-color
29
- display: inline-block
30
- font-weight: bold
31
- line-height: 1.125em
32
- margin-right: 0.25em
33
- padding: 0.25em 0.5em
34
- text-decoration: none
1
+ @import formulate/defaults
35
2
 
36
3
  form.formulate
37
4
  margin: $spacer-size 0
@@ -62,8 +29,8 @@ form.formulate
62
29
 
63
30
  input,
64
31
  select,
65
- textarea,
66
- p.readonly
32
+ textarea
33
+ background: $input-background-color
67
34
  border: $border-width solid $input-border-color
68
35
  font-family: 'Helvetica', sans-serif
69
36
  font-size: 1em
@@ -74,9 +41,8 @@ form.formulate
74
41
  border-color: $input-focus-border-color
75
42
  outline: none
76
43
 
77
- p.readonly
78
- border-color: $input-readonly-border-color
79
- line-height: 1.125em
44
+ input[disabled]
45
+ border-color: $input-disabled-border-color
80
46
 
81
47
  a.button
82
48
  @include button
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: formulate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-29 00:00:00.000000000 Z
12
+ date: 2012-05-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -109,6 +109,7 @@ files:
109
109
  - lib/formulate/form_helper.rb
110
110
  - lib/formulate/version.rb
111
111
  - vendor/assets/stylesheets/formulate.css.sass
112
+ - vendor/assets/stylesheets/formulate/defaults.css.sass
112
113
  homepage: http://github.com/tylerhunt/formulate
113
114
  licenses: []
114
115
  post_install_message:
@@ -129,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
130
  version: '0'
130
131
  requirements: []
131
132
  rubyforge_project:
132
- rubygems_version: 1.8.23
133
+ rubygems_version: 1.8.24
133
134
  signing_key:
134
135
  specification_version: 3
135
136
  summary: Rails form builder with flexible markup and styles.