noodall-form-builder 0.0.6 → 0.0.7
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.
- data/app/models/noodall/form.rb +8 -1
- data/app/views/form_mailer/_form_response_fields.html.erb +4 -1
- data/app/views/form_mailer/form_response.html.erb +18 -2
- data/app/views/form_mailer/form_response_thankyou.html.erb +31 -15
- data/app/views/noodall/admin/forms/index.html.erb +1 -1
- data/app/views/noodall/form_responses/_form.html.erb +4 -1
- data/lib/noodall/form_builder/version.rb +1 -1
- metadata +8 -8
data/app/models/noodall/form.rb
CHANGED
@@ -10,7 +10,14 @@ module Noodall
|
|
10
10
|
|
11
11
|
MANDATORY_FIELDS = ['Name','Email']
|
12
12
|
many :fields, :class => Noodall::Field
|
13
|
-
many :responses, :class => Noodall::FormResponse
|
13
|
+
many :responses, :class => Noodall::FormResponse do
|
14
|
+
def ham
|
15
|
+
self.select {|r| r.spaminess < (self.class.defensio_config['spam_threshold'] || 0.75)}
|
16
|
+
end
|
17
|
+
def spam
|
18
|
+
self.select {|r| r.spaminess >= (self.class.defensio_config['spam_threshold'] || 0.75)}
|
19
|
+
end
|
20
|
+
end
|
14
21
|
|
15
22
|
before_save :create_mandatory_fields!
|
16
23
|
|
@@ -1,3 +1,6 @@
|
|
1
1
|
<% for field in @form.fields %>
|
2
|
-
|
2
|
+
<tr>
|
3
|
+
<td><%= field.name %></td>
|
4
|
+
<td><%= @response.send(field.underscored_name) if @response.respond_to?(field.underscored_name) %></td>
|
5
|
+
</tr>
|
3
6
|
<% end %>
|
@@ -1,5 +1,21 @@
|
|
1
|
-
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
5
|
+
</head>
|
6
|
+
<body>
|
7
|
+
<p>Response from <%= @response.referrer %>,</p>
|
2
8
|
|
9
|
+
<table>
|
10
|
+
<thead>
|
11
|
+
<th>Field</th>
|
12
|
+
<th></th>
|
13
|
+
</thead>
|
14
|
+
<tbody>
|
3
15
|
<%= render 'form_mailer/form_response_fields' %>
|
16
|
+
</tbody>
|
17
|
+
</table>
|
4
18
|
|
5
|
-
Sent from: <%= @response.ip %> at <%= @response.created_at.to_formatted_s(:long_dot)
|
19
|
+
<p>Sent from: <%= @response.ip %> at <%= @response.created_at.to_formatted_s(:long_dot) %></p>
|
20
|
+
</body>
|
21
|
+
</html>
|
@@ -1,19 +1,35 @@
|
|
1
|
-
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
5
|
+
</head>
|
6
|
+
<body>
|
7
|
+
<p>Dear <%= "#{@response.name}" %>,</p>
|
2
8
|
|
3
|
-
Thank you for getting in contact
|
9
|
+
<p>Thank you for getting in contact.</p>
|
4
10
|
|
5
|
-
We will be in touch shortly
|
6
|
-
|
7
|
-
Regards
|
11
|
+
<p>We will be in touch shortly.</p>
|
8
12
|
|
13
|
+
<p>Regards<br />
|
9
14
|
<%= Noodall::UI.app_name %>
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
To: <%= @form.email
|
16
|
-
From: <%= @response.email
|
17
|
-
Subject: <%= "#{Noodall::UI.app_name}: Response to the #{@form.title} form."
|
18
|
-
|
19
|
-
|
15
|
+
</p>
|
16
|
+
|
17
|
+
|
18
|
+
<p>
|
19
|
+
<strong>Original message</strong><br />
|
20
|
+
To: <%= @form.email %><br />
|
21
|
+
From: <%= @response.email %><br />
|
22
|
+
Subject: <%= "#{Noodall::UI.app_name}: Response to the #{@form.title} form." %><br />
|
23
|
+
</p>
|
24
|
+
|
25
|
+
<table>
|
26
|
+
<thead>
|
27
|
+
<th>Field</th>
|
28
|
+
<th></th>
|
29
|
+
</thead>
|
30
|
+
<tbody>
|
31
|
+
<%= render 'form_mailer/form_response_fields' %>
|
32
|
+
</tbody>
|
33
|
+
</table>
|
34
|
+
</body>
|
35
|
+
</html>
|
@@ -22,7 +22,7 @@
|
|
22
22
|
<td class="edit"><%= link_to h(form.title), noodall_admin_form_path(form), :class => 'edit', :title => "Edit #{form.title}" %></td>
|
23
23
|
<td><%= form.email %></td>
|
24
24
|
<td class="child">
|
25
|
-
<%= link_to pluralize(form.responses.size, "Response"), noodall_admin_form_form_responses_path(form), :title => "View responses for #{h(form.title)}", :class => 'child-no' %> <%= link_to 'Download Responses', noodall_admin_form_form_responses_path(form, :csv), :class => 'download', :title => 'Download the responses for this form in CSV format' %></td>
|
25
|
+
<%= link_to pluralize(form.responses.ham.size, "Response"), noodall_admin_form_form_responses_path(form), :title => "View responses for #{h(form.title)}", :class => 'child-no' %> <%= link_to 'Download Responses', noodall_admin_form_form_responses_path(form, :csv), :class => 'download', :title => 'Download the responses for this form in CSV format' %></td>
|
26
26
|
<td><%= link_to 'Delete', noodall_admin_form_path(form), :confirm => 'Are you sure?', :method => :delete, :class => 'delete', :title => 'Delete this form' %></td>
|
27
27
|
</tr>
|
28
28
|
<% end %>
|
@@ -6,7 +6,9 @@
|
|
6
6
|
<% for field in form.fields %>
|
7
7
|
<% field_label = (field.label.blank? ? field.name : field.label) %>
|
8
8
|
<div class="form-wrap">
|
9
|
-
|
9
|
+
<% unless field._type == 'Noodall::Radio' %>
|
10
|
+
<%= (f.label field.underscored_name, field_label) %><%= (field.required ? content_tag('span', ' *', :class => 'required') : '') %>
|
11
|
+
<% end %>
|
10
12
|
|
11
13
|
<% case field._type.gsub(/^.*::/,'')
|
12
14
|
when 'TextField'
|
@@ -20,6 +22,7 @@
|
|
20
22
|
<% when 'Radio' %>
|
21
23
|
<fieldset>
|
22
24
|
<legend><%= field_label %></legend>
|
25
|
+
<%= (field.required ? content_tag('span', ' *', :class => 'required') : '') %>
|
23
26
|
<span class="radio-wrapper">
|
24
27
|
<% field.options.split(',').each do |option|
|
25
28
|
option.strip! %>
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: noodall-form-builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 17
|
5
|
+
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 7
|
10
|
+
version: 0.0.7
|
11
11
|
platform: ruby
|
12
12
|
authors: []
|
13
13
|
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-01-
|
18
|
+
date: 2011-01-28 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -30,10 +30,10 @@ dependencies:
|
|
30
30
|
- 0
|
31
31
|
- 0
|
32
32
|
version: 1.0.0
|
33
|
+
type: :development
|
33
34
|
name: bundler
|
34
35
|
prerelease: false
|
35
36
|
version_requirements: *id001
|
36
|
-
type: :development
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
segments:
|
45
45
|
- 0
|
46
46
|
version: "0"
|
47
|
+
type: :runtime
|
47
48
|
name: fastercsv
|
48
49
|
prerelease: false
|
49
50
|
version_requirements: *id002
|
50
|
-
type: :runtime
|
51
51
|
description: Functionality for building custom forms
|
52
52
|
email: []
|
53
53
|
|
@@ -195,7 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
195
195
|
requirements: []
|
196
196
|
|
197
197
|
rubyforge_project:
|
198
|
-
rubygems_version: 1.
|
198
|
+
rubygems_version: 1.3.7
|
199
199
|
signing_key:
|
200
200
|
specification_version: 3
|
201
201
|
summary: Noodall Form Builder
|