spud_inquiries 0.3.4 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.markdown +3 -3
  3. data/Rakefile +40 -0
  4. data/app/views/contacts/show.html.erb +26 -23
  5. data/app/views/spud/admin/inquiries/index.html.erb +2 -2
  6. data/app/views/spud/admin/inquiry_forms/_form.html.erb +34 -22
  7. data/app/views/spud/admin/inquiry_forms/_spud_inquiry_form_field_fields.html.erb +40 -30
  8. data/app/views/spud/admin/inquiry_forms/edit.html.erb +4 -11
  9. data/app/views/spud/admin/inquiry_forms/index.html.erb +3 -3
  10. data/app/views/spud/admin/inquiry_forms/new.html.erb +5 -9
  11. data/db/migrate/20120117133405_create_spud_inquiries.rb +8 -0
  12. data/db/migrate/20120117133412_create_spud_inquiry_fields.rb +13 -0
  13. data/db/migrate/20120121194439_create_spud_inquiry_forms.rb +9 -0
  14. data/db/migrate/20120121194447_create_spud_inquiry_form_fields.rb +12 -0
  15. data/db/migrate/20120122173829_add_field_order_to_spud_inquiry_form_fields.rb +7 -0
  16. data/db/migrate/20120126132407_add_spud_inquiry_form_id_to_spud_inquiries.rb +11 -0
  17. data/db/migrate/20120126132522_add_recipients_to_spud_inquiry_forms.rb +6 -0
  18. data/db/migrate/20120127023335_add_url_name_to_spud_inquiry_forms.rb +6 -0
  19. data/lib/spud_inquiries/version.rb +5 -0
  20. data/lib/tasks/spud_inquiries_tasks.rake +4 -0
  21. data/test/dummy/README.rdoc +261 -0
  22. data/test/dummy/Rakefile +7 -0
  23. data/test/dummy/app/assets/javascripts/application.js +15 -0
  24. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  25. data/test/dummy/app/controllers/application_controller.rb +3 -0
  26. data/test/dummy/app/helpers/application_helper.rb +2 -0
  27. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  28. data/{config → test/dummy/config}/application.rb +15 -7
  29. data/test/dummy/config/boot.rb +10 -0
  30. data/test/dummy/config/database.yml +37 -0
  31. data/test/dummy/config/environment.rb +5 -0
  32. data/test/dummy/config/environments/development.rb +37 -0
  33. data/test/dummy/config/environments/production.rb +67 -0
  34. data/test/dummy/config/environments/test.rb +37 -0
  35. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  36. data/test/dummy/config/initializers/inflections.rb +15 -0
  37. data/test/dummy/config/initializers/mime_types.rb +5 -0
  38. data/test/dummy/config/initializers/secret_token.rb +7 -0
  39. data/test/dummy/config/initializers/session_store.rb +8 -0
  40. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  41. data/test/dummy/config/locales/en.yml +5 -0
  42. data/test/dummy/config/routes.rb +4 -0
  43. data/test/dummy/config.ru +4 -0
  44. data/test/dummy/public/404.html +26 -0
  45. data/test/dummy/public/422.html +26 -0
  46. data/test/dummy/public/500.html +25 -0
  47. data/test/dummy/public/favicon.ico +0 -0
  48. data/test/dummy/script/rails +6 -0
  49. data/test/test_helper.rb +10 -0
  50. metadata +170 -15
  51. data/config/boot.rb +0 -6
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2012 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.markdown CHANGED
@@ -24,10 +24,10 @@ Routing to the Inquiries Engine
24
24
  By default the inquiries gem routes the "/contact" url to the form named "contact". However this and other configuration options can be changed as shown below.
25
25
 
26
26
 
27
- Spud::Cms.configure do |config|
27
+ Spud::Inquiries.configure do |config|
28
28
  config.default_contact_form = "contact"
29
- config.base_layout = "application"
30
- config.from_address = "no-reply@example.org"
29
+ config.base_layout = "application"
30
+ config.from_address = "no-reply@example.org"
31
31
  end
32
32
 
33
33
 
