cama_contact_form 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +37 -0
- data/app/assets/javascripts/plugins/cama_contact_form/admin_editor.js.coffee +48 -0
- data/app/controllers/plugins/cama_contact_form/admin_forms_controller.rb +76 -0
- data/app/controllers/plugins/cama_contact_form/front_controller.rb +101 -0
- data/app/helpers/plugins/cama_contact_form/main_helper.rb +156 -0
- data/app/models/plugins/cama_contact_form/cama_contact_form.rb +43 -0
- data/app/views/plugins/cama_contact_form/admin_forms/_form.html.erb +24 -0
- data/app/views/plugins/cama_contact_form/admin_forms/_item_field.html.erb +72 -0
- data/app/views/plugins/cama_contact_form/admin_forms/edit.html.erb +183 -0
- data/app/views/plugins/cama_contact_form/admin_forms/index.html.erb +64 -0
- data/app/views/plugins/cama_contact_form/admin_forms/responses.html.erb +54 -0
- data/app/views/plugins/cama_contact_form/contact_form/_email_content.html.erb +19 -0
- data/app/views/plugins/cama_contact_form/forms_shorcode.html.erb +26 -0
- data/config/camaleon_plugin.json +29 -0
- data/config/initializers/custom_models.rb +5 -0
- data/config/locales/es.yml +98 -0
- data/config/routes.rb +25 -0
- data/db/migrate/20160517143441_create_db_structure.rb +12 -0
- data/db/migrate/20160518193106_rename_plugin_name.rb +7 -0
- data/lib/cama_contact_form.rb +4 -0
- data/lib/cama_contact_form/engine.rb +4 -0
- data/lib/cama_contact_form/version.rb +3 -0
- data/lib/tasks/cama_contact_form_tasks.rake +4 -0
- data/test/cama_contact_form_test.rb +7 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +29 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +26 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +41 -0
- data/test/dummy/config/environments/production.rb +79 -0
- data/test/dummy/config/environments/test.rb +42 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +56 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/integration/navigation_test.rb +8 -0
- data/test/test_helper.rb +20 -0
- metadata +171 -0
@@ -0,0 +1,43 @@
|
|
1
|
+
class Plugins::CamaContactForm::CamaContactForm < ActiveRecord::Base
|
2
|
+
self.table_name = 'plugins_contact_forms'
|
3
|
+
belongs_to :site, class_name: "CamleonCms::Site"
|
4
|
+
# attr_accessible :site_id, :name, :description, :count, :slug, :value, :settings, :parent_id
|
5
|
+
|
6
|
+
has_many :responses, :class_name => "Plugins::CamaContactForm::CamaContactForm", :foreign_key => :parent_id, dependent: :destroy
|
7
|
+
validates :name, presence: true
|
8
|
+
validates_uniqueness_of :slug, scope: :site_id
|
9
|
+
|
10
|
+
before_validation :before_validating
|
11
|
+
before_create :fix_save_settings
|
12
|
+
|
13
|
+
# [{"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
|
+
def fields
|
15
|
+
@_the_fields ||= JSON.parse(self.value || '{fields: []}').with_indifferent_access
|
16
|
+
@_the_fields[:fields]
|
17
|
+
end
|
18
|
+
|
19
|
+
def the_settings
|
20
|
+
@_the_settings ||= JSON.parse(self.settings || '{}').with_indifferent_access
|
21
|
+
end
|
22
|
+
|
23
|
+
def the_message(key, default)
|
24
|
+
r = self.the_settings[:railscf_message][key].to_s.translate
|
25
|
+
r.present? ? r : default
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.field_template
|
29
|
+
"<div class='form-group'>\n\t <label>[label ci]</label>\n\t<p>[descr ci]</p>\n\t<div>[ci]</div> \n</div>"
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
def before_validating
|
34
|
+
slug = self.slug
|
35
|
+
slug = self.name if slug.blank?
|
36
|
+
self.slug = slug.to_s.parameterize
|
37
|
+
end
|
38
|
+
|
39
|
+
def fix_save_settings
|
40
|
+
self.value = {"fields" => []}.to_json unless self.value.present?
|
41
|
+
self.settings = {}.to_json unless self.settings.present?
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<% @form = current_site.contact_forms.new if @form.nil? %>
|
2
|
+
<%= form_for @form, url:{action: @form.new_record? ? :create : :update}, html:{class: 'validate-forms cama_ajax_request'} do |f| %>
|
3
|
+
<input id="plugins_contact_form_models_contact_form_site_id" type="hidden" name="plugins_contact_form_models_contact_form[site_id]" value="<%= current_site.id %>" />
|
4
|
+
<%= f.hidden_field :id %>
|
5
|
+
<div class="panel-body">
|
6
|
+
<div class="form-group">
|
7
|
+
<%= f.label t('.name', default: 'Title') %><br>
|
8
|
+
<%= f.text_field :name, :class => "form-control required" %>
|
9
|
+
</div>
|
10
|
+
<div class="form-group">
|
11
|
+
<%= f.label t('.slug', default: 'Slug') %><br>
|
12
|
+
<%= f.text_field :slug, :class => "form-control slug", "data-parent" => "plugins_cama_contact_form_cama_contact_form_name" %>
|
13
|
+
</div>
|
14
|
+
<div class="form-group">
|
15
|
+
<%= f.label t('.description', default: 'Description') %><br>
|
16
|
+
<%= f.text_area :description, :class => "form-control", :rows => 4 %>
|
17
|
+
</div>
|
18
|
+
</div>
|
19
|
+
|
20
|
+
<div class="panel-footer">
|
21
|
+
<button class="btn btn-primary pull-right" type="submit"><%= t('.submit_btn', default: 'Create Form') %></button>
|
22
|
+
</div>
|
23
|
+
<% end %>
|
24
|
+
|
@@ -0,0 +1,72 @@
|
|
1
|
+
<%
|
2
|
+
@_plugin_fields_counter||= 1; id = "field_#{@_plugin_fields_counter+=1}"
|
3
|
+
field = (field || {field_options: {}, field_type: field_type}).with_indifferent_access
|
4
|
+
cid = field[:cid] || cid
|
5
|
+
%>
|
6
|
+
<li class="panel panel-default panel-success panel-item" id="<%= id %>">
|
7
|
+
<%= hidden_field_tag "fields[#{cid}][field_type]", field[:field_type] %>
|
8
|
+
<div class="panel-heading">
|
9
|
+
<h3 class="panel-title"><span class="span-title"><%= t("plugins.cama_contact_form.admin_forms.edit.fields.#{field[:field_type]}", default: field[:field_type].titleize) %></span> <i><small>[<%= cid %>]</small></i></h3>
|
10
|
+
<ul class="panel-controls">
|
11
|
+
<li><a data-placement="left" data-toggle="tooltip" title="" href="#" class="panel-sortable" data-original-title="Sortable"><span class="fa fa-arrows"></span></a></li>
|
12
|
+
<li><a data-placement="left" data-toggle="tooltip" title="" href="#" class="panel-delete" data-original-title="Delete"><span class="fa fa-times text-danger"></span></a></li>
|
13
|
+
<li><a href="#" class="panel-collapse" data-original-title="" title=""><span class="fa fa-angle-up"></span></a></li>
|
14
|
+
</ul>
|
15
|
+
</div>
|
16
|
+
<div class="panel-body">
|
17
|
+
<%= hidden_field_tag "fields[#{cid}][cid]", cid %>
|
18
|
+
<div class="form-group ">
|
19
|
+
<label for=""><%= t('.label') %></label><br>
|
20
|
+
<%= text_field_tag "fields[#{cid}][label]", field[:label], class: 'form-control translatable' %>
|
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>
|
27
|
+
<div class="form-group ">
|
28
|
+
<label><%= t('.descr', default: 'Description') %></label><br>
|
29
|
+
<%= text_area_tag "fields[#{cid}][field_options][description]", field[:field_options][:description], class: 'form-control translatable' %>
|
30
|
+
</div>
|
31
|
+
<% case field[:field_type] %>
|
32
|
+
<% when 'checkboxes', 'radio', 'select', 'dropdown'; options = (field[:field_options][:options] || []) %>
|
33
|
+
<label><%= t('.options', default: 'Options') %></label>
|
34
|
+
<ul class="options_sortable" data-options-count="<%= options.size %>">
|
35
|
+
<% options.unshift({label: '', checked: false}).each_with_index do |option, index| %>
|
36
|
+
<li class="<%= 'hidden' if index == 0 %>">
|
37
|
+
<div class="actions">
|
38
|
+
<i class="fa fa-arrows options-sortable" style="cursor: move"></i> <i class="fa fa-times text-danger option-delete" style="cursor: pointer"></i>
|
39
|
+
</div>
|
40
|
+
<div class="inputs input-group">
|
41
|
+
<%= text_field_tag "fields[#{cid}][field_options][options][#{index}][label]", option[:label], class: 'form-control required translatable', placeholder: t('.here_label', default: 'Here your label'), disabled: index == 0 %>
|
42
|
+
<div class="input-group-addon" style="border: none">
|
43
|
+
<label>
|
44
|
+
<%= check_box_tag "fields[#{cid}][field_options][options][#{index}][checked]", true, option[:checked].to_s.cama_true?, class: '', disabled: index == 0 %> <%= t('.default', default: 'Default') %>
|
45
|
+
</label>
|
46
|
+
</div>
|
47
|
+
</div>
|
48
|
+
</li>
|
49
|
+
<% end %>
|
50
|
+
</ul>
|
51
|
+
<button type="button" class="btn btn-default btn-xs add_option"><%= t('.add_option', default: 'Add Option') %></button>
|
52
|
+
<% end %>
|
53
|
+
<div>
|
54
|
+
<a class="btn btn-default btn-xs html_btn"><%= t('.html_code', default: 'HTML Code') %> <i class='fa fa-cog'></i></a>
|
55
|
+
<div class="hidden">
|
56
|
+
<hr>
|
57
|
+
<div class="form-group ">
|
58
|
+
<label><%= t('.custom_class', default: 'Custom Class') %></label><br>
|
59
|
+
<%= text_field_tag "fields[#{cid}][field_options][field_class]", field[:field_options][:field_class], class: 'form-control' %>
|
60
|
+
</div>
|
61
|
+
<div class="form-group">
|
62
|
+
<%= label_tag nil, t('.template', default: 'Template') %>
|
63
|
+
<%= text_area_tag "fields[#{cid}][field_options][template]", field[:field_options][:template], class: 'form-control', rows: 6, placeholder: Plugins::CamaContactForm::CamaContactForm::field_template %>
|
64
|
+
</div>
|
65
|
+
<div class="form-group">
|
66
|
+
<%= label_tag nil, t('.attributes', default: 'Field Attributes') %>
|
67
|
+
<%= text_field_tag "fields[#{cid}][field_options][field_attributes]", field[:field_options][:field_attributes], class: 'form-control', placeholder: '{"style": "color: red;", "data-my-attr": "xx"}' %>
|
68
|
+
</div>
|
69
|
+
</div>
|
70
|
+
</div>
|
71
|
+
</div>
|
72
|
+
</li>
|
@@ -0,0 +1,183 @@
|
|
1
|
+
<%= javascript_include_tag plugin_asset('admin_editor') %>
|
2
|
+
<% @form = current_site.contact_forms.new if @form.nil? %>
|
3
|
+
<div class="page-title">
|
4
|
+
<h2><span class="fa fa-folder"></span> <%= t('plugin.contact_form.contact_form') %> - <%= @form.name %></h2>
|
5
|
+
</div>
|
6
|
+
<%= form_for @form, url:{action: @form.new_record? ? :create : :update} , role: 'form', html: { id: "contact_form_editor", class: "validate page-content-wrap row" } do |f| %>
|
7
|
+
<div class="col-md-12">
|
8
|
+
<div class="col-md-6">
|
9
|
+
<br>
|
10
|
+
<label><%= t('.shortcode_msg', default: 'Copy Shortcode')%>: </label>
|
11
|
+
<%= raw cama_shortcode_print(cama_form_shortcode(@form.slug)) %>
|
12
|
+
</div>
|
13
|
+
<div class="col-md-6 text-right">
|
14
|
+
<a class="btn btn-default" href="<%= url_for action: :index %>"><%= t('.back_btn', default: 'Back to List') %></a>
|
15
|
+
<button class="btn btn-primary" type="submit"><%= t('.submit_btn', default: 'Save Changes') %></button>
|
16
|
+
</div>
|
17
|
+
</div>
|
18
|
+
<div class="clearfix"></div>
|
19
|
+
<div class="col-md-4">
|
20
|
+
<div class="panel panel-default">
|
21
|
+
<div class="panel-heading">
|
22
|
+
<h3 class="panel-title"><%= t('.form_details', default: 'Formulario de Contacto') %></h3>
|
23
|
+
<ul class="panel-controls">
|
24
|
+
<li><a href="#" class="panel-collapse"><span class="fa fa-angle-down"></span></a></li>
|
25
|
+
</ul>
|
26
|
+
</div>
|
27
|
+
<div class="panel-body">
|
28
|
+
<div class="">
|
29
|
+
<div class="form-group">
|
30
|
+
<%= f.label nil, "#{t('.name', default: 'Título')} <abbr title='required'>*</abbr>".html_safe, :class => "" %><br>
|
31
|
+
<%= f.text_field :name, :class => "form-control required", style: "" %>
|
32
|
+
</div>
|
33
|
+
|
34
|
+
<div class="form-group">
|
35
|
+
<%= f.label nil, "#{t('.slug', default: 'Código')} <abbr title=\"required\">*</abbr>".html_safe, :class => "" %>
|
36
|
+
<%= f.text_field :slug, :class => "form-control slug required", "data-parent" => "plugins_contact_form_models_contact_form_name", style: "" %>
|
37
|
+
</div>
|
38
|
+
<div>
|
39
|
+
<a class="btn btn-default btn-xs html_btn"><%= t('.html_code') %> <i class='fa fa-cog'></i></a>
|
40
|
+
<div class="hidden">
|
41
|
+
<hr>
|
42
|
+
<div class="form-group">
|
43
|
+
<%= label_tag nil, t('.before_code', default: 'Code HTML before Form') %>
|
44
|
+
<%= text_area_tag 'railscf_mail[previous_html]', (@form.the_settings[:railscf_mail][:previous_html] rescue ''), class: 'form-control' %>
|
45
|
+
</div>
|
46
|
+
<div class="form-group">
|
47
|
+
<%= label_tag nil, t('.after_code', default: 'Code HTML after Form') %>
|
48
|
+
<%= text_area_tag 'railscf_mail[after_html]', (@form.the_settings[:railscf_mail][:after_html] rescue ''), class: 'form-control' %>
|
49
|
+
</div>
|
50
|
+
</div>
|
51
|
+
</div>
|
52
|
+
</div>
|
53
|
+
</div>
|
54
|
+
</div>
|
55
|
+
|
56
|
+
<div class="panel panel-default">
|
57
|
+
<div class="panel-heading">
|
58
|
+
<h3 class="panel-title"><%= t('.form_notification_email_settings', default: 'Notification Email Settings') %></h3>
|
59
|
+
<ul class="panel-controls">
|
60
|
+
<li><a href="#" class="panel-collapse"><span class="fa fa-angle-down"></span></a></li>
|
61
|
+
</ul>
|
62
|
+
</div>
|
63
|
+
<div class="panel-body">
|
64
|
+
<div class="">
|
65
|
+
<div class="form-group">
|
66
|
+
<label for="railscf_mail_to"><%= t('.to', default: 'Email') %> <abbr title="required">*</abbr>:</label><br>
|
67
|
+
<input id="railscf_mail_to" class="form-control required" type="text" name="railscf_mail[to]" value="<%= @form.the_settings[:railscf_mail][:to] rescue '' %>" />
|
68
|
+
</div>
|
69
|
+
|
70
|
+
<div class="form-group">
|
71
|
+
<label for="railscf_mail_subject"><%= t('.subject', default: 'Subject') %> <abbr title="required">*</abbr>:</label><br>
|
72
|
+
<input id="railscf_mail_subject" class="form-control translatable required" type="text" name="railscf_mail[subject]" value="<%= @form.the_settings[:railscf_mail][:subject] rescue '' %>" />
|
73
|
+
</div>
|
74
|
+
|
75
|
+
<div class="form-group">
|
76
|
+
<label for="railscf_mail_body"><%= t('.body', default: 'Email message to prepend') %>:</label><br>
|
77
|
+
<textarea rows="4" cols="5" id="railscf_mail_body" class="form-control translatable" name="railscf_mail[body]"><%= @form.the_settings[:railscf_mail][:body] rescue t('plugin.contact_form.body_value') %></textarea>
|
78
|
+
</div>
|
79
|
+
<div class="form-group hidden">
|
80
|
+
<label><%= t('.name_button') %>:</label>
|
81
|
+
<input class="form-control" type="text" name="railscf_form_button[name_button]" value="<%= @form.the_settings[:railscf_form_button][:name_button] rescue 'Send' %>">
|
82
|
+
</div>
|
83
|
+
</div>
|
84
|
+
</div>
|
85
|
+
</div>
|
86
|
+
|
87
|
+
<div class="panel panel-default">
|
88
|
+
<div class="panel-heading">
|
89
|
+
<h3 class="panel-title"><%= t('.confirmation_email_settings', default: 'Confirmation Email Settings') %></h3>
|
90
|
+
<ul class="panel-controls">
|
91
|
+
<li><a href="#" class="panel-collapse"><span class="fa fa-angle-down"></span></a></li>
|
92
|
+
</ul>
|
93
|
+
</div>
|
94
|
+
<div class="panel-body">
|
95
|
+
<p><small><i><%= t('.confirmation_email_descr', default: 'You can use the code of fields to represent the value of this fields. Sample: Hello [c1]') %></i></small></p>
|
96
|
+
<div class="">
|
97
|
+
<div class="form-group">
|
98
|
+
<label><%= t('.to', default: 'Send Confirmation To') %>:</label><br>
|
99
|
+
<input class="form-control" type="text" name="railscf_mail[to_answer]" value="<%= @form.the_settings[:railscf_mail][:to_answer] rescue '' %>" placeholder="[c1]" />
|
100
|
+
</div>
|
101
|
+
|
102
|
+
<div class="form-group">
|
103
|
+
<label><%= t('.subject', default: 'Subject') %>:</label><br>
|
104
|
+
<input class="form-control translatable required" type="text" name="railscf_mail[subject_answer]" value="<%= @form.the_settings[:railscf_mail][:subject_answer] rescue '' %>" />
|
105
|
+
</div>
|
106
|
+
|
107
|
+
<div class="form-group">
|
108
|
+
<label><%= t('.body_answer', default: 'Email message') %>:</label><br>
|
109
|
+
<textarea placeholder="Hi [c2], thanks for contact us" rows="4" cols="5" class="form-control translatable" name="railscf_mail[body_answer]"><%= @form.the_settings[:railscf_mail][:body_answer] rescue '' %></textarea>
|
110
|
+
</div>
|
111
|
+
</div>
|
112
|
+
</div>
|
113
|
+
</div>
|
114
|
+
|
115
|
+
<div class="panel panel-default panel-toggled">
|
116
|
+
<div class="panel-heading">
|
117
|
+
<h3 class="panel-title"><%= t('.form_settings_messages', default: 'Message Settings') %></h3>
|
118
|
+
<ul class="panel-controls">
|
119
|
+
<li><a href="#" class="panel-collapse"><span class="fa fa-angle-up"></span></a></li>
|
120
|
+
</ul>
|
121
|
+
</div>
|
122
|
+
<div class="panel-body">
|
123
|
+
<div class="">
|
124
|
+
<div class="form-group">
|
125
|
+
<p class="description"><label for="railscf_message_mail-sent-ok"><%= t('.success_form_msg', default: 'Success Message') %></label></p>
|
126
|
+
<input type="text" class="form-control translatable" name="railscf_message[mail_sent_ok]" id="railscf_message_mail_sent_ok" value="<%= @form.the_settings[:railscf_message][:mail_sent_ok] rescue '' %>" />
|
127
|
+
</div>
|
128
|
+
<div class="form-group">
|
129
|
+
<p class="description"><label for="railscf_message_mail-sent-ng"><%= t('.error_form_msg', default: 'Error Message') %></label></p>
|
130
|
+
<input type="text" class="form-control translatable" name="railscf_message[mail_sent_ng]" id="railscf_message_mail_sent_ng" value="<%= @form.the_settings[:railscf_message][:mail_sent_ng] rescue '' %>" />
|
131
|
+
</div>
|
132
|
+
<!--<div class="form-group">-->
|
133
|
+
<!--<p class="description"><label for="railscf_message_validation-error"><%#= t('.error_validation_msg', default: 'Error validation message') %></label></p>-->
|
134
|
+
<!--<input type="text" class="form-control translatable" name="railscf_message[validation_error]" id="railscf_message_validation_error" value="<%#= @form.the_settings[:railscf_message][:validation_error] rescue '' %>"/>-->
|
135
|
+
<!--</div>-->
|
136
|
+
<div class="form-group">
|
137
|
+
<p class="description"><label for="railscf_message_invalid-required"><%= t('.error_required_msg', default: 'Error required message') %></label></p>
|
138
|
+
<input type="text" class="form-control translatable" name="railscf_message[invalid_required]" id="railscf_message_invalid_required" value="<%= @form.the_settings[:railscf_message][:invalid_required] rescue '' %>" />
|
139
|
+
</div>
|
140
|
+
<div class="form-group">
|
141
|
+
<p class="description"><label for="railscf_message_invalid-email"><%= t('.email_invalid_msg', default: 'Invalid email message') %></label></p>
|
142
|
+
<input type="text" class="form-control translatable" name="railscf_message[invalid_email]" id="railscf_message_invalid_email" value="<%= @form.the_settings[:railscf_message][:invalid_email] rescue '' %>"/>
|
143
|
+
</div>
|
144
|
+
<div class="form-group">
|
145
|
+
<p class="description"><label for="railscf_message_captcha-not-match"><%= t('.captch_error_msg', default: 'Invalid captcha message') %></label></p>
|
146
|
+
<input type="text" class="form-control translatable" name="railscf_message[captcha_not_match]" id="railscf_message_captcha_not_match" value="<%= @form.the_settings[:railscf_message][:captcha_not_match] rescue '' %>"/>
|
147
|
+
</div>
|
148
|
+
</div>
|
149
|
+
</div>
|
150
|
+
</div>
|
151
|
+
</div>
|
152
|
+
<div class="col-md-5">
|
153
|
+
<div class="panel panel-default">
|
154
|
+
<div class="panel-heading">
|
155
|
+
<h3 class="panel-title"><%= t('.my_fields', default: 'Fields') %></h3>
|
156
|
+
</div>
|
157
|
+
<ul class="panel-body" id="my_fields" data-cid="<%= @form.fields.map{|field| field[:cid].scan(/\d/).join('').to_i }.max || 1 %>">
|
158
|
+
<% @form.fields.each do |field| %>
|
159
|
+
<%= render 'item_field', field: field %>
|
160
|
+
<% end %>
|
161
|
+
</ul>
|
162
|
+
</div>
|
163
|
+
</div>
|
164
|
+
<div class="col-md-3">
|
165
|
+
<div class="panel panel-default">
|
166
|
+
<div class="panel-heading">
|
167
|
+
<h3 class="panel-title"><%= t('.all_fields', default: 'Available Fields') %></h3>
|
168
|
+
</div>
|
169
|
+
<div class="panel-body" id="fields_available" data-remote_url="<%= item_field_admin_plugins_cama_contact_form_admin_forms_url %>">
|
170
|
+
<a class="btn btn-default" data-field-type="text" ><span class="fa fa-font"></span> <%= t('.fields.text', default: 'Text Box') %></a>
|
171
|
+
<a class="btn btn-default" data-field-type="paragraph" > <span class="symbol">¶</span> <%= t('.fields.paragraph', default: 'TextArea') %> </a>
|
172
|
+
<a class="btn btn-default" data-field-type="checkboxes" > <span class="symbol"><span class="fa fa-square-o"></span></span> <%= t('.fields.checkboxes', default: 'Checkboxes') %> </a>
|
173
|
+
<a class="btn btn-default" data-field-type="radio" ><span class="fa fa-circle-o"></span> <%= t('.fields.radio', default: 'Radio Button') %></a>
|
174
|
+
<a class="btn btn-default" data-field-type="dropdown" ><span class="fa fa-caret-down"></span> <%= t('.fields.dropdown', default: 'Select') %></a>
|
175
|
+
<a class="btn btn-default" data-field-type="website" ><span class="fa fa-link"></span> <%= t('.fields.website', default: 'Website') %></a>
|
176
|
+
<a class="btn btn-default" data-field-type="email" ><span class="fa fa-envelope-o"></span> <%= t('.fields.email', default: 'Email') %></a>
|
177
|
+
<a class="btn btn-default" data-field-type="captcha" ><span class="symbol"><span class="glyphicon glyphicon-barcode"></span></span> <%= t('.fields.captcha', default: 'Captcha') %> </a>
|
178
|
+
<a class="btn btn-default" data-field-type="file" ><span class="fa fa-cloud-upload"></span> <%= t('.fields.captcha', default: 'Upload File') %></a>
|
179
|
+
<a class="btn btn-default" data-field-type="submit" ><span class="fa fa-button"></span> <%= t('.fields.submit', default: 'Submit Button') %></a>
|
180
|
+
</div>
|
181
|
+
</div>
|
182
|
+
</div>
|
183
|
+
<% end %>
|
@@ -0,0 +1,64 @@
|
|
1
|
+
<div class="page-title">
|
2
|
+
<h2><span class="fa fa-archive"></span> <%= t('.title', default: 'Contact Form') %></h2>
|
3
|
+
</div>
|
4
|
+
<div class="page-content-wrap">
|
5
|
+
|
6
|
+
<div class="row">
|
7
|
+
<div class="col-md-4">
|
8
|
+
<div class="panel panel-default">
|
9
|
+
<div class="panel-heading ui-draggable-handle">
|
10
|
+
<h3 class="panel-title"><%= t('.title_form', default: 'New Contact Form') %></h3>
|
11
|
+
</div>
|
12
|
+
<%= render partial: 'form' %>
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
<div class="col-md-8">
|
16
|
+
|
17
|
+
<!-- START BASIC TABLE SAMPLE -->
|
18
|
+
<div class="panel panel-default">
|
19
|
+
<div class="panel-heading ui-draggable-handle">
|
20
|
+
<h3 class="panel-title"><%= t('.list_forms', default: 'Forms List') %></h3>
|
21
|
+
</div>
|
22
|
+
<div class="panel-body">
|
23
|
+
|
24
|
+
<table class="table">
|
25
|
+
<thead>
|
26
|
+
<tr>
|
27
|
+
<th><%= t('.name', default: 'Name') %></th>
|
28
|
+
<th><%= t('.form.description', default: 'Description') %></th>
|
29
|
+
<th><%= t('.slug', default: 'Slug') %></th>
|
30
|
+
<th><%= t('.shortcode', default: 'Shortcode') %></th>
|
31
|
+
<th><%= t('.count', default: 'Items') %></th>
|
32
|
+
<th><%= t('.actions', default: 'Actions') %></th>
|
33
|
+
</tr>
|
34
|
+
</thead>
|
35
|
+
|
36
|
+
<tbody>
|
37
|
+
<% @forms.each do |item| %>
|
38
|
+
<tr>
|
39
|
+
<td> <%= item.name %> </td>
|
40
|
+
<td><%= item.description %></td>
|
41
|
+
<td><%= item.slug %></td>
|
42
|
+
<td><%= cama_form_shortcode(item.slug)%></td>
|
43
|
+
<td><%= item.responses.count %></td>
|
44
|
+
<td>
|
45
|
+
<%= link_to raw("<i class='fa fa-list-alt'></i> "), url_for(action: :responses, admin_form_id: item.id), class: "btn btn-info btn-xs cama_ajax_request", title: "#{t('.list_responses', default: 'Form Items')}" %>
|
46
|
+
<%= link_to raw('<i class="fa fa-pencil"></i>'), {action: :edit, id: item.id }, class: "btn btn-default btn-xs cama_ajax_request", title: "#{t('.edit', default: 'Edit Form')}" %>
|
47
|
+
<%= link_to raw('<i class="fa fa-times"></i>'), { action: :destroy, id: item.id },method: :delete, data: { confirm: "#{t('.msg_confirm', default: 'Are you sure to delete this form?')}" }, class: "btn btn-danger btn-xs", title: "#{ t('.delete', default: 'Delete Form')}" %>
|
48
|
+
|
49
|
+
</td>
|
50
|
+
</tr>
|
51
|
+
<% end %>
|
52
|
+
|
53
|
+
</tbody>
|
54
|
+
</table>
|
55
|
+
<%= content_tag("div", raw(t('plugin.contact_form.msg_data_found_list', default: 'No records found')), class: "alert alert-warning") if @forms.empty? %>
|
56
|
+
<%= raw cama_do_pagination(@forms) %>
|
57
|
+
</div>
|
58
|
+
</div>
|
59
|
+
<!-- END BASIC TABLE SAMPLE -->
|
60
|
+
</div>
|
61
|
+
</div>
|
62
|
+
|
63
|
+
<!-- END PAGE CONTENT WRAPPER -->
|
64
|
+
</div>
|
@@ -0,0 +1,54 @@
|
|
1
|
+
<div class="page-content-wrap" id="contact_form_answers">
|
2
|
+
<div class="row">
|
3
|
+
<div class="col-md-12">
|
4
|
+
<!-- START BASIC TABLE SAMPLE -->
|
5
|
+
<div class="panel panel-default">
|
6
|
+
<div class="panel-heading">
|
7
|
+
<div class="row">
|
8
|
+
<div class="col-md-6">
|
9
|
+
<h3 class="panel-title"><span class="fa fa-archive"></span> <%= t('.list_responses', default: 'List of Items') %></h3>
|
10
|
+
</div>
|
11
|
+
<div class="col-md-6 text-right">
|
12
|
+
<a class="btn btn-default" href="<%= url_for action: :index %>"><%= t('.back_btn', default: 'Back') %></a>
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
<div class="panel-body">
|
17
|
+
|
18
|
+
<table class="table">
|
19
|
+
<thead>
|
20
|
+
<tr>
|
21
|
+
<% @op_fields.each do |f| %>
|
22
|
+
<th><%= f[:label].to_s.translate %></th>
|
23
|
+
<% end %>
|
24
|
+
<th><%= t('.created_at', default: 'Registered at') %></th>
|
25
|
+
</tr>
|
26
|
+
</thead>
|
27
|
+
<tbody>
|
28
|
+
<% @forms.each do |form| %>
|
29
|
+
<% value = (JSON.parse(form.settings).to_sym rescue form.value) %>
|
30
|
+
<tr>
|
31
|
+
<% @op_fields.each do |default| %>
|
32
|
+
<% cid = default[:cid].to_sym %>
|
33
|
+
<% if default[:field_type] == "file" %>
|
34
|
+
<td><%= link_to(value[:fields][cid], value[:fields][cid]) %></td>
|
35
|
+
<% elsif default[:field_type] == "radio" || default[:field_type] == "checkboxes" %>
|
36
|
+
<td><%= value[:fields][cid].map(&:inspect).join(', ') if value[:fields][cid].present? %></td>
|
37
|
+
<% else %>
|
38
|
+
<td><%= value[:fields][cid] %></td>
|
39
|
+
<% end %>
|
40
|
+
<% end %>
|
41
|
+
<td><%= value[:created_at] %></td>
|
42
|
+
</tr>
|
43
|
+
<% end %>
|
44
|
+
</tbody>
|
45
|
+
</table>
|
46
|
+
<%= content_tag("div", raw("#{t('camaleon_cms.admin.message.data_found_list', default: 'No items found')}"), class: "alert alert-warning") if @forms.empty? %>
|
47
|
+
<%= raw cama_do_pagination(@forms) %>
|
48
|
+
</div>
|
49
|
+
</div>
|
50
|
+
<!-- END BASIC TABLE SAMPLE -->
|
51
|
+
</div>
|
52
|
+
</div>
|
53
|
+
<!-- END PAGE CONTENT WRAPPER -->
|
54
|
+
</div>
|