cama_contact_form 0.0.9 → 0.0.10

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: bd3e0592f3058294a4f58e0e82fd68b4f0b91b8f
4
- data.tar.gz: 54085dd7769b51d2c4b729b34ad802567bcf448c
3
+ metadata.gz: c091f18c0753b22c78f86f66d5888b6b660a8e6f
4
+ data.tar.gz: 3523620fe4a1a7d0a97d9d62da76d415343c0099
5
5
  SHA512:
6
- metadata.gz: 00826667de8e6d526887a804d7010d7beedcfa597aa3aa01e75b481f10e2f7c07f36b44a53bcdd4c93973986d1f2a33ebefa34e671cd7039ad60e34e24b161ae
7
- data.tar.gz: 495b5cdd8a30898106bad1f670f7c93774e0712ad74ec738f61886a5aaea894ecca4e889fd4f37ead5b0e442b690bd80827987d534cf060001aa62e9ea80fe69
6
+ metadata.gz: e74bc0f6309a53890a883561fc7ba80297c17611c2b630a5eeafc3dd85b2f4efaf86c221bc46ba92053a817182efacdf9cb22760464fc1abef0aad1afdd4d016
7
+ data.tar.gz: ae0183e54ee79e26403456c5f3ff55cae31c77580c68b0acc7d90ece403079f0e87801e06d05b6eff9a25a6678ace8e903fb8ef55b147e2731df43330198e64c
@@ -77,7 +77,7 @@ module Plugins::CamaContactForm::MainHelper
77
77
  object.each do |ob|
78
78
  ob[:label] = ob[:label].to_s.translate
79
79
  ob[:description] = ob[:description].to_s.translate
80
- r = {field: ob, form: form, template: (ob[:field_options][:template].present? ? ob[:field_options][:template] : Plugins::CamaContactForm::CamaContactForm::field_template), custom_class: "#{'form-control' unless ['submit', 'checkboxes', 'radio', 'file'].include?(ob[:field_type].to_s)} #{ob[:field_options][:field_class]}", custom_attrs: {id: ob[:cid] }.merge((JSON.parse(ob[:field_options][:field_attributes]) rescue {})) }
80
+ r = {field: ob, form: form, template: (ob[:field_options][:template].present? ? ob[:field_options][:template] : Plugins::CamaContactForm::CamaContactForm::field_template), custom_class: (ob[:field_options][:field_class] rescue nil), custom_attrs: {id: ob[:cid] }.merge((JSON.parse(ob[:field_options][:field_attributes]) rescue {})) }
81
81
  hooks_run("contact_form_item_render", r)
82
82
  ob = r[:field]
83
83
  ob[:custom_class] = r[:custom_class]
@@ -91,27 +91,26 @@ module Plugins::CamaContactForm::MainHelper
91
91
 
92
92
  case ob[:field_type].to_s
93
93
  when 'paragraph','textarea'
94
- temp2 = "<textarea #{ob[:custom_attrs].to_attr_format} name=\"#{f_name}\" maxlength=\"#{field_options[:maxlength] || 500 }\" class=\"#{ob[:custom_class]} \">#{values[cid] || ob[:default_value].to_s.translate}</textarea>"
94
+ temp2 = "<textarea #{ob[:custom_attrs].to_attr_format} name=\"#{f_name}\" maxlength=\"#{field_options[:maxlength] || 500 }\" class=\"#{ob[:custom_class].presence || 'form-control'} \">#{values[cid] || ob[:default_value].to_s.translate}</textarea>"
95
95
  when 'radio'
96
96
  temp2= cama_form_select_multiple_bootstrap(ob, ob[:label], ob[:field_type],values)
97
97
  when 'checkboxes'
98
98
  temp2= cama_form_select_multiple_bootstrap(ob, ob[:label], "checkbox",values)
99
99
  when 'submit'
100
- temp2 = "<button #{ob[:custom_attrs].to_attr_format} type=\"#{ob[:field_type]}\" name=\"#{f_name}\" class=\"#{ob[:custom_class].present? ? ob[:custom_class] : 'btn btn-default'}\">#{ob[:label]}</button>"
100
+ temp2 = "<button #{ob[:custom_attrs].to_attr_format} type=\"#{ob[:field_type]}\" name=\"#{f_name}\" class=\"#{ob[:custom_class].presence || 'btn btn-default'}\">#{ob[:label]}</button>"
101
101
  when 'button'