data/Rakefile ADDED
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'SpudInquiries'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
24
+ load 'rails/tasks/engine.rake'
25
+
26
+
27
+
28
+ Bundler::GemHelper.install_tasks
29
+
30
+ require 'rake/testtask'
31
+
32
+ Rake::TestTask.new(:test) do |t|
33
+ t.libs << 'lib'
34
+ t.libs << 'test'
35
+ t.pattern = 'test/**/*_test.rb'
36
+ t.verbose = false
37
+ end
38
+
39
+
40
+ task :default => :test
@@ -5,35 +5,38 @@
5
5
  <%=error_messages_for(@inquiry)%>
6
6
  <fieldset>
7
7
  <%=f.hidden_field :spud_inquiry_form_id,:value => @inquiry_form.id%>
8
- <ol>
9
- <li>
10
- <%=f.label :email%>
11
- <%=f.text_field :email,:value => @inquiry.email%>
12
- </li>
8
+
9
+ <div class="control-group">
10
+ <%=f.label :email,:class => "control-label"%>
11
+ <div class="controls">
12
+ <%=f.text_field :email,:value => @inquiry.email%>
13
+ </div>
14
+ </div>
13
15
  <%@inquiry_form.spud_inquiry_form_fields.each do |field|%>
14
- <li>
15
- <%=f.label field.name%>
16
-
17
- <%=case field.field_type
18
- when '0'
19
- f.text_field field.name,:value => params[:spud_inquiry].blank? || params[:spud_inquiry][field.name].blank? ? field.default_value : params[:spud_inquiry][field.name]
20
- when '1'
21
- f.check_box field.name,:value => params[:spud_inquiry].blank? || params[:spud_inquiry][field.name].blank? ? field.default_value : params[:spud_inquiry][field.name]
22
- when '2'
23
- f.text_area field.name,:value => params[:spud_inquiry].blank? || params[:spud_inquiry][field.name].blank? ? field.default_value : params[:spud_inquiry][field.name]
24
- when '3'
25
- f.select field.name,field.options.split(",").collect {|opt| [opt,opt]},:include_blank => true
26
- end%>
27
- </li>
16
+ <div class="control-group">
17
+ <%=f.label field.name,:class => "control-label"%>
18
+ <div class="controls">
19
+ <%=case field.field_type
20
+ when '0'
21
+ f.text_field field.name,:value => params[:spud_inquiry].blank? || params[:spud_inquiry][field.name].blank? ? field.default_value : params[:spud_inquiry][field.name]
22
+ when '1'
23
+ f.check_box field.name,:value => params[:spud_inquiry].blank? || params[:spud_inquiry][field.name].blank? ? field.default_value : params[:spud_inquiry][field.name]
24
+ when '2'
25
+ f.text_area field.name,:value => params[:spud_inquiry].blank? || params[:spud_inquiry][field.name].blank? ? field.default_value : params[:spud_inquiry][field.name]
26
+ when '3'
27
+ f.select field.name,field.options.split(",").collect {|opt| [opt,opt]},:include_blank => true
28
+ end%>
29
+ </div>
30
+ </div>
28
31
  <%end%>
29
32
  <li class="spud_inquiry_hide">
30
33
  <label id='other_email_label' for='other_email'>Please leave blank:</label>
31
34
  <input type='text' name='other_email' id='other_email'>
32
- </li>
35
+ </div>
33
36
  <li style="text-align:center;">
34
- <%=f.submit "Submit Inquiry"%>
35
- </li>
36
- </ol>
37
+ <%=f.submit "Submit Inquiry",:class => "btn btn-primary"%>
38
+ </div>
39
+
37
40
 
38
41
  </fieldset>
39
42
 
@@ -1,5 +1,5 @@
1
1
  <%=content_for :data_controls do%>
2
- <%=link_to "Forms",spud_admin_inquiry_forms_path(),:class => "button",:title => "Forms"%>
2
+ <%=link_to "Forms",spud_admin_inquiry_forms_path(),:class => "btn btn-primary",:title => "Forms"%>
3
3
  <%end%>
