cama_contact_form 0.0.18 → 0.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/concerns/plugins/cama_contact_form/contact_form_controller_concern.rb +1 -1
- data/app/controllers/plugins/cama_contact_form/admin_forms_controller.rb +5 -1
- data/app/controllers/plugins/cama_contact_form/front_controller.rb +1 -1
- data/app/models/plugins/cama_contact_form/cama_contact_form.rb +2 -0
- data/app/views/plugins/cama_contact_form/admin_forms/responses.html.erb +1 -1
- data/lib/cama_contact_form/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56a1f3b2dbf7548b7d7df03c022f6c8a579efda2
|
4
|
+
data.tar.gz: 60a0c6fd4f812006e731645706e6b2c441a80a8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 09fb7126f7fc4ba29ddd34897452cc8f8c299f325f63914c47e40faea0bad9694d91c5a0cfdec9ac28116b12fc287ffd7a572f2152318bd64c00a5cf3befa1cd
|
7
|
+
data.tar.gz: 609643dd8b917db9f669353a0cf418827416196174d33276c2440c9bbc88560392e3fbccc86484d133184117d530b1f547a61176983065e2e6ac9965784ff703
|
@@ -73,7 +73,7 @@ module Plugins::CamaContactForm::ContactFormControllerConcern
|
|
73
73
|
elsif field[:field_type] == 'captcha'
|
74
74
|
values[label] << '--'
|
75
75
|
elsif field[:field_type] == 'radio' || field[:field_type] == 'checkboxes'
|
76
|
-
values[label] << fields[cid].join(',') if fields[cid].present?
|
76
|
+
values[label] << fields[cid].map { |f| f.to_s.translate }.join(', ') if fields[cid].present?
|
77
77
|
else
|
78
78
|
values[label] << fields[cid] if fields[cid].present?
|
79
79
|
end
|
@@ -49,7 +49,7 @@ class Plugins::CamaContactForm::AdminFormsController < CamaleonCms::Apps::Plugin
|
|
49
49
|
add_breadcrumb I18n.t("plugins.cama_contact_form.list_responses", default: 'Contact form records')
|
50
50
|
@form = current_site.contact_forms.where({id: params[:admin_form_id]}).first
|
51
51
|
values = JSON.parse(@form.value).to_sym
|
52
|
-
@op_fields = values[:fields]
|
52
|
+
@op_fields = values[:fields].select{ |field| relevant_field? field }
|
53
53
|
@forms = current_site.contact_forms.where({parent_id: @form.id})
|
54
54
|
@forms = @forms.paginate(:page => params[:page], :per_page => current_site.admin_per_page)
|
55
55
|
end
|
@@ -72,4 +72,8 @@ class Plugins::CamaContactForm::AdminFormsController < CamaleonCms::Apps::Plugin
|
|
72
72
|
redirect_to cama_admin_path
|
73
73
|
end
|
74
74
|
end
|
75
|
+
|
76
|
+
def relevant_field?(field)
|
77
|
+
!%w(captcha submit button).include? field[:field_type]
|
78
|
+
end
|
75
79
|
end
|
@@ -17,7 +17,7 @@ class Plugins::CamaContactForm::FrontController < CamaleonCms::Apps::PluginsFron
|
|
17
17
|
flash[:contact_form][:error] = errors.join('<br>')
|
18
18
|
flash[:values] = fields.delete_if{|k, v| v.class.name == 'ActionDispatch::Http::UploadedFile' }
|
19
19
|
end
|
20
|
-
params[:format] == 'json' ? render(json: flash
|
20
|
+
params[:format] == 'json' ? render(json: flash.discard(:contact_form).to_hash) : (redirect_to :back)
|
21
21
|
end
|
22
22
|
|
23
23
|
end
|
@@ -10,6 +10,8 @@ class Plugins::CamaContactForm::CamaContactForm < ActiveRecord::Base
|
|
10
10
|
before_validation :before_validating
|
11
11
|
before_create :fix_save_settings
|
12
12
|
|
13
|
+
default_scope { order(created_at: :desc) }
|
14
|
+
|
13
15
|
# [{"label":"Untitled","field_type":"text","required":true,"field_options":{"size":"large","field_class":"Default"},"cid":"c2"},{"label":"Untitled","field_type":"paragraph","required":true,"field_options":{"size":"large","field_class":"Default"},"cid":"c6"},{"label":"Untitled","field_type":"captcha","required":true,"field_options":{"field_class":"Default"},"cid":"c10"},{"label":"Untitled","field_type":"checkboxes","required":true,"field_options":{"options":[{"label":"Default","checked":false},{"label":"Default","checked":false}],"field_class":"Default","description":"description\n"},"cid":"c12"}]
|
14
16
|
def fields
|
15
17
|
@_the_fields ||= JSON.parse(self.value || '{fields: []}').with_indifferent_access
|
@@ -33,7 +33,7 @@
|
|
33
33
|
<% if default[:field_type] == "file" %>
|
34
34
|
<td><%= link_to(value[:fields][cid], value[:fields][cid]) %></td>
|
35
35
|
<% elsif default[:field_type] == "radio" || default[:field_type] == "checkboxes" %>
|
36
|
-
<td><%= value[:fields][cid].map
|
36
|
+
<td><%= value[:fields][cid].map { |f| f.to_s.translate }.join(', ') if value[:fields][cid].present? %></td>
|
37
37
|
<% else %>
|
38
38
|
<td><%= value[:fields][cid] %></td>
|
39
39
|
<% end %>
|
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.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Owen Peredo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -126,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
126
|
version: '0'
|
127
127
|
requirements: []
|
128
128
|
rubyforge_project:
|
129
|
-
rubygems_version: 2.
|
129
|
+
rubygems_version: 2.6.10
|
130
130
|
signing_key:
|
131
131
|
specification_version: 4
|
132
132
|
summary: Contact Form Plugin for Camaleon CMS
|
@@ -168,4 +168,3 @@ test_files:
|
|
168
168
|
- test/dummy/README.rdoc
|
169
169
|
- test/integration/navigation_test.rb
|
170
170
|
- test/test_helper.rb
|
171
|
-
has_rdoc:
|