radiant-forms-extension 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -90,9 +90,10 @@ A showcase of how to use addons, allows you to send emails directly from the pag
90
90
 
91
91
  ### Controller
92
92
 
93
- Must be named **FormsBlahController** and contain an inherited FormsExtensionController of the same name
93
+ Must be named **FormsBlahController** and a controller of the same name
94
94
 
95
- class FormsBlahController < FormsExtensionController
95
+ class FormsBlahController
96
+ include Forms::AddonMethods # Manages your controller initialization
96
97
 
97
98
  def create
98
99
  # @form = Form which the data comes from
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0
1
+ 2.0.1
data/config/routes.rb CHANGED
@@ -4,6 +4,6 @@ ActionController::Routing::Routes.draw do |map|
4
4
  admin.resources :forms
5
5
  end
6
6
 
7
- map.resources :forms, :only => [ :create ]
7
+ map.forms '/forms/:form_id', :controller => 'forms', :action => 'create', :conditions => { :method => :post }
8
8
 
9
9
  end
@@ -1,5 +1,5 @@
1
1
  module Forms
2
- module ExtensionMethods
2
+ module AddonMethods
3
3
  def self.included(base)
4
4
  attr_accessor :form, :page, :data
5
5
  base.class_eval do
data/lib/forms/tags.rb CHANGED
@@ -18,7 +18,7 @@ module Forms
18
18
  if tag.locals.form = Form.find_by_title(tag.attr['name'])
19
19
  tag.attr['id'] ||= 'form_' + tag.locals.form.title
20
20
  tag.attr['method'] ||= 'post'
21
- tag.attr['action'] ||= tag.locals.form.action.nil? ? "/forms/#{tag.locals.form.id}" : tag.locals.form.action
21
+ tag.attr['action'] ||= tag.locals.form.action.blank? ? "/forms/#{tag.locals.form.id}" : tag.locals.form.action
22
22
  return render_form(tag.locals.form, tag)
23
23
  else
24
24
  raise TagError, "Could not find '#{tag.attr['name']}' form"
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{radiant-forms-extension}
8
- s.version = "2.0.0"
8
+ s.version = "2.0.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["dirkkelly"]
@@ -41,9 +41,9 @@ Gem::Specification.new do |s|
41
41
  "db/migrate/003_rename_output_to_content.rb",
42
42
  "db/migrate/004_create_responses.rb",
43
43
  "forms_extension.rb",
44
+ "lib/forms/addon_methods.rb",
44
45
  "lib/forms/admin_ui.rb",
45
46
  "lib/forms/application_controller_extensions.rb",
46
- "lib/forms/extension_methods.rb",
47
47
  "lib/forms/page_extensions.rb",
48
48
  "lib/forms/site_controller_extensions.rb",
49
49
  "lib/forms/tags.rb",
@@ -52,7 +52,7 @@ Gem::Specification.new do |s|
52
52
  "radiant-forms-extension.gemspec",
53
53
  "spec/controllers/forms_controller_spec.rb",
54
54
  "spec/datasets/forms.rb",
55
- "spec/lib/forms/extension_methods_spec.rb",
55
+ "spec/lib/forms/addon_methods_spec.rb",
56
56
  "spec/lib/forms/tags_spec.rb",
57
57
  "spec/models/form_spec.rb",
58
58
  "spec/models/response_spec.rb",
@@ -67,7 +67,7 @@ Gem::Specification.new do |s|
67
67
  s.test_files = [
68
68
  "spec/controllers/forms_controller_spec.rb",
69
69
  "spec/datasets/forms.rb",
70
- "spec/lib/forms/extension_methods_spec.rb",
70
+ "spec/lib/forms/addon_methods_spec.rb",
71
71
  "spec/lib/forms/tags_spec.rb",
72
72
  "spec/models/form_spec.rb",
73
73
  "spec/models/response_spec.rb",
@@ -5,15 +5,13 @@ describe FormsController do
5
5
 
6
6
  context '#create' do
7
7
 
8
- before :all do
9
- @params = {
10
- 'request' => 'test'
11
- }
12
- end
13
-
14
8
  before :each do
15
9
  @page = pages(:home)
16
10
  @form = forms(:test)
11
+ @params = {
12
+ 'form_id' => @form.id,
13
+ 'request' => 'test'
14
+ }
17
15
  mock(Page).find(anything) { @page }
18
16
  mock(Form).find(anything) { @form }
19
17
  end
@@ -1,12 +1,12 @@
1
1
  class FormsTestController
2
- include Forms::ExtensionMethods
2
+ include Forms::AddonMethods
3
3
  def create
4
4
  result = { :response => 'test' }
5
5
  end
6
6
  end
7
7
 
8
8
  class FormsAltController
9
- include Forms::ExtensionMethods
9
+ include Forms::AddonMethods
10
10
  def create
11
11
  result = { :response => 'alt' }
12
12
  end
@@ -1,6 +1,6 @@
1
1
  require File.dirname(__FILE__) + '/../../spec_helper'
2
2
 
3
- describe Forms::ExtensionMethods do
3
+ describe Forms::AddonMethods do
4
4
  dataset :forms, :pages
5
5
 
6
6
  before :each do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: radiant-forms-extension
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - dirkkelly
@@ -47,9 +47,9 @@ files:
47
47
  - db/migrate/003_rename_output_to_content.rb
48
48
  - db/migrate/004_create_responses.rb
49
49
  - forms_extension.rb
50
+ - lib/forms/addon_methods.rb
50
51
  - lib/forms/admin_ui.rb
51
52
  - lib/forms/application_controller_extensions.rb
52
- - lib/forms/extension_methods.rb
53
53
  - lib/forms/page_extensions.rb
54
54
  - lib/forms/site_controller_extensions.rb
55
55
  - lib/forms/tags.rb
@@ -58,7 +58,7 @@ files:
58
58
  - radiant-forms-extension.gemspec
59
59
  - spec/controllers/forms_controller_spec.rb
60
60
  - spec/datasets/forms.rb
61
- - spec/lib/forms/extension_methods_spec.rb
61
+ - spec/lib/forms/addon_methods_spec.rb
62
62
  - spec/lib/forms/tags_spec.rb
63
63
  - spec/models/form_spec.rb
64
64
  - spec/models/response_spec.rb
@@ -95,7 +95,7 @@ summary: Forms Extension for Radiant CMS
95
95
  test_files:
96
96
  - spec/controllers/forms_controller_spec.rb
97
97
  - spec/datasets/forms.rb
98
- - spec/lib/forms/extension_methods_spec.rb
98
+ - spec/lib/forms/addon_methods_spec.rb
99
99
  - spec/lib/forms/tags_spec.rb
100
100
  - spec/models/form_spec.rb
101
101
  - spec/models/response_spec.rb