formbuilder-rb 0.0.1 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8903a78b92442b180ead19dd35b636f5b31427f9
4
- data.tar.gz: 06b5c87025806f7354abff694997adb6405cd07d
3
+ metadata.gz: 6e4893ebfa92c93b1c9e306f32cc8b5ed48aaf33
4
+ data.tar.gz: f83905df1c6d607cdf3ea7d3bc5fff8d497952e8
5
5
  SHA512:
6
- metadata.gz: c36e2043201c9e356973ddf02c08b52337f0d615c36ccbe70ce1adf738db14916bd74463b5a8c9f0b0cf0ce5449b42a5b7eca65957160d6aea0a4e07d3c44a16
7
- data.tar.gz: ef2b24b1fc81547d028fb9d2c73a612e50b99d5dbeef7a77a4285ca952c6ddf99249aaaf7a395a3570c5fd6eabbe294361839ed4ac648176a14d037b6ffb016a
6
+ metadata.gz: 2ae9b52dc25a6537a05b0761112e452679f8777181a1d2d368d2a2f2e93323a5b310d5da779cfd2d20c799f3e4de4c5511882095ae30dae1058dc3f3449733f1
7
+ data.tar.gz: 5dda69d10ba76a7b43f28d82a86a740fa35150a56a98a6ebe419554520eff56cabdbc51a72693fa1143d3ab19cc61a7c54092288a45f104c89be27f4b2ece2e0
@@ -32,7 +32,7 @@ module Formbuilder
32
32
  rf.cid = cids[rf.id]
33
33
  end
34
34
 
35
- render json: @form.response_fields.to_json(methods: [:field_type, :cid])
35
+ render json: @form.response_fields_json
36
36
  end
37
37
 
38
38
  private
@@ -41,8 +41,8 @@ module Formbuilder
41
41
  end
42
42
 
43
43
  def transformed_field_params(field_params, i)
44
- filtered_params = field_params.reject { |k, v|
45
- !k.to_sym.in?(Formbuilder::ResponseField::ALLOWED_PARAMS) || v.blank?
44
+ filtered_params = field_params.select { |k, _|
45
+ k.to_sym.in?(Formbuilder::ResponseField::ALLOWED_PARAMS)
46
46
  }.merge(
47
47
  sort_order: i,
48
48
  type: "Formbuilder::ResponseField#{field_params[:field_type].camelize}"
@@ -8,5 +8,9 @@ module Formbuilder
8
8
  response_fields.reject { |rf| !rf.input_field }
9
9
  end
10
10
 
11
+ def response_fields_json
12
+ self.response_fields.to_json(methods: [:field_type, :cid])
13
+ end
14
+
11
15
  end
12
16
  end
@@ -14,7 +14,7 @@ module Formbuilder
14
14
  checked = value.present? ? value[option['label']] : (option['checked'] == 'true')
15
15
 
16
16
  """
17
- <label>
17
+ <label class='fb-option'>
18
18
  <input type='checkbox' name='response_fields[#{self[:id]}][#{i}]' #{checked ? 'checked' : ''} value='on' />
19
19
  #{option['label']}
20
20
  </label>
@@ -23,7 +23,7 @@ module Formbuilder
23
23
 
24
24
  if self[:field_options]['include_other_option']
25
25
  str += """
26
- <div class='other-option'>
26
+ <div class='fb-option'>
27
27
  <label>
28
28
  <input type='checkbox' name='response_fields[#{self[:id]}][other_checkbox]' #{value['Other'] ? 'checked' : ''} value='on' />
29
29
  Other
@@ -16,7 +16,7 @@ module Formbuilder
16
16
  end
17
17
 
18
18
  def render_entry(value, opts = {})
19
- attachment = EntryAttachment.find(value)
19
+ attachment = value && EntryAttachment.where(id: value).first
20
20
 
21
21
  return unless attachment
22
22
 
@@ -14,7 +14,7 @@ module Formbuilder
14
14
  checked = (value == option["label"]) || (value.blank? && option["checked"])
15
15
 
16
16
  """
17
- <label>
17
+ <label class='fb-option'>
18
18
  <input type='radio' name='response_fields[#{self[:id]}]' #{checked ? 'checked' : ''} value='#{option['label']}' />
19
19
  #{option['label']}
20
20
  </label>
@@ -23,7 +23,7 @@ module Formbuilder
23
23
 
24
24
  if self[:field_options]['include_other_option']
25
25
  str += """
26
- <div class='other-option'>
26
+ <div class='fb-option'>
27
27
  <label>
28
28
  <input type='radio' name='response_fields[#{self[:id]}]' #{value == 'Other' ? 'checked' : ''} value='Other' />
29
29
  Other
@@ -42,7 +42,7 @@ module Formbuilder
42
42
  value = @entry.try(:response_value, @field)
43
43
 
44
44
  """
45
- <div class='response-field-wrapper response-field-#{@field.field_type} #{@entry.try(:error_for, @field) && 'error'}'>
45
+ <div class='fb-field-wrapper response-field-#{@field.field_type} #{@entry.try(:error_for, @field) && 'error'}'>
46
46
  #{render_label}
47
47
  #{@field.render_input(value, entry: @entry)}
48
48
  <div class='cf'></div>
@@ -93,7 +93,7 @@ module Formbuilder
93
93
  def render_actions
94
94
  """
95
95
  <div class='form-actions'>
96
- <button class='button'>Submit</button>
96
+ <button class='button primary'>Submit</button>
97
97
  <a class='button save-draft-button' data-loading-text='All changes saved'>Save draft</a>
98
98
  </div>
99
99
  """.html_safe
@@ -1,3 +1,3 @@
1
1
  module Formbuilder
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: formbuilder-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Becker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-27 00:00:00.000000000 Z
11
+ date: 2013-12-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -251,7 +251,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
251
251
  version: '0'
252
252
  requirements: []
253
253
  rubyforge_project:
254
- rubygems_version: 2.0.3
254
+ rubygems_version: 2.1.11
255
255
  signing_key:
256
256
  specification_version: 4
257
257
  summary: Rails backend for https://github.com/dobtco/formbuilder