4
4
 
5
5
  <%=content_for :detail do%>
@@ -11,7 +11,7 @@
11
11
 
12
12
  <span class="edit_controls">
13
13
 
14
- <%=link_to "Remove",spud_admin_inquiry_path(inquiry),:method => :delete,:class => 'button',:confirm => "Are you sure you want to remove this inquiry?"%></span>
14
+ <%=link_to "Remove",spud_admin_inquiry_path(inquiry),:method => :delete,:class => 'btn btn-danger',:confirm => "Are you sure you want to remove this inquiry?"%></span>
15
15
  <br style="clear:both;"/>
16
16
  </div>
17
17
  <%end%>
@@ -1,28 +1,40 @@
1
1
  <%=error_messages_for(f.object)%>
2
2
  <fieldset>
3
3
  <legend>Form Info</legend>
4
- <ol>
5
- <li>
4
+
5
+ <div class="control-group">
6
6
 
7
- <%=f.label :name, :required=>true%>
8
- <%=f.text_field :name%>
9
- </li>
10
- <li>
11
- <%=f.label :recipients, :required=>true%>
12
- <%=f.text_field :recipients%>
13
- </li>
14
- <li>
15
- <%=f.label :subject, :required=>true%>
16
- <%=f.text_field :subject%>
17
- </li>
18
- <li>
19
- <%=f.label :content, :required=>true%>
20
- <%=f.text_area :content,:cols => 75,:rows => 5,:class => "wysiwym"%>
21
- </li>
22
- </ol>
7
+ <%=f.label :name, :required=>true, :class=>"control-label"%>
8
+ <div class="controls">
9
+ <%=f.text_field :name%>
10
+ </div>
11
+ </div>
12
+ <div class="control-group">
13
+ <%=f.label :recipients, :required=>true, :class=>"control-label"%>
14
+ <div class="controls">
15
+ <%=f.text_field :recipients%>
16
+ </div>
17
+ </div>
18
+ <div class="control-group">
19
+ <%=f.label :subject, :required=>true, :class=>"control-label"%>
20
+ <div class="controls">
21
+ <%=f.text_field :subject%>
22
+ </div>
23
+ </div>
24
+ <div class="control-group">
25
+ <%=f.label :content, :required=>true, :class=>"control-label"%>
26
+ <div class="controls">
27
+ <%=f.text_area :content,:cols => 75,:rows => 5,:class => "wysiwym tinymce"%>
28
+ </div>
29
+ </div>
30
+
31
+ </fieldset>
32
+ <fieldset>
33
+ <legend>Fields</legend>
34
+
35
+ <%=f.fields_for :spud_inquiry_form_fields do |builder|%>
36
+ <%=render "spud_inquiry_form_field_fields",:f => builder%>
37
+ <%end%>
38
+ <p><%= link_to_add_fields "Add Field", f, :spud_inquiry_form_fields %></p>
23
39
  </fieldset>
24
40
 
25
- <%=f.fields_for :spud_inquiry_form_fields do |builder|%>
26
- <%=render "spud_inquiry_form_field_fields",:f => builder%>
27
- <%end%>
28
- <p><%= link_to_add_fields "Add Field", f, :spud_inquiry_form_fields %></p>
@@ -1,34 +1,44 @@
1
1
  <fieldset class="fields">
2
- <legend>Field</legend>
3
- <ol>
4
- <li>
5
- <%=f.label :name%>
6
- <%=f.text_field :name%>
7
- </li>
8
- <li>
9
- <%=f.label :field_type%>
10
- <%=f.select :field_type, [["Text Field",0],["Checkbox",1],["Text Area",2],["Dropdown",3]]%>
2
+ <hr/>
3
+ <div class="control-group">
4
+ <%=f.label :name,:class => "control-label"%>
5
+ <div class="controls">
6
+ <%=f.text_field :name%>
7
+ </div>
8
+ </div>
9
+ <div class="control-group">
10
+ <%=f.label :field_type,:class => "control-label"%>
11
+ <div class="controls">
12
+ <%=f.select :field_type, [["Text Field",0],["Checkbox",1],["Text Area",2],["Dropdown",3]]%>
13
+ </div>
11
14
 
