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.
- data/MIT-LICENSE +20 -0
- data/README.markdown +3 -3
- data/Rakefile +40 -0
- data/app/views/contacts/show.html.erb +26 -23
- data/app/views/spud/admin/inquiries/index.html.erb +2 -2
- data/app/views/spud/admin/inquiry_forms/_form.html.erb +34 -22
- data/app/views/spud/admin/inquiry_forms/_spud_inquiry_form_field_fields.html.erb +40 -30
- data/app/views/spud/admin/inquiry_forms/edit.html.erb +4 -11
- data/app/views/spud/admin/inquiry_forms/index.html.erb +3 -3
- data/app/views/spud/admin/inquiry_forms/new.html.erb +5 -9
- data/db/migrate/20120117133405_create_spud_inquiries.rb +8 -0
- data/db/migrate/20120117133412_create_spud_inquiry_fields.rb +13 -0
- data/db/migrate/20120121194439_create_spud_inquiry_forms.rb +9 -0
- data/db/migrate/20120121194447_create_spud_inquiry_form_fields.rb +12 -0
- data/db/migrate/20120122173829_add_field_order_to_spud_inquiry_form_fields.rb +7 -0
- data/db/migrate/20120126132407_add_spud_inquiry_form_id_to_spud_inquiries.rb +11 -0
- data/db/migrate/20120126132522_add_recipients_to_spud_inquiry_forms.rb +6 -0
- data/db/migrate/20120127023335_add_url_name_to_spud_inquiry_forms.rb +6 -0
- data/lib/spud_inquiries/version.rb +5 -0
- data/lib/tasks/spud_inquiries_tasks.rake +4 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +15 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/{config → test/dummy/config}/application.rb +15 -7
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +37 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +4 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/test_helper.rb +10 -0
- metadata +170 -15
- 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::
|
27
|
+
Spud::Inquiries.configure do |config|
|
28
28
|
config.default_contact_form = "contact"
|
29
|
-
|
30
|
-
|
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
|
-
|
9
|
-
<
|
10
|
-
<%=f.label :email%>
|
11
|
-
|
12
|
-
|
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
|
-
<
|
15
|
-
<%=f.label field.name%>
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
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
|
-
</
|
35
|
+
</div>
|
33
36
|
<li style="text-align:center;">
|
34
|
-
<%=f.submit "Submit Inquiry"%>
|
35
|
-
</
|
36
|
-
|
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 => "
|
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 => '
|
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
|
-
|
5
|
-
<
|
4
|
+
|
5
|
+
<div class="control-group">
|
6
6
|
|
7
|
-
<%=f.label :name, :required=>true%>
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
</
|
18
|
-
<
|
19
|
-
<%=f.label :
|
20
|
-
|
21
|
-
|
22
|
-
|
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
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
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
|
-
</
|
14
|
-
<
|
15
|
-
<%=f.label :options%>
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
</
|
26
|
-
<
|
27
|
-
<%=f.label :
|
28
|
-
|
29
|
-
|
30
|
-
|
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
|
-
</
|
33
|
-
</
|
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=>"
|
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
|
-
<
|
4
|
-
|
5
|
-
|
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 => "
|
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 => '
|
13
|
-
<%=link_to "Remove",spud_admin_inquiry_form_path(inquiry_form),:method => :delete,:class => '
|
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=>"
|
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
|
-
<
|
4
|
-
|
5
|
-
|
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,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,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,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
|