cama_contact_form 0.0.1
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 +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,19 @@
|
|
1
|
+
<div>
|
2
|
+
<%= raw message_body %>
|
3
|
+
</div>
|
4
|
+
<div class="data_body">
|
5
|
+
<table style="width: 100%; float: left;">
|
6
|
+
<tbody>
|
7
|
+
<tr>
|
8
|
+
<td style="width: 50%; float: left">
|
9
|
+
<% fields.each do |key, value| %>
|
10
|
+
<div class="data_field">
|
11
|
+
<strong><%= key %>:</strong>
|
12
|
+
<%= value[0] %>
|
13
|
+
</div>
|
14
|
+
<% end %>
|
15
|
+
</td>
|
16
|
+
</tr>
|
17
|
+
</tbody>
|
18
|
+
</table>
|
19
|
+
</div>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<%
|
2
|
+
@form = attributes['slug'] == '__first__' ? current_site.contact_forms.first : current_site.contact_forms.where({slug: attributes['slug']}).first
|
3
|
+
if @form.present?
|
4
|
+
values_fields = (flash[:values].present?)? flash[:values].to_sym : {}
|
5
|
+
values = JSON.parse(@form.value).to_sym
|
6
|
+
settings = JSON.parse(@form.settings).to_sym
|
7
|
+
r = {form: @form, form_class: "railscf-form railscf-form-group", before_form: "", after_form: "", submit: "<div class='form-group'>
|
8
|
+
<button class='submit_btn btn btn-default pull-right' type='submit'>[submit_label]</button>
|
9
|
+
</div>"}
|
10
|
+
hooks_run("contact_form_render", r)
|
11
|
+
%>
|
12
|
+
<section>
|
13
|
+
<%= raw r[:before_form] %>
|
14
|
+
<%= form_for @form, url: plugins_cama_contact_form_save_form_path, html: {method: "post", class: r[:form_class], multipart: true} do |f| %>
|
15
|
+
|
16
|
+
<%= hidden_field_tag "id", @form.id %>
|
17
|
+
<%= render :partial => "camaleon_cms/flash_messages" %>
|
18
|
+
<%= raw cama_form_element_bootstrap_object(r[:form], values[:fields], values_fields) %>
|
19
|
+
<% if values[:fields].present? && !values[:fields].delete_if{|field| field[:field_type] != 'submit' }.present? %>
|
20
|
+
<%= raw r[:submit].sub('[submit_label]', settings[:railscf_form_button][:name_button])%>
|
21
|
+
<% end %>
|
22
|
+
<%= raw front_editor_link(edit_admin_plugins_cama_contact_form_admin_form_url(@form.id)) rescue "" %>
|
23
|
+
<% end %>
|
24
|
+
<%= raw r[:after_form] %>
|
25
|
+
</section>
|
26
|
+
<% end %>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
{
|
2
|
+
"title": "Camaleon CMS Contact Form",
|
3
|
+
"descr": "Please check documentation <a href='http://camaleon.tuzitio.com/store/plugins/4'>here.</a>",
|
4
|
+
"key": "cama_contact_form",
|
5
|
+
"helpers": [
|
6
|
+
"Plugins::CamaContactForm::MainHelper"
|
7
|
+
],
|
8
|
+
"hooks": {
|
9
|
+
"admin_before_load": [
|
10
|
+
"contact_form_admin_before_load"
|
11
|
+
],
|
12
|
+
"on_destroy": [
|
13
|
+
"contact_form_on_destroy"
|
14
|
+
],
|
15
|
+
"on_active": [
|
16
|
+
"contact_form_on_active"
|
17
|
+
],
|
18
|
+
"on_inactive": [
|
19
|
+
"contact_form_on_inactive"
|
20
|
+
],
|
21
|
+
"app_before_load":
|
22
|
+
["contact_form_app_before_load"],
|
23
|
+
"front_before_load":
|
24
|
+
["contact_form_front_before_load"],
|
25
|
+
"on_export": ["contact_form_on_export"],
|
26
|
+
"on_import": ["contact_form_on_import"]
|
27
|
+
//here you can add all your hooks (read documentation)
|
28
|
+
}
|
29
|
+
}
|
@@ -0,0 +1,98 @@
|
|
1
|
+
es:
|
2
|
+
plugins:
|
3
|
+
cama_contact_form:
|
4
|
+
title: 'Formulario de Contacto'
|
5
|
+
list_responses: 'Lista de Registros'
|
6
|
+
edit_view: 'Edición de Formulario'
|
7
|
+
admin_forms:
|
8
|
+
index:
|
9
|
+
title: 'Formulario de Contacto'
|
10
|
+
list_forms: 'Lista de Formularios de Contacto'
|
11
|
+
title_form: 'Nuevo Formulario'
|
12
|
+
name: 'Nombre'
|
13
|
+
slug: 'Código'
|
14
|
+
description: 'Descripción'
|
15
|
+
shortcode: 'Código Abreviado'
|
16
|
+
count: 'Registros'
|
17
|
+
actions: 'Acciones'
|
18
|
+
list_responses: 'Lista de Registros'
|
19
|
+
edit: 'Editar Formulario'
|
20
|
+
delete: 'Eliminar Formulario'
|
21
|
+
msg_confirm: 'Esta seguro de eliminar este formulario y todos sus registros?'
|
22
|
+
|
23
|
+
edit:
|
24
|
+
shortcode_msg: 'Copia el código abreviado'
|
25
|
+
submit_btn: 'Guardar Cambios'
|
26
|
+
back_btn: 'Volver al Listado'
|
27
|
+
html_code: 'Código HTML'
|
28
|
+
before_code: 'Código HTML antes del formulario'
|
29
|
+
after_code: 'Código HTML despues del formulario'
|
30
|
+
form_notification_email_settings: 'Configuración de notificación'
|
31
|
+
to: 'Correo a'
|
32
|
+
subject: 'Asunto'
|
33
|
+
body: 'Mensaje a agregar'
|
34
|
+
confirmation_email_settings: 'Configuración de confirmación'
|
35
|
+
confirmation_email_descr: 'Puedes usar los códigos de cada campo para representar los valores de estos. Ejemplo: Hola [c1]'
|
36
|
+
body_answer: 'Mensaje de confirmación'
|
37
|
+
|
38
|
+
form_settings_messages: 'Configuración de mensajes'
|
39
|
+
success_form_msg: 'Mensaje satisfactorio'
|
40
|
+
error_form_msg: 'Mensaje de error'
|
41
|
+
error_required_msg: 'Mensaje de error de campos requeridos'
|
42
|
+
email_invalid_msg: 'Mensaje de error de campos tipo correo'
|
43
|
+
captch_error_msg: 'Mensja de error de campos tipo código de seguridad'
|
44
|
+
|
45
|
+
my_fields: 'Campos del Formulario'
|
46
|
+
all_fields: 'Campos Disponibles'
|
47
|
+
|
48
|
+
fields:
|
49
|
+
submit: 'Boton de Enviar'
|
50
|
+
captcha: 'Código de Seguridad'
|
51
|
+
checkboxes: 'Casillas'
|
52
|
+
radio: 'botón de opción'
|
53
|
+
dropdown: 'Selección'
|
54
|
+
website: 'Sitio web'
|
55
|
+
email: 'Correo Electrónico'
|
56
|
+
text: 'Area de Texto'
|
57
|
+
paragraph: 'Campo de Texto'
|
58
|
+
file: 'Subir Archivo'
|
59
|
+
item_field:
|
60
|
+
label: 'Etiqueta'
|
61
|
+
descr: 'Descripción'
|
62
|
+
is_required: 'Es requerido?'
|
63
|
+
options: 'Opciones'
|
64
|
+
here_label: 'Aquí tu etiqueta'
|
65
|
+
default: 'Por defecto'
|
66
|
+
add_option: 'Agregar opción'
|
67
|
+
html_code: 'Código HTML'
|
68
|
+
custom_class: 'Estilo Personalizado'
|
69
|
+
template: 'Plantilla'
|
70
|
+
attributes: 'Attributos del campo'
|
71
|
+
|
72
|
+
|
73
|
+
form:
|
74
|
+
name: 'Nombre'
|
75
|
+
slug: 'Código'
|
76
|
+
description: 'Descripción'
|
77
|
+
back_btn: 'Atras'
|
78
|
+
submit_btn: 'Crear'
|
79
|
+
|
80
|
+
responses:
|
81
|
+
back_btn: 'Volver al listado'
|
82
|
+
created_at: 'Fecha de Registro'
|
83
|
+
list_responses: 'Lista de Registros'
|
84
|
+
|
85
|
+
create:
|
86
|
+
created: 'Formulario creado correctamente'
|
87
|
+
destroy:
|
88
|
+
deleted: 'Formulario eliminado correctamente'
|
89
|
+
update:
|
90
|
+
updated_success: 'Formulario actualizado correctamente'
|
91
|
+
|
92
|
+
front:
|
93
|
+
save_form:
|
94
|
+
error_validation_val: 'Este valor es requerido'
|
95
|
+
email_invalid_val: 'Formato de correo electrónico in correcto'
|
96
|
+
captch_error_val: 'Error de código de seguridad'
|
97
|
+
success_form_val: 'Su mensaje a sido enviado satisfactoriamente. Muchas gracias!'
|
98
|
+
error_form_val: 'A ocurrido un error, por favor intente de nuevo'
|
data/config/routes.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
Rails.application.routes.draw do
|
2
|
+
|
3
|
+
scope PluginRoutes.system_info["relative_url_root"] do
|
4
|
+
scope '(:locale)', locale: /#{PluginRoutes.all_locales}/, :defaults => { } do
|
5
|
+
# frontend
|
6
|
+
namespace :plugins do
|
7
|
+
namespace 'cama_contact_form' do
|
8
|
+
post 'save_form' => "front#save_form"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
#Admin Panel
|
14
|
+
scope :admin, as: 'admin', path: PluginRoutes.system_info['admin_path_name'] do
|
15
|
+
namespace 'plugins' do
|
16
|
+
namespace 'cama_contact_form' do
|
17
|
+
resources :admin_forms do
|
18
|
+
get 'responses'
|
19
|
+
get 'item_field', on: :collection
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateDbStructure < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
unless table_exists? 'plugins_contact_forms'
|
4
|
+
create_table :plugins_contact_forms do |t|
|
5
|
+
t.integer :site_id, :count, :parent_id
|
6
|
+
t.string :name, :slug
|
7
|
+
t.text :description, :value, :settings
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
== README
|
2
|
+
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
4
|
+
application up and running.
|
5
|
+
|
6
|
+
Things you may want to cover:
|
7
|
+
|
8
|
+
* Ruby version
|
9
|
+
|
10
|
+
* System dependencies
|
11
|
+
|
12
|
+
* Configuration
|
13
|
+
|
14
|
+
* Database creation
|
15
|
+
|
16
|
+
* Database initialization
|
17
|
+
|
18
|
+
* How to run the test suite
|
19
|
+
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
21
|
+
|
22
|
+
* Deployment instructions
|
23
|
+
|
24
|
+
* ...
|
25
|
+
|
26
|
+
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
28
|
+
<tt>rake doc:app</tt>.
|
data/test/dummy/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any styles
|
10
|
+
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
11
|
+
* file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Dummy</title>
|
5
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
6
|
+
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
data/test/dummy/bin/rake
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
# path to your application root.
|
5
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
6
|
+
|
7
|
+
Dir.chdir APP_ROOT do
|
8
|
+
# This script is a starting point to setup your application.
|
9
|
+
# Add necessary setup steps to this file:
|
10
|
+
|
11
|
+
puts "== Installing dependencies =="
|
12
|
+
system "gem install bundler --conservative"
|
13
|
+
system "bundle check || bundle install"
|
14
|
+
|
15
|
+
# puts "\n== Copying sample files =="
|
16
|
+
# unless File.exist?("config/database.yml")
|
17
|
+
# system "cp config/database.yml.sample config/database.yml"
|
18
|
+
# end
|
19
|
+
|
20
|
+
puts "\n== Preparing database =="
|
21
|
+
system "bin/rake db:setup"
|
22
|
+
|
23
|
+
puts "\n== Removing old logs and tempfiles =="
|
24
|
+
system "rm -f log/*"
|
25
|
+
system "rm -rf tmp/cache"
|
26
|
+
|
27
|
+
puts "\n== Restarting application server =="
|
28
|
+
system "touch tmp/restart.txt"
|
29
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
Bundler.require(*Rails.groups)
|
6
|
+
require "cama_contact_form"
|
7
|
+
|
8
|
+
module Dummy
|
9
|
+
class Application < Rails::Application
|
10
|
+
# Settings in config/environments/* take precedence over those specified here.
|
11
|
+
# Application configuration should go into files in config/initializers
|
12
|
+
# -- all .rb files in that directory are automatically loaded.
|
13
|
+
|
14
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
15
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
16
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
17
|
+
|
18
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
19
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
20
|
+
# config.i18n.default_locale = :de
|
21
|
+
|
22
|
+
# Do not swallow errors in after_commit/after_rollback callbacks.
|
23
|
+
config.active_record.raise_in_transactional_callbacks = true
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|