12
15
 
13
- </li>
14
- <li>
15
- <%=f.label :options%>
16
- <%=f.text_field :options%>
17
- </li>
18
- <li>
19
- <%=f.label :default_value%>
20
- <%=f.text_field :default_value%>
21
- </li>
22
- <li>
23
- <%=f.label :field_order%>
24
- <%=f.text_field :field_order%>
25
- </li>
26
- <li>
27
- <%=f.label :required%>
28
- <%=f.check_box :required%>
29
- </li>
30
- <li>
16
+ </div>
17
+ <div class="control-group">
18
+ <%=f.label :options,:class => "control-label"%>
19
+ <div class="controls">
20
+ <%=f.text_field :options%>
21
+ </div>
22
+ </div>
23
+ <div class="control-group">
24
+ <%=f.label :default_value,:class => "control-label"%>
25
+ <div class="controls">
26
+ <%=f.text_field :default_value%>
27
+ </div>
28
+ </div>
29
+ <div class="control-group">
30
+ <%=f.label :field_order,:class => "control-label"%>
31
+ <div class="controls">
32
+ <%=f.text_field :field_order%>
33
+ </div>
34
+ </div>
35
+ <div class="control-group">
36
+ <%=f.label :required,:class => "control-label"%>
37
+ <div class="controls">
38
+ <%=f.check_box :required%>
39
+ </div>
40
+ </div>
41
+ <div class="control-group">
31
42
  <%= link_to_remove_fields "Remove", f %>
32
- </li>
33
- </ol>
34
- </fieldset>
43
+ </div>
44
+ </fieldset>
@@ -1,13 +1,6 @@
1
- <%=form_for @inquiry_form,:url => spud_admin_inquiry_form_path(@inquiry_form),:html=>{:class=>"right_aligned_form"} do |f|%>
1
+ <%=form_for @inquiry_form,:url => spud_admin_inquiry_form_path(@inquiry_form),:html=>{:class=>"form-horizontal"} do |f|%>
2
2
  <%=render :partial => "form",:locals => {:f => f}%>
3
- <fieldset class="submit">
4
- <%=f.submit%> or <%=link_to "cancel",request.referer%>
5
- </fieldset>
3
+ <div class="form-actions">
4
+ <%=f.submit "Save Form", :class=>"btn btn-primary","data-loading-text"=>"Saving..."%> or <%=link_to "cancel",spud_admin_inquiry_forms_path,:class => "btn"%>
5
+ </div>
6
6
  <%end%>
7
- <br />
8
-
9
- <script type="text/javascript">
10
- $('input[type=submit],.close_dialog').button();
11
-
12
- </script>
13
-
@@ -1,5 +1,5 @@
1
1
  <%=content_for :data_controls do%>
2
- <%=link_to "New Form",new_spud_admin_inquiry_form_path(),:class => "button",:title => "New Form"%>
2
+ <%=link_to "New Form",new_spud_admin_inquiry_form_path(),:class => "btn btn-primary",:title => "New Form"%>
3
3
  <%end%>
4
4
  <%=content_for :detail do%>
5
5
  <div class="page_list">
@@ -9,8 +9,8 @@
9
9
  <span class="row_meta"><%=link_to inquiry_form.name,edit_spud_admin_inquiry_form_path(inquiry_form)%></span>
10
10
 
11
11
  <span class="edit_controls">
12
- <%=link_to "Edit",edit_spud_admin_inquiry_form_path(inquiry_form),:class => 'button'%>
13
- <%=link_to "Remove",spud_admin_inquiry_form_path(inquiry_form),:method => :delete,:class => 'button',:confirm => "Are you sure you want to remove this file?"%></span>
12
+ <%=link_to "Edit",edit_spud_admin_inquiry_form_path(inquiry_form),:class => 'btn'%>
13
+ <%=link_to "Remove",spud_admin_inquiry_form_path(inquiry_form),:method => :delete,:class => 'btn btn-danger',:confirm => "Are you sure you want to remove this file?"%></span>
14
14
  <br style="clear:both;"/>
