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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c091f18c0753b22c78f86f66d5888b6b660a8e6f
|
4
|
+
data.tar.gz: 3523620fe4a1a7d0a97d9d62da76d415343c0099
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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:
|
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].
|
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].
|
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].
|
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
|
-
|
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
|
-
|
23
|
-
<
|
24
|
-
|
25
|
-
|
26
|
-
|
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' %>
|