102
- temp2 = "<button #{ob[:custom_attrs].to_attr_format} type='button' name=\"#{f_name}\" class=\"#{ob[:custom_class].present? ? ob[:custom_class] : 'btn btn-default'}\">#{ob[:label]}</button>"
102
+ temp2 = "<button #{ob[:custom_attrs].to_attr_format} type='button' name=\"#{f_name}\" class=\"#{ob[:custom_class].presence || 'btn btn-default'}\">#{ob[:label]}</button>"
103
103
  when 'reset_button'
104
- temp2 = "<button #{ob[:custom_attrs].to_attr_format} type='reset' name=\"#{f_name}\" class=\"#{ob[:custom_class].present? ? ob[:custom_class] : 'btn btn-default'}\">#{ob[:label]}</button>"
104
+ temp2 = "<button #{ob[:custom_attrs].to_attr_format} type='reset' name=\"#{f_name}\" class=\"#{ob[:custom_class].presence || 'btn btn-default'}\">#{ob[:label]}</button>"
105
105
  when 'text', 'website', 'email'
106
106
  class_type = ""
107
107
  class_type = "railscf-field-#{ob[:field_type]}" if ob[:field_type]=="website"
108
108
  class_type = "railscf-field-#{ob[:field_type]}" if ob[:field_type]=="email"
109
- temp2 = "<input #{ob[:custom_attrs].to_attr_format} type=\"#{ob[:field_type]}\" value=\"#{values[cid] || ob[:default_value].to_s.translate}\" name=\"#{f_name}\" class=\"#{ob[:custom_class]} #{class_type}\">"
109
+ temp2 = "<input #{ob[:custom_attrs].to_attr_format} type=\"#{ob[:field_type]}\" value=\"#{values[cid] || ob[:default_value].to_s.translate}\" name=\"#{f_name}\" class=\"#{ob[:custom_class].presence || 'form-control'} #{class_type}\">"
110
110
  when 'captcha'
111
- temp2 = cama_captcha_tag(5, {}, {class: "#{ob[:custom_class]} field-captcha required"}.merge(ob[:custom_attrs]))
111
+ temp2 = cama_captcha_tag(5, {}, {class: "#{ob[:custom_class].presence || 'form-control'} field-captcha required"}.merge(ob[:custom_attrs]))
112
112
  when 'file'
113
- class_type = "railscf-field-#{ob[:field_type]}" if ob[:field_type]=="website"
114
- temp2 = "<input multiple=\"multiple\" type=\"file\" value=\"\" name=\"#{f_name}\" #{ob[:custom_attrs].to_attr_format} class=\"#{class_type} #{ob[:custom_class]}\">"
113
+ temp2 = "<input multiple=\"multiple\" type=\"file\" value=\"\" name=\"#{f_name}\" #{ob[:custom_attrs].to_attr_format} class=\"#{ob[:custom_class].presence || 'form-control'}\">"
115
114
  when 'dropdown'
116
115
  temp2 = cama_form_select_multiple_bootstrap(ob, ob[:label], "select",values)
117
116
  else
@@ -19,11 +19,13 @@
19
19
  <label for=""><%= t('.label') %></label><br>
20
20
  <%= text_field_tag "fields[#{cid}][label]", field[:label], class: 'form-control translatable' %>
21
21
  </div>
22
- <div class="form-group ">
23
- <label for=""><%= t('.is_required', default: 'Is Required?') %></label><br>
24
- <%= hidden_field_tag "fields[#{cid}][required]", false %>
25
- <%= check_box_tag "fields[#{cid}][required]", true, field[:required].to_s.cama_true? %>
26
- </div>
22
+ <% unless ['button' 'submit', 'reset_button'].include?(field[:field_type]) %>
23
+ <div class="form-group ">
24
+ <label for=""><%= t('.is_required', default: 'Is Required?') %></label><br>
25
+ <%= hidden_field_tag "fields[#{cid}][required]", false %>
26
+ <%= check_box_tag "fields[#{cid}][required]", true, field[:required].to_s.cama_true? %>
27
+ </div>
28
+ <% end %>
27
29
  <div class="form-group ">
28
30
  <label><%= t('.descr', default: 'Description') %></label><br>
29
31
  <%= text_area_tag "fields[#{cid}][field_options][description]", field[:field_options][:description], class: 'form-control translatable' %>
@@ -1,3 +1,3 @@
1
1
  module CamaContactForm
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cama_contact_form
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Owen Peredo