15
15
  </div>
16
16
  <%end%>
@@ -1,13 +1,9 @@
1
- <%=form_for @inquiry_form,:url => spud_admin_inquiry_forms_path(),:html=>{:class=>"right_aligned_form"} do |f|%>
1
+ <%=form_for @inquiry_form,:url => spud_admin_inquiry_forms_path(),:html=>{:class=>"form-horizontal"} do |f|%>
2
2
  <%=render :partial => "form",:locals => {:f => f}%>
3
- <fieldset class="submit">
4
- <%=f.submit%> or <%=link_to "cancel",request.referer%>
5
- </fieldset>
3
+ <div class="form-actions">
4
+ <%=f.submit "Create Form", :class=>"btn btn-primary","data-loading-text"=>"Saving..."%> or <%=link_to "cancel",spud_admin_inquiry_forms_path,:class => "btn"%>
5
+ </div>
6
6
  <%end%>
7
- <br />
8
7
 
9
- <script type="text/javascript">
10
- $('input[type=submit],.close_dialog').button();
11
-
12
- </script>
13
8
 
9
+
@@ -0,0 +1,8 @@
1
+ class CreateSpudInquiries < ActiveRecord::Migration
2
+ def change
3
+ create_table :spud_inquiries do |t|
4
+ t.string :email
5
+ t.timestamps
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,13 @@
1
+ class CreateSpudInquiryFields < ActiveRecord::Migration
2
+ def change
3
+ create_table :spud_inquiry_fields do |t|
4
+ t.string :name
5
+ t.text :value
6
+ t.integer :spud_inquiry_id
7
+
8
+ t.timestamps
9
+ end
10
+
11
+ add_index :spud_inquiry_fields,:spud_inquiry_id
12
+ end
13
+ end
@@ -0,0 +1,9 @@
1
+ class CreateSpudInquiryForms < ActiveRecord::Migration
2
+ def change
3
+ create_table :spud_inquiry_forms do |t|
4
+ t.string :name
5
+ t.text :content
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,12 @@
1
+ class CreateSpudInquiryFormFields < ActiveRecord::Migration
2
+ def change
3
+ create_table :spud_inquiry_form_fields do |t|
4
+ t.integer :spud_inquiry_form_id
5
+ t.string :field_type
6
+ t.string :name
7
+ t.string :options
8
+ t.string :default_value
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,7 @@
1
+ class AddFieldOrderToSpudInquiryFormFields < ActiveRecord::Migration
2
+ def change
3
+ add_column :spud_inquiry_form_fields, :field_order, :integer
4
+ add_column :spud_inquiry_form_fields, :required, :boolean
5
+ add_index :spud_inquiry_form_fields,:field_order
6
+ end
7
+ end
@@ -0,0 +1,11 @@
1
+ class AddSpudInquiryFormIdToSpudInquiries < ActiveRecord::Migration
2
+ def change
3
+ add_column :spud_inquiries, :spud_inquiry_form_id, :integer
4
+ add_column :spud_inquiries, :recipients, :text
5
+ add_column :spud_inquiries, :subject,:string
6
+ add_column :spud_inquiries, :marked_as_read,:boolean,:default => false
7
+
8
+ add_index :spud_inquiries, :marked_as_read
9
+ add_index :spud_inquiries, :spud_inquiry_form_id
10
+ end
11
+ end
@@ -0,0 +1,6 @@
1
+ class AddRecipientsToSpudInquiryForms < ActiveRecord::Migration
2
+ def change
3
+ add_column :spud_inquiry_forms, :recipients, :text
4
+ add_column :spud_inquiry_forms, :subject, :string
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ class AddUrlNameToSpudInquiryForms < ActiveRecord::Migration
2
+ def change
3
+ add_column :spud_inquiry_forms, :url_name, :string
4
+ add_index :spud_inquiry_forms,:url_name
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module Spud
2
+ module Inquiries
3
+ VERSION = "0.8.0"
4
+ end
5
+ end