cama_contact_form 0.0.23 → 0.0.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/concerns/plugins/cama_contact_form/contact_form_controller_concern.rb +9 -6
- data/app/controllers/plugins/cama_contact_form/admin_forms_controller.rb +1 -4
- data/app/helpers/plugins/cama_contact_form/main_helper.rb +4 -3
- data/lib/cama_contact_form/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 79f5408cc5871edfdbd3ed0fb697114eeb2e25c3
|
4
|
+
data.tar.gz: 23273662b1911e32621c4620a4653a940a950acc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42a40daf5a2f72c7a25f2ba0fd165c7440443fa2023b554f74c38b4587b918e27ceb6be770c516a3773d53aec00645e0833ccfdb09b58825060ab29827441406
|
7
|
+
data.tar.gz: 4c5e6aaa633869ea020f8c1adea7c852cedd41acfe9287607b91d64f2d6b77c8f04bf50b1fafd553e663b33834ca6f122000e60599133f83ce8480b2fa6f6d04
|
@@ -64,20 +64,23 @@ module Plugins::CamaContactForm::ContactFormControllerConcern
|
|
64
64
|
def convert_form_values(form, fields)
|
65
65
|
values = {}
|
66
66
|
form.fields.each do |field|
|
67
|
+
next unless relevant_field?(field)
|
68
|
+
ft = field[:field_type]
|
67
69
|
cid = field[:cid].to_sym
|
68
70
|
label = values.keys.include?(field[:label]) ? "#{field[:label]} (#{cid})" : field[:label].to_s.translate
|
69
71
|
values[label] = []
|
70
|
-
if
|
71
|
-
elsif field[:field_type] == 'file'
|
72
|
+
if ft == 'file'
|
72
73
|
values[label] << fields[cid].split('/').last if fields[cid].present?
|
73
|
-
elsif
|
74
|
-
values[label] << (params[:captcha] rescue '')
|
75
|
-
elsif field[:field_type] == 'radio' || field[:field_type] == 'checkboxes'
|
74
|
+
elsif ft == 'radio' || ft == 'checkboxes'
|
76
75
|
values[label] << fields[cid].map { |f| f.to_s.translate }.join(', ') if fields[cid].present?
|
77
76
|
else
|
78
77
|
values[label] << fields[cid] if fields[cid].present?
|
79
78
|
end
|
80
79
|
end
|
81
|
-
|
80
|
+
values
|
81
|
+
end
|
82
|
+
|
83
|
+
def relevant_field?(field)
|
84
|
+
!%w(captcha submit button).include? field[:field_type]
|
82
85
|
end
|
83
86
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
class Plugins::CamaContactForm::AdminFormsController < CamaleonCms::Apps::PluginsAdminController
|
2
2
|
include Plugins::CamaContactForm::MainHelper
|
3
|
+
include Plugins::CamaContactForm::ContactFormControllerConcern
|
3
4
|
before_action :set_form, only: ['show','edit','update','destroy']
|
4
5
|
add_breadcrumb I18n.t("plugins.cama_contact_form.title", default: 'Contact Form'), :admin_plugins_cama_contact_form_admin_forms_path
|
5
6
|
|
@@ -80,8 +81,4 @@ class Plugins::CamaContactForm::AdminFormsController < CamaleonCms::Apps::Plugin
|
|
80
81
|
redirect_to cama_admin_path
|
81
82
|
end
|
82
83
|
end
|
83
|
-
|
84
|
-
def relevant_field?(field)
|
85
|
-
!%w(captcha submit button).include? field[:field_type]
|
86
|
-
end
|
87
84
|
end
|
@@ -139,15 +139,16 @@ module Plugins::CamaContactForm::MainHelper
|
|
139
139
|
end
|
140
140
|
|
141
141
|
options.each do |op|
|
142
|
+
label = op[:label].translate
|
142
143
|
if type == "radio" || type == "checkbox"
|
143
144
|
html += "<div class=\"#{type} #{ob[:custom_class]}\">
|
144
145
|
<label for=\"#{ob[:cid]}\">
|
145
|
-
<input #{ob[:custom_attrs].to_attr_format} type=\"#{type}\" #{'checked' if op[:checked].to_s.cama_true?} name=\"#{f_name}[]\" class=\"\" value=\"#{
|
146
|
-
#{
|
146
|
+
<input #{ob[:custom_attrs].to_attr_format} type=\"#{type}\" #{'checked' if op[:checked].to_s.cama_true?} name=\"#{f_name}[]\" class=\"\" value=\"#{label.downcase}\">
|
147
|
+
#{label}
|
147
148
|
</label>
|
148
149
|
</div>"
|
149
150
|
else
|
150
|
-
html += "<option value=\"#{
|
151
|
+
html += "<option value=\"#{label.downcase.gsub(" ", "_")}\" #{"selected" if "#{label.downcase.gsub(" ", "_")}" == values[cid] || op[:checked].to_s.cama_true? } >#{label}</option>"
|
151
152
|
end
|
152
153
|
end
|
153
154
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cama_contact_form
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Owen Peredo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|