radiant-forms-extension 3.2.7 → 3.2.8
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +3 -3
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/app/controllers/admin/forms_controller.rb +44 -1
- data/app/controllers/forms_controller.rb +7 -0
- data/app/models/form_mail.rb +22 -33
- data/app/views/admin/forms/edit.html.haml +3 -12
- data/app/views/admin/forms/edit/_foot.html.haml +9 -0
- data/app/views/admin/forms/edit/_form.html.haml +13 -0
- data/app/views/admin/forms/edit/_head.html.haml +4 -0
- data/app/views/admin/forms/edit/_inputs.html.haml +2 -0
- data/app/views/admin/forms/edit/_meta.html.haml +7 -0
- data/app/views/admin/forms/edit/_parts.html.haml +9 -0
- data/app/views/admin/forms/edit/_popups.html.haml +3 -0
- data/app/views/admin/forms/edit/inputs/_title.html.haml +3 -0
- data/app/views/admin/forms/edit/meta/_action.html.haml +5 -0
- data/app/views/admin/forms/edit/meta/_redirect_to.html.haml +5 -0
- data/app/views/admin/forms/edit/parts/_body.html.haml +2 -0
- data/app/views/admin/forms/edit/parts/_config.html.haml +1 -0
- data/app/views/admin/forms/edit/parts/_content.html.haml +2 -0
- data/app/views/admin/forms/edit/parts/_filters.html.haml +9 -0
- data/app/views/admin/forms/edit/parts/_secondary.html.haml +2 -0
- data/app/views/admin/forms/index.html.haml +3 -14
- data/app/views/admin/forms/index/_form.html.haml +13 -0
- data/app/views/admin/forms/new.html.haml +7 -11
- data/config/locales/en.yml +4 -1
- data/forms_extension.rb +1 -1
- data/lib/forms/interface/forms.rb +7 -3
- data/lib/forms/tags/core.rb +22 -0
- data/public/stylesheets/sass/admin/extensions/forms/edit.sass +17 -0
- data/radiant-forms-extension.gemspec +71 -58
- data/spec/controllers/forms_controller_spec.rb +15 -7
- data/spec/lib/forms/tags/core_spec.rb +22 -2
- metadata +40 -14
- data/.gitignore +0 -3
- data/app/views/admin/forms/_fields.html.haml +0 -56
- data/app/views/admin/forms/_filters.html.haml +0 -7
- data/app/views/admin/forms/_form.html.haml +0 -6
- data/app/views/admin/forms/_header.html.haml +0 -3
- data/app/views/admin/forms/remove.html.haml +0 -20
data/README.md
CHANGED
@@ -62,9 +62,9 @@ Using forms 'DRY's up the process of creating and reusing forms across a site (w
|
|
62
62
|
|
63
63
|
### Content
|
64
64
|
|
65
|
-
<h2>Contact from <r:
|
65
|
+
<h2>Contact from <r:form:read name='contact[name]' /></h2>
|
66
66
|
|
67
|
-
<p>You can get back to them on <r:
|
67
|
+
<p>You can get back to them on <r:form:read name='contact[email]' /></p>
|
68
68
|
|
69
69
|
<p>Cheers, <br /> <strong>Cool Mailer</strong></p>
|
70
70
|
|
@@ -194,4 +194,4 @@ A showcase of how to use addons, allows you to send emails directly from the pag
|
|
194
194
|
config.gem 'ruby-debug', :version => '0.10.3'
|
195
195
|
config.gem 'webrat', :version => '0.7.1'
|
196
196
|
config.gem 'rr', :version => '0.10.11'
|
197
|
-
end
|
197
|
+
end
|
data/Rakefile
CHANGED
@@ -7,6 +7,7 @@ begin
|
|
7
7
|
gem.email = "dirk.kelly@squaretalent.com"
|
8
8
|
gem.homepage = "http://github.com/squaretalent/radiant-forms-extension"
|
9
9
|
gem.authors = ["dirkkelly"]
|
10
|
+
gem.add_dependency 'radiant-drag_order-extension', '>= 0.4.9'
|
10
11
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
11
12
|
end
|
12
13
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.2.
|
1
|
+
3.2.8
|
@@ -2,9 +2,52 @@ class Admin::FormsController < Admin::ResourceController
|
|
2
2
|
|
3
3
|
skip_before_filter :verify_authenticity_token, :only => :create
|
4
4
|
|
5
|
+
before_filter :config_global
|
6
|
+
before_filter :config_new, :only => [ :new, :create ]
|
7
|
+
before_filter :config_edit, :only => [ :edit, :update ]
|
8
|
+
before_filter :assets_edit, :only => [ :new, :create, :edit, :update ]
|
9
|
+
|
5
10
|
only_allow_access_to :index, :show, :new, :create, :edit, :update, :remove, :destroy,
|
6
11
|
:when => [ :designer, :admin ],
|
7
12
|
:denied_url => { :controller => 'admin/pages', :action => 'index' },
|
8
13
|
:denied_message => 'You must have designer privileges to perform this action.'
|
9
|
-
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def config_global
|
18
|
+
@inputs ||= []
|
19
|
+
@meta ||= []
|
20
|
+
@buttons ||= []
|
21
|
+
@parts ||= []
|
22
|
+
@popups ||= []
|
23
|
+
end
|
24
|
+
|
25
|
+
def config_new
|
26
|
+
@inputs << 'title'
|
27
|
+
|
28
|
+
@meta << 'action'
|
29
|
+
@meta << 'redirect_to'
|
30
|
+
|
31
|
+
@parts << 'body'
|
32
|
+
@parts << 'config'
|
33
|
+
@parts << 'content'
|
34
|
+
@parts << 'secondary'
|
35
|
+
end
|
36
|
+
|
37
|
+
def config_edit
|
38
|
+
@inputs << 'title'
|
39
|
+
|
40
|
+
@meta << 'action'
|
41
|
+
@meta << 'redirect_to'
|
42
|
+
|
43
|
+
@parts << 'body'
|
44
|
+
@parts << 'config'
|
45
|
+
@parts << 'content'
|
46
|
+
@parts << 'secondary'
|
47
|
+
end
|
48
|
+
|
49
|
+
def assets_edit
|
50
|
+
include_stylesheet 'admin/extensions/forms/edit'
|
51
|
+
end
|
52
|
+
|
10
53
|
end
|
@@ -68,6 +68,13 @@ protected
|
|
68
68
|
end
|
69
69
|
# Those results are merged into the response object
|
70
70
|
@response.result = @response.result.merge!({ :results => @results})
|
71
|
+
|
72
|
+
begin
|
73
|
+
@response.save!
|
74
|
+
redirect_to (@form.redirect_to.present? ? @form.redirect_to : (params[:redirect_to] || :back))
|
75
|
+
rescue
|
76
|
+
"Form '#{@form.title}' could not be submitted."
|
77
|
+
end
|
71
78
|
end
|
72
79
|
|
73
80
|
end
|
data/app/models/form_mail.rb
CHANGED
@@ -31,64 +31,53 @@ class FormMail
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def from
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
from = @config[:from]
|
34
|
+
begin
|
35
|
+
Forms::Tags::Responses.retrieve(@data, @config[:field][:from])
|
36
|
+
rescue
|
37
|
+
@config[:from]
|
39
38
|
end
|
40
|
-
from
|
41
39
|
end
|
42
40
|
|
43
41
|
def recipients
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
to = @config[:to]
|
42
|
+
begin
|
43
|
+
Forms::Tags::Responses.retrieve(@data, @config[:field][:to])
|
44
|
+
rescue
|
45
|
+
@config[:to]
|
49
46
|
end
|
50
|
-
to
|
51
47
|
end
|
52
48
|
|
53
49
|
def reply_to
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
reply_to = @config[:reply_to]
|
50
|
+
begin
|
51
|
+
Forms::Tags::Responses.retrieve(@data, @config[:field][:reply_to])
|
52
|
+
rescue
|
53
|
+
@config[:reply_to]
|
59
54
|
end
|
60
|
-
reply_to
|
61
55
|
end
|
62
56
|
|
63
57
|
def sender
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
sender = @config[:sender]
|
58
|
+
begin
|
59
|
+
Forms::Tags::Responses.retrieve(@data, @config[:field][:sender])
|
60
|
+
rescue
|
61
|
+
@config[:sender]
|
69
62
|
end
|
70
|
-
sender
|
71
63
|
end
|
72
64
|
|
73
65
|
def subject
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
subject = @config[:subject]
|
66
|
+
begin
|
67
|
+
Forms::Tags::Responses.retrieve(@data, @config[:field][:subject])
|
68
|
+
rescue
|
69
|
+
@config[:subject]
|
79
70
|
end
|
80
|
-
subject
|
81
71
|
end
|
82
72
|
|
83
73
|
def body
|
84
74
|
# This parses the content of the form
|
85
75
|
@parser = Radius::Parser.new(PageContext.new(@page), :tag_prefix => 'r')
|
86
76
|
if @config[:body]
|
87
|
-
@
|
77
|
+
@parser.parse(@form.send(@config[:body]))
|
88
78
|
else
|
89
|
-
@
|
79
|
+
@parser.parse(@form.content)
|
90
80
|
end
|
91
|
-
@body
|
92
81
|
end
|
93
82
|
|
94
83
|
def cc
|
@@ -1,15 +1,6 @@
|
|
1
|
-
-
|
1
|
+
- @page_title = @form.title
|
2
2
|
|
3
3
|
- render_region :main do |main|
|
4
|
-
- main.edit_header do
|
5
|
-
%h1= "Edit Form"
|
6
4
|
|
7
|
-
- main.
|
8
|
-
= render
|
9
|
-
= hidden_field_tag 'page_part_index_field'
|
10
|
-
|
11
|
-
- content_for :page_css do
|
12
|
-
:sass
|
13
|
-
.tab
|
14
|
-
.close
|
15
|
-
:display none
|
5
|
+
- main.form do
|
6
|
+
= render 'admin/forms/edit/form'
|
@@ -0,0 +1,13 @@
|
|
1
|
+
- form_for [:admin, @form], :html => {'data-onsubmit_status'=>"Saving Changes…"} do |f|
|
2
|
+
- render_region :form do |form|
|
3
|
+
- form.inputs do
|
4
|
+
= render :partial => '/admin/forms/edit/inputs', :locals => { :f => f }
|
5
|
+
|
6
|
+
- form.meta do
|
7
|
+
= render :partial => '/admin/forms/edit/meta', :locals => { :f => f }
|
8
|
+
|
9
|
+
- form.parts do
|
10
|
+
= render :partial => '/admin/forms/edit/parts', :locals => { :f => f }
|
11
|
+
|
12
|
+
- form.foot do
|
13
|
+
= render :partial => '/admin/forms/edit/foot', :locals => { :f => f }
|
@@ -0,0 +1,7 @@
|
|
1
|
+
.drawer
|
2
|
+
.drawer_contents#attributes
|
3
|
+
%table.fieldset
|
4
|
+
- @meta.each do |meta|
|
5
|
+
= render :partial => '/admin/forms/edit/meta/' + meta, :locals => { :f => f }
|
6
|
+
.drawer_handle
|
7
|
+
%a.toggle{:href=>'#attributes', :rel=>"toggle[attributes]", :class=>"#{(meta_errors? ? 'less' : 'more')}"}= meta_label
|
@@ -0,0 +1,9 @@
|
|
1
|
+
#tab_control
|
2
|
+
#tabs.tabs
|
3
|
+
#tab_toolbar
|
4
|
+
#pages.pages
|
5
|
+
= hidden_field_tag 'page_part_index_field' #important
|
6
|
+
- @parts.each do |part|
|
7
|
+
.page{:id => "page_#{part}", 'data-caption'=>h(part)}
|
8
|
+
.part{:id => "part_#{part}"}
|
9
|
+
= render :partial => "/admin/forms/edit/parts/#{part}", :locals => { :f => f }
|
@@ -0,0 +1 @@
|
|
1
|
+
~ f.text_area :config, :class => "textarea large", :style => "width: 100%"
|
@@ -0,0 +1,9 @@
|
|
1
|
+
-#%p
|
2
|
+
=# f.label :filter_id, t('filter')
|
3
|
+
=# f.select :filter_id, filter_options_for_select(f.object.filter_id), :id => 'snippet_filter'
|
4
|
+
%span.reference_links
|
5
|
+
= t('reference')
|
6
|
+
%span#filter_reference_link_body
|
7
|
+
= link_to t('filter'), '/admin/reference/filters?filter_name=Textile', :class => 'popup'
|
8
|
+
%span#tag_reference_link_body
|
9
|
+
= link_to t('available_tags'), '/admin/reference/tags', :class => 'popup'
|
@@ -1,20 +1,9 @@
|
|
1
1
|
- @page_title = 'Forms - ' + default_page_title
|
2
2
|
|
3
3
|
.outset
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
%thead
|
8
|
-
%tr
|
9
|
-
%th.form Form
|
10
|
-
%th.modify Modify
|
11
|
-
%tbody#forms_table_body
|
12
|
-
- if @forms.size != 0
|
13
|
-
= render :partial => 'form', :collection => @forms
|
14
|
-
-else
|
15
|
-
%tr
|
16
|
-
%td.empty{:colspan => 2} No Forms
|
17
|
-
|
4
|
+
%ol#forms.index
|
5
|
+
= render :partial => '/admin/forms/index/form', :collection => @forms
|
6
|
+
|
18
7
|
#actions
|
19
8
|
%ul
|
20
9
|
%li= link_to "New Form", new_admin_form_path
|
@@ -0,0 +1,13 @@
|
|
1
|
+
%li.form.object{:id => "form_#{form.id}", :'data-id' => form.id}
|
2
|
+
.attributes
|
3
|
+
- render_region :body do |body|
|
4
|
+
- body.icon do
|
5
|
+
%span.icon.attribute
|
6
|
+
- link_to [:edit_admin, form] do
|
7
|
+
= image 'extensions/form/form', :alt => "#{form.title} Form"
|
8
|
+
- body.title do
|
9
|
+
%span.name.attribute
|
10
|
+
= link_to form.title, [:edit_admin, form]
|
11
|
+
- body.modify do
|
12
|
+
.attribute.actions
|
13
|
+
= link_to image('minus') + ' ' + t('remove'), [:admin, form], :method => :delete, :confirm => "Is it OK to delete #{form.title}?", :class => "action"
|
@@ -1,15 +1,11 @@
|
|
1
|
-
-
|
1
|
+
- @page_title = t('new form')
|
2
2
|
|
3
3
|
- render_region :main do |main|
|
4
|
-
- main.
|
5
|
-
|
4
|
+
- main.head do
|
5
|
+
= render 'admin/forms/edit/head'
|
6
6
|
|
7
|
-
- main.
|
8
|
-
= render
|
9
|
-
= hidden_field_tag 'page_part_index_field'
|
7
|
+
- main.popups do
|
8
|
+
= render 'admin/forms/edit/popups'
|
10
9
|
|
11
|
-
-
|
12
|
-
|
13
|
-
.tab
|
14
|
-
.close
|
15
|
-
:display none
|
10
|
+
- main.form do
|
11
|
+
= render 'admin/forms/edit/form'
|
data/config/locales/en.yml
CHANGED
data/forms_extension.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
class FormsExtension < Radiant::Extension
|
2
2
|
version YAML::load_file(File.join(File.dirname(__FILE__), 'VERSION'))
|
3
3
|
description 'Radiant Form extension. Site wide, useful form management'
|
4
|
-
url 'http://github.com/
|
4
|
+
url 'http://github.com/dirkkelly/radiant-forms-extension'
|
5
5
|
|
6
6
|
extension_config do |config|
|
7
7
|
end
|
@@ -10,11 +10,15 @@ module Forms
|
|
10
10
|
def load_default_form_regions
|
11
11
|
returning OpenStruct.new do |form|
|
12
12
|
form.edit = Radiant::AdminUI::RegionSet.new do |edit|
|
13
|
-
edit.main.concat %w{
|
14
|
-
edit.form.concat %w{
|
15
|
-
edit.
|
13
|
+
edit.main.concat %w{form}
|
14
|
+
edit.form.concat %w{inputs meta parts foot}
|
15
|
+
edit.foot.concat %w{buttons timestamp}
|
16
16
|
end
|
17
17
|
form.new = form.edit
|
18
|
+
form.index = Radiant::AdminUI::RegionSet.new do |index|
|
19
|
+
index.body.concat %w{icon title modify}
|
20
|
+
index.foot.concat %w{buttons pagination}
|
21
|
+
end
|
18
22
|
end
|
19
23
|
end
|
20
24
|
end
|
data/lib/forms/tags/core.rb
CHANGED
@@ -68,6 +68,28 @@ module Forms
|
|
68
68
|
%(<input type="#{type}" value="#{value}" #{Forms::Tags::Helpers.attributes(tag)} />)
|
69
69
|
end
|
70
70
|
end
|
71
|
+
|
72
|
+
%w(textarea).each do |type|
|
73
|
+
desc %{
|
74
|
+
Render a @<#{type}>...</#{type}>@ tag to be used in a form
|
75
|
+
<pre><code><r:form:#{type} name="object[key]" /></code></pre>
|
76
|
+
|
77
|
+
**Required**
|
78
|
+
* *name* the name of the data to be sent
|
79
|
+
|
80
|
+
**Optional**
|
81
|
+
* *class* css class names
|
82
|
+
* *placeholder* default text, which is cleared when clicked
|
83
|
+
* *maxlength* the maximum amount of characters
|
84
|
+
}
|
85
|
+
tag "form:#{type}" do |tag|
|
86
|
+
Forms::Tags::Helpers.require!(tag,"form:#{type}",'name')
|
87
|
+
|
88
|
+
tag.attr['type'] = type
|
89
|
+
|
90
|
+
%(<#{type} #{Forms::Tags::Helpers.attributes(tag)}>#{tag.expand}</#{type}>)
|
91
|
+
end
|
92
|
+
end
|
71
93
|
|
72
94
|
desc %{
|
73
95
|
Renders a @<select>...</select>@ tag to be used in a form
|
@@ -1,83 +1,93 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{radiant-forms-extension}
|
8
|
-
s.version = "3.2.
|
8
|
+
s.version = "3.2.8"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["dirkkelly"]
|
12
|
-
s.date = %q{2010-12-
|
12
|
+
s.date = %q{2010-12-20}
|
13
13
|
s.description = %q{Send data from a page to a form handler, extendable with addons}
|
14
14
|
s.email = %q{dirk.kelly@squaretalent.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"README.md"
|
17
17
|
]
|
18
18
|
s.files = [
|
19
|
-
".
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
19
|
+
"README.md",
|
20
|
+
"Rakefile",
|
21
|
+
"VERSION",
|
22
|
+
"app/controllers/admin/forms_controller.rb",
|
23
|
+
"app/controllers/forms_controller.rb",
|
24
|
+
"app/models/form.rb",
|
25
|
+
"app/models/form_mail.rb",
|
26
|
+
"app/models/form_mailer.rb",
|
27
|
+
"app/models/form_page.rb",
|
28
|
+
"app/models/response.rb",
|
29
|
+
"app/views/admin/forms/edit.html.haml",
|
30
|
+
"app/views/admin/forms/edit/_foot.html.haml",
|
31
|
+
"app/views/admin/forms/edit/_form.html.haml",
|
32
|
+
"app/views/admin/forms/edit/_head.html.haml",
|
33
|
+
"app/views/admin/forms/edit/_inputs.html.haml",
|
34
|
+
"app/views/admin/forms/edit/_meta.html.haml",
|
35
|
+
"app/views/admin/forms/edit/_parts.html.haml",
|
36
|
+
"app/views/admin/forms/edit/_popups.html.haml",
|
37
|
+
"app/views/admin/forms/edit/inputs/_title.html.haml",
|
38
|
+
"app/views/admin/forms/edit/meta/_action.html.haml",
|
39
|
+
"app/views/admin/forms/edit/meta/_redirect_to.html.haml",
|
40
|
+
"app/views/admin/forms/edit/parts/_body.html.haml",
|
41
|
+
"app/views/admin/forms/edit/parts/_config.html.haml",
|
42
|
+
"app/views/admin/forms/edit/parts/_content.html.haml",
|
43
|
+
"app/views/admin/forms/edit/parts/_filters.html.haml",
|
44
|
+
"app/views/admin/forms/edit/parts/_secondary.html.haml",
|
45
|
+
"app/views/admin/forms/index.html.haml",
|
46
|
+
"app/views/admin/forms/index/_form.html.haml",
|
47
|
+
"app/views/admin/forms/new.html.haml",
|
48
|
+
"config/locales/en.yml",
|
49
|
+
"config/routes.rb",
|
50
|
+
"cucumber.yml",
|
51
|
+
"db/migrate/001_create_forms.rb",
|
52
|
+
"db/migrate/002_create_user_observer.rb",
|
53
|
+
"db/migrate/003_rename_output_to_content.rb",
|
54
|
+
"db/migrate/004_create_responses.rb",
|
55
|
+
"db/migrate/20100929150423_change_to_updated_by_id.rb",
|
56
|
+
"db/migrate/20101012230144_add_another_content_field.rb",
|
57
|
+
"forms_extension.rb",
|
58
|
+
"lib/forms/config.rb",
|
59
|
+
"lib/forms/controllers/application_controller.rb",
|
60
|
+
"lib/forms/controllers/site_controller.rb",
|
61
|
+
"lib/forms/interface/forms.rb",
|
62
|
+
"lib/forms/models/extension.rb",
|
63
|
+
"lib/forms/models/page.rb",
|
64
|
+
"lib/forms/tags/core.rb",
|
65
|
+
"lib/forms/tags/helpers.rb",
|
66
|
+
"lib/forms/tags/responses.rb",
|
67
|
+
"lib/radiant-forms-extension.rb",
|
68
|
+
"lib/tasks/forms_extension_tasks.rake",
|
69
|
+
"public/images/admin/extensions/form/form.png",
|
70
|
+
"public/stylesheets/sass/admin/extensions/forms/edit.sass",
|
71
|
+
"radiant-forms-extension.gemspec",
|
72
|
+
"spec/controllers/forms_controller_spec.rb",
|
73
|
+
"spec/datasets/forms.rb",
|
74
|
+
"spec/lib/forms/tags/core_spec.rb",
|
75
|
+
"spec/models/form_spec.rb",
|
76
|
+
"spec/models/response_spec.rb",
|
77
|
+
"spec/spec.opts",
|
78
|
+
"spec/spec_helper.rb"
|
68
79
|
]
|
69
80
|
s.homepage = %q{http://github.com/squaretalent/radiant-forms-extension}
|
70
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
71
81
|
s.require_paths = ["lib"]
|
72
82
|
s.rubygems_version = %q{1.3.7}
|
73
83
|
s.summary = %q{Forms Extension for Radiant CMS}
|
74
84
|
s.test_files = [
|
75
85
|
"spec/controllers/forms_controller_spec.rb",
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
86
|
+
"spec/datasets/forms.rb",
|
87
|
+
"spec/lib/forms/tags/core_spec.rb",
|
88
|
+
"spec/models/form_spec.rb",
|
89
|
+
"spec/models/response_spec.rb",
|
90
|
+
"spec/spec_helper.rb"
|
81
91
|
]
|
82
92
|
|
83
93
|
if s.respond_to? :specification_version then
|
@@ -85,9 +95,12 @@ Gem::Specification.new do |s|
|
|
85
95
|
s.specification_version = 3
|
86
96
|
|
87
97
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
98
|
+
s.add_runtime_dependency(%q<radiant-drag_order-extension>, [">= 0.4.9"])
|
88
99
|
else
|
100
|
+
s.add_dependency(%q<radiant-drag_order-extension>, [">= 0.4.9"])
|
89
101
|
end
|
90
102
|
else
|
103
|
+
s.add_dependency(%q<radiant-drag_order-extension>, [">= 0.4.9"])
|
91
104
|
end
|
92
105
|
end
|
93
106
|
|
@@ -37,13 +37,9 @@ describe FormsController do
|
|
37
37
|
|
38
38
|
end
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
40
|
end
|
45
41
|
|
46
|
-
context '#
|
42
|
+
context '#update' do
|
47
43
|
|
48
44
|
before :each do
|
49
45
|
@page = pages(:home)
|
@@ -153,19 +149,31 @@ describe FormsController do
|
|
153
149
|
|
154
150
|
end
|
155
151
|
|
152
|
+
context 'redirect params set' do
|
153
|
+
|
154
|
+
before :each do
|
155
|
+
put :update, @params.merge!(:redirect_to => '/somewhere')
|
156
|
+
end
|
157
|
+
|
158
|
+
it 'should render page url' do
|
159
|
+
response.should redirect_to('/somewhere')
|
160
|
+
end
|
161
|
+
|
162
|
+
end
|
156
163
|
context 'form does not have a redirect url' do
|
157
164
|
|
158
165
|
before :each do
|
159
|
-
@
|
166
|
+
@request.env['HTTP_REFERER'] = '/request/url'
|
160
167
|
put :update, @params
|
161
168
|
end
|
162
169
|
|
163
170
|
it 'should render page url' do
|
164
|
-
response.should redirect_to(
|
171
|
+
response.should redirect_to('/request/url')
|
165
172
|
end
|
166
173
|
|
167
174
|
end
|
168
175
|
|
176
|
+
|
169
177
|
end
|
170
178
|
|
171
179
|
context 'cant save response' do
|
@@ -11,6 +11,7 @@ describe Forms::Tags::Core do
|
|
11
11
|
'form',
|
12
12
|
'form:label',
|
13
13
|
'form:text',
|
14
|
+
'form:textarea',
|
14
15
|
'form:password',
|
15
16
|
'form:reset',
|
16
17
|
'form:checkbox',
|
@@ -25,7 +26,6 @@ describe Forms::Tags::Core do
|
|
25
26
|
'form:read',
|
26
27
|
'form:read:each',
|
27
28
|
|
28
|
-
'param',
|
29
29
|
'response',
|
30
30
|
'response:if_response',
|
31
31
|
'response:unless_response',
|
@@ -36,6 +36,7 @@ describe Forms::Tags::Core do
|
|
36
36
|
'response:if_get',
|
37
37
|
'response:unless_get',
|
38
38
|
|
39
|
+
'param',
|
39
40
|
'index',
|
40
41
|
'reset'
|
41
42
|
].sort
|
@@ -95,6 +96,25 @@ describe Forms::Tags::Core do
|
|
95
96
|
end
|
96
97
|
|
97
98
|
end
|
99
|
+
|
100
|
+
%w(textarea).each do |type|
|
101
|
+
|
102
|
+
describe "<r:form:#{type}>" do
|
103
|
+
|
104
|
+
it 'should render the correct HTML' do
|
105
|
+
tag = %{<r:form:#{type} name="test[field]" />}
|
106
|
+
expected = %{<#{type} name="test[field]" class="#{type}" id="test_field"></#{type}>}
|
107
|
+
@page.should render(tag).as(expected)
|
108
|
+
end
|
109
|
+
|
110
|
+
it 'should require the name attribute' do
|
111
|
+
tag = %{<r:form:#{type} />}
|
112
|
+
@page.should_not render(tag)
|
113
|
+
end
|
114
|
+
|
115
|
+
end
|
116
|
+
|
117
|
+
end
|
98
118
|
|
99
119
|
describe '<r:form:select>' do
|
100
120
|
|
@@ -134,7 +154,7 @@ describe Forms::Tags::Core do
|
|
134
154
|
it 'should require the name attribute' do
|
135
155
|
tag = %{<r:form:radios />}
|
136
156
|
@page.should_not render(tag)
|
137
|
-
end
|
157
|
+
end
|
138
158
|
|
139
159
|
end
|
140
160
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: radiant-forms-extension
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 3.2.
|
9
|
+
- 8
|
10
|
+
version: 3.2.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- dirkkelly
|
@@ -15,10 +15,25 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-12-
|
18
|
+
date: 2010-12-20 00:00:00 +08:00
|
19
19
|
default_executable:
|
20
|
-
dependencies:
|
21
|
-
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 29
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
- 4
|
33
|
+
- 9
|
34
|
+
version: 0.4.9
|
35
|
+
name: radiant-drag_order-extension
|
36
|
+
requirement: *id001
|
22
37
|
description: Send data from a page to a form handler, extendable with addons
|
23
38
|
email: dirk.kelly@squaretalent.com
|
24
39
|
executables: []
|
@@ -28,7 +43,6 @@ extensions: []
|
|
28
43
|
extra_rdoc_files:
|
29
44
|
- README.md
|
30
45
|
files:
|
31
|
-
- .gitignore
|
32
46
|
- README.md
|
33
47
|
- Rakefile
|
34
48
|
- VERSION
|
@@ -39,14 +53,25 @@ files:
|
|
39
53
|
- app/models/form_mailer.rb
|
40
54
|
- app/models/form_page.rb
|
41
55
|
- app/models/response.rb
|
42
|
-
- app/views/admin/forms/_fields.html.haml
|
43
|
-
- app/views/admin/forms/_filters.html.haml
|
44
|
-
- app/views/admin/forms/_form.html.haml
|
45
|
-
- app/views/admin/forms/_header.html.haml
|
46
56
|
- app/views/admin/forms/edit.html.haml
|
57
|
+
- app/views/admin/forms/edit/_foot.html.haml
|
58
|
+
- app/views/admin/forms/edit/_form.html.haml
|
59
|
+
- app/views/admin/forms/edit/_head.html.haml
|
60
|
+
- app/views/admin/forms/edit/_inputs.html.haml
|
61
|
+
- app/views/admin/forms/edit/_meta.html.haml
|
62
|
+
- app/views/admin/forms/edit/_parts.html.haml
|
63
|
+
- app/views/admin/forms/edit/_popups.html.haml
|
64
|
+
- app/views/admin/forms/edit/inputs/_title.html.haml
|
65
|
+
- app/views/admin/forms/edit/meta/_action.html.haml
|
66
|
+
- app/views/admin/forms/edit/meta/_redirect_to.html.haml
|
67
|
+
- app/views/admin/forms/edit/parts/_body.html.haml
|
68
|
+
- app/views/admin/forms/edit/parts/_config.html.haml
|
69
|
+
- app/views/admin/forms/edit/parts/_content.html.haml
|
70
|
+
- app/views/admin/forms/edit/parts/_filters.html.haml
|
71
|
+
- app/views/admin/forms/edit/parts/_secondary.html.haml
|
47
72
|
- app/views/admin/forms/index.html.haml
|
73
|
+
- app/views/admin/forms/index/_form.html.haml
|
48
74
|
- app/views/admin/forms/new.html.haml
|
49
|
-
- app/views/admin/forms/remove.html.haml
|
50
75
|
- config/locales/en.yml
|
51
76
|
- config/routes.rb
|
52
77
|
- cucumber.yml
|
@@ -69,6 +94,7 @@ files:
|
|
69
94
|
- lib/radiant-forms-extension.rb
|
70
95
|
- lib/tasks/forms_extension_tasks.rake
|
71
96
|
- public/images/admin/extensions/form/form.png
|
97
|
+
- public/stylesheets/sass/admin/extensions/forms/edit.sass
|
72
98
|
- radiant-forms-extension.gemspec
|
73
99
|
- spec/controllers/forms_controller_spec.rb
|
74
100
|
- spec/datasets/forms.rb
|
@@ -82,8 +108,8 @@ homepage: http://github.com/squaretalent/radiant-forms-extension
|
|
82
108
|
licenses: []
|
83
109
|
|
84
110
|
post_install_message:
|
85
|
-
rdoc_options:
|
86
|
-
|
111
|
+
rdoc_options: []
|
112
|
+
|
87
113
|
require_paths:
|
88
114
|
- lib
|
89
115
|
required_ruby_version: !ruby/object:Gem::Requirement
|
data/.gitignore
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
- form_for [:admin, @form], :html => {:onsubmit_status => onsubmit_status(@form)}, :html => { :enctype => 'multipart/form-data' } do |form_form|
|
2
|
-
.form_top
|
3
|
-
- render_region :form_top do |form_top|
|
4
|
-
-# empty
|
5
|
-
|
6
|
-
.form_area
|
7
|
-
- render_region :form do |form|
|
8
|
-
- form.edit_title do
|
9
|
-
%p.title
|
10
|
-
= form_form.label :title, 'Title'
|
11
|
-
= form_form.text_field :title, :class => 'textbox activate', :maxlength => 255
|
12
|
-
|
13
|
-
.drawer
|
14
|
-
.drawer_contents#attributes
|
15
|
-
%table.fieldset
|
16
|
-
%tr
|
17
|
-
%th.label= form_form.label :action, 'Action'
|
18
|
-
%td.field= form_form.text_field :action, :class => 'textbox', :maxlength => 100, :size => 100
|
19
|
-
%tr
|
20
|
-
%th.label= form_form.label :redirect_to, 'Redirect To'
|
21
|
-
%td.field= form_form.text_field :redirect_to, :class => 'textbox', :maxlength => 100, :size => 100
|
22
|
-
.drawer_handle
|
23
|
-
%a.toggle{:href=>'#attributes', :rel=>"toggle[attributes]", :class=>"#{(meta_errors? ? 'less' : 'more')}"}= meta_label
|
24
|
-
|
25
|
-
- form.edit_content do
|
26
|
-
#tab_control
|
27
|
-
#tabs.tabs
|
28
|
-
#parts.pages
|
29
|
-
#form_body.page{'data-caption'=>'body'}
|
30
|
-
= render '/admin/forms/filters'
|
31
|
-
= form_form.text_area :body, :class => 'textarea large', :style => 'width: 100%'
|
32
|
-
#form_config.page{'data-caption'=>'config'}
|
33
|
-
= form_form.text_area :config, :class => 'textarea large', :style => 'width: 100%'
|
34
|
-
#form_content.page{'data-caption'=>'content'}
|
35
|
-
= render '/admin/forms/filters'
|
36
|
-
= form_form.text_area :content, :class => 'textarea large', :style => 'width: 100%'
|
37
|
-
#form_content.page{'data-caption'=>'secondary'}
|
38
|
-
= render '/admin/forms/filters'
|
39
|
-
= form_form.text_area :secondary, :class => 'textarea large', :style => 'width: 100%'
|
40
|
-
|
41
|
-
.form_bottom
|
42
|
-
- render_region :form_bottom do |form_bottom|
|
43
|
-
- form_bottom.edit_buttons do
|
44
|
-
%p.buttons{:style=>"clear: left"}
|
45
|
-
= save_model_button(@form)
|
46
|
-
= save_model_and_continue_editing_button(@form)
|
47
|
-
or
|
48
|
-
= link_to t('cancel'), admin_forms_url
|
49
|
-
- form_bottom.edit_timestamp do
|
50
|
-
%p.updated_line
|
51
|
-
= updated_stamp @form
|
52
|
-
|
53
|
-
- content_for :page_css do
|
54
|
-
:sass
|
55
|
-
th.label
|
56
|
-
:width 75px !important
|
@@ -1,7 +0,0 @@
|
|
1
|
-
%p
|
2
|
-
%span.reference_links
|
3
|
-
= t('reference')
|
4
|
-
%span#filter_reference_link_body
|
5
|
-
= link_to t('filter'), '/admin/reference/filters?filter_name=Textile', :class => 'popup'
|
6
|
-
%span#tag_reference_link_body
|
7
|
-
= link_to t('available_tags'), '/admin/reference/tags', :class => 'popup'
|
@@ -1,20 +0,0 @@
|
|
1
|
-
%h1 Remove Form
|
2
|
-
|
3
|
-
%p
|
4
|
-
Are you sure you want to
|
5
|
-
%strong.warning permanently remove
|
6
|
-
the following form?
|
7
|
-
|
8
|
-
%table.index#form{ :cellpadding => "0", :cellspacing => "0", :border => "0" }
|
9
|
-
%tbody
|
10
|
-
%tr.node.level-1{ :onmouseover => "Element.addClassName(this, 'highlight');", :onmouseout => "Element.removeClassName(this, 'highlight');" }
|
11
|
-
%td.asset
|
12
|
-
= image('form.png', :alt => '')
|
13
|
-
= @form.title
|
14
|
-
|
15
|
-
|
16
|
-
- form_for [:admin, @form], :html => { :method => 'delete', :onsubmit_status => "Removing Form…" } do
|
17
|
-
%p.buttons
|
18
|
-
%input.button{ :type => "submit", :value => "Delete Form" }
|
19
|
-
or
|
20
|
-
= link_to 'Cancel', admin_forms_path
|