spud_inquiries 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. data/app/assets/images/spud/admin/contacts_thumb.png +0 -0
  2. data/app/assets/javascripts/spud/admin/inquiries.js +8 -0
  3. data/app/assets/javascripts/spud/inquiries/sitemaps.js +2 -0
  4. data/app/assets/stylesheets/spud/admin/inquiries.css +4 -0
  5. data/app/assets/stylesheets/spud/inquiries/sitemaps.css +4 -0
  6. data/app/controllers/contacts_controller.rb +46 -0
  7. data/app/controllers/spud/admin/inquiries_controller.rb +38 -0
  8. data/app/controllers/spud/admin/inquiry_forms_controller.rb +50 -0
  9. data/app/controllers/spud/inquiries/sitemaps_controller.rb +7 -0
  10. data/app/helpers/contacts_helper.rb +2 -0
  11. data/app/helpers/spud/admin/inquiries_helper.rb +2 -0
  12. data/app/helpers/spud/admin/inquiry_forms_helper.rb +2 -0
  13. data/app/helpers/spud/admin/users_helper.rb +2 -0
  14. data/app/helpers/spud/inquiries/sitemaps_helper.rb +2 -0
  15. data/app/helpers/spud/user_sessions_helper.rb +2 -0
  16. data/app/mailers/spud/inquiry_mailer.rb +9 -0
  17. data/app/models/spud_inquiry.rb +6 -0
  18. data/app/models/spud_inquiry_field.rb +3 -0
  19. data/app/models/spud_inquiry_form.rb +14 -0
  20. data/app/models/spud_inquiry_form_field.rb +6 -0
  21. data/app/views/contacts/show.html.erb +35 -0
  22. data/app/views/contacts/thankyou.html.erb +2 -0
  23. data/app/views/layouts/spud/inquiries/detail.html.erb +6 -0
  24. data/app/views/spud/admin/inquiries/index.html.erb +22 -0
  25. data/app/views/spud/admin/inquiries/show.html.erb +8 -0
  26. data/app/views/spud/admin/inquiry_forms/_form.html.erb +31 -0
  27. data/app/views/spud/admin/inquiry_forms/_spud_inquiry_form_field_fields.html.erb +34 -0
  28. data/app/views/spud/admin/inquiry_forms/edit.html.erb +13 -0
  29. data/app/views/spud/admin/inquiry_forms/index.html.erb +21 -0
  30. data/app/views/spud/admin/inquiry_forms/new.html.erb +13 -0
  31. data/app/views/spud/inquiries/sitemaps/show.xml.builder +16 -0
  32. data/app/views/spud/inquiry_mailer/inquiry_notification.html.erb +15 -0
  33. data/app/views/spud/inquiry_mailer/inquiry_notification.text.erb +8 -0
  34. data/config/application.rb +48 -0
  35. data/config/boot.rb +6 -0
  36. data/config/routes.rb +18 -0
  37. data/lib/spud_inquiries.rb +6 -0
  38. data/lib/spud_inquiries/configuration.rb +13 -0
  39. data/lib/spud_inquiries/engine.rb +17 -0
  40. metadata +94 -0
@@ -0,0 +1,8 @@
1
+ $(function() {
2
+ var initWysiwym = function() {
3
+ $('textarea.wysiwym').wymeditor({
4
+ basePath:'/assets/wymeditor/'
5
+ });
6
+ }
7
+ initWysiwym();
8
+ });
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,46 @@
1
+ class ContactsController < ApplicationController
2
+ def show
3
+ url_name = !params[:id].blank? ? params[:id] : Spud::Inquiries.default_contact_form
4
+ @inquiry_form = SpudInquiryForm.where(:url_name => url_name).includes(:spud_inquiry_form_fields).first
5
+ if @inquiry_form.blank?
6
+ flash[:error] = "Contact Inquiry Form not found!"
7
+ redirect_to root_url and return
8
+ end
9
+ render :layout => Spud::Inquiries.base_layout
10
+ end
11
+
12
+ def inquire
13
+ unless params[:spud_inquiry]
14
+ flash[:error] = "Inquiry Not Found!"
15
+ redirect_to request.referer and return
16
+ end
17
+ @inquiry_form = SpudInquiryForm.find(params[:spud_inquiry][:spud_inquiry_form_id])
18
+ if @inquiry_form.blank?
19
+ flash[:error] = "Form Not Found!"
20
+ redirect_to request.referer and return
21
+ end
22
+ @inquiry = SpudInquiry.new(:email => params[:spud_inquiry][:email],:spud_inquiry_form_id => params[:spud_inquiry][:spud_inquiry_form_id])
23
+
24
+ @inquiry.recipients = @inquiry_form.recipients
25
+ @inquiry.subject = @inquiry_form.subject
26
+
27
+ params[:spud_inquiry].each_pair do |key,value|
28
+ if key.to_s != "email" && key.to_s != "spud_inquiry_form_id"
29
+ @inquiry.spud_inquiry_fields.new(:name => key,:value => value)
30
+ end
31
+ end
32
+ if @inquiry.save
33
+ flash[:notice] = "Your inquiry was received!"
34
+ if !@inquiry.recipients.blank?
35
+ Spud::InquiryMailer.inquiry_notification(@inquiry).deliver
36
+ end
37
+ else
38
+ flash[:error] = "Whoops! Something went wrong. Please try again!"
39
+ end
40
+ redirect_to contact_thankyou_url
41
+ end
42
+
43
+ def thankyou
44
+ render :layout => Spud::Inquiries.base_layout
45
+ end
46
+ end
@@ -0,0 +1,38 @@
1
+ class Spud::Admin::InquiriesController < Spud::Admin::ApplicationController
2
+ layout 'spud/admin/detail'
3
+ belongs_to_spud_app :inquiries
4
+ add_breadcrumb "Inquiries", :spud_admin_inquiries_path
5
+ before_filter :load_inquiries,:only => [:edit,:update,:show,:destroy]
6
+ def index
7
+ @inquiries = SpudInquiry.order("created_at DESC").paginate :page => params[:page]
8
+ respond_with @inquiries
9
+ end
10
+
11
+ def show
12
+ add_breadcrumb "#{@inquiry.email}", :spud_admin_inquiry_path
13
+ respond_with @inquiry
14
+ end
15
+
16
+ def destroy
17
+ status = 500
18
+ if @inquiry.destroy
19
+ status = 200
20
+ end
21
+ respond_with @inquiry do |format|
22
+ format.js { render :status => status,:text => nil}
23
+ format.html {
24
+ flash[:error] = "Error removing inquiry!" if status == 500
25
+ flash[:notice] = "Inquiry removed!" if status == 200
26
+ redirect_to spud_admin_inquiries_path and return
27
+ }
28
+ end
29
+ end
30
+ private
31
+ def load_inquiries
32
+ @inquiry = SpudInquiry.where(:id => params[:id]).first
33
+ if @inquiry.blank?
34
+ flash[:error] = "Inquiry not found!"
35
+ redirect_to spud_admin_inquiries_path and return
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,50 @@
1
+ class Spud::Admin::InquiryFormsController < Spud::Admin::ApplicationController
2
+ layout 'spud/admin/detail'
3
+ belongs_to_spud_app :inquiries
4
+ add_breadcrumb "Inquiries", :spud_admin_inquiries_path
5
+ add_breadcrumb "Forms", :spud_admin_inquiry_forms_path
6
+ before_filter :load_form,:only => [:edit,:update,:show,:destroy]
7
+ def index
8
+
9
+ @page_name = "Inquiry Forms"
10
+ @inquiry_forms = SpudInquiryForm.order(:name).paginate :page => params[:page]
11
+ respond_with @inquiry_forms
12
+ end
13
+
14
+ def new
15
+ @page_name = "New Inquiry Form"
16
+ @inquiry_form = SpudInquiryForm.new
17
+ respond_with @inquiry_form
18
+ end
19
+
20
+ def create
21
+ @inquiry_form = SpudInquiryForm.new(params[:spud_inquiry_form])
22
+ flash[:notice] = "Form saved successfully!" if @inquiry_form.save
23
+
24
+ respond_with @inquiry_form,:location => spud_admin_inquiry_forms_url
25
+ end
26
+
27
+ def edit
28
+ @page_name = "Edit Inquiry Form"
29
+ respond_with @inquiry_form
30
+ end
31
+
32
+ def update
33
+ @page_name = "Edit Inquiry Form"
34
+ flash[:notice] = "Form saved successfully!" if @inquiry_form.update_attributes(params[:spud_inquiry_form])
35
+ respond_with @inquiry_form, :location => spud_admin_inquiry_forms_url
36
+ end
37
+
38
+ def destroy
39
+ flash[:notice] = "Inquiry form removed!" if @inquiry_form.destroy
40
+ respond_with @inquiry_form,:location => spud_admin_inquiry_forms_url
41
+ end
42
+ private
43
+ def load_form
44
+ @inquiry_form = SpudInquiryForm.where(:id => params[:id]).first
45
+ if @inquiry_form.blank?
46
+ flash[:error] = "Inquiry Form not found!"
47
+ redirect_to spud_admin_inquiry_forms_url() and return
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,7 @@
1
+ class Spud::Inquiries::SitemapsController < Spud::ApplicationController
2
+ caches_page :show,:expires_in => 1.day
3
+
4
+ def show
5
+ @forms = SpudInquiryForm.all
6
+ end
7
+ end
@@ -0,0 +1,2 @@
1
+ module ContactsHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module Spud::Admin::InquiriesHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module Spud::Admin::InquiryFormsHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module Spud::Admin::UsersHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module Spud::Inquiries::SitemapsHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module Spud::UserSessionsHelper
2
+ end
@@ -0,0 +1,9 @@
1
+ class Spud::InquiryMailer < ActionMailer::Base
2
+
3
+
4
+ def inquiry_notification(inquiry)
5
+ @inquiry = inquiry
6
+ @url = "/spud/admin/inquiries/#{@inquiry.id}"
7
+ mail(:from =>Spud::Inquiries.from_address,:to => @inquiry.recipients.split(","), :subject => @inquiry.subject.blank? ? "No Subject" : @inquiry.subject)
8
+ end
9
+ end
@@ -0,0 +1,6 @@
1
+ class SpudInquiry < ActiveRecord::Base
2
+ has_many :spud_inquiry_fields
3
+ belongs_to :spud_inquiry_form
4
+ accepts_nested_attributes_for :spud_inquiry_fields, :reject_if => lambda { |a| a[:name].blank? }
5
+
6
+ end
@@ -0,0 +1,3 @@
1
+ class SpudInquiryField < ActiveRecord::Base
2
+ belongs_to :spud_inquiry
3
+ end
@@ -0,0 +1,14 @@
1
+ class SpudInquiryForm < ActiveRecord::Base
2
+ has_many :spud_inquiries
3
+ has_many :spud_inquiry_form_fields,:dependent => :destroy,:order => "field_order ASC"
4
+
5
+ accepts_nested_attributes_for :spud_inquiry_form_fields, :reject_if => lambda { |a| a[:name].blank? }, :allow_destroy => true
6
+
7
+ validates :name,:presence => true,:uniqueness => true
8
+ validates :url_name,:presence => true, :uniqueness => true
9
+ before_validation :generate_url_name
10
+
11
+ def generate_url_name
12
+ self.url_name = self.name.gsub(/[^a-zA-Z0-9\ ]/," ").gsub(/\ \ +/," ").gsub(/\ /,"-").downcase
13
+ end
14
+ end
@@ -0,0 +1,6 @@
1
+ class SpudInquiryFormField < ActiveRecord::Base
2
+ belongs_to :spud_inquiry_form
3
+ validates :name,:presence => true
4
+ validates :field_type,:presence => true
5
+
6
+ end
@@ -0,0 +1,35 @@
1
+ <h2><%=@inquiry_form.name%></h2>
2
+ <%=@inquiry_form.content.html_safe if !@inquiry_form.content.blank?%>
3
+
4
+ <%=form_for :spud_inquiry, :url => "/contact/inquire" do |f|%>
5
+ <fieldset>
6
+ <%=f.hidden_field :spud_inquiry_form_id,:value => @inquiry_form.id%>
7
+ <ol>
8
+ <li>
9
+ <%=f.label :email%>
10
+ <%=f.text_field :email%>
11
+ </li>
12
+ <%@inquiry_form.spud_inquiry_form_fields.each do |field|%>
13
+ <li>
14
+ <%=f.label field.name%>
15
+
16
+ <%=case field.field_type
17
+ when '0'
18
+ f.text_field field.name,:value => field.default_value
19
+ when '1'
20
+ f.check_box field.name
21
+ when '2'
22
+ f.text_area field.name
23
+ when '3'
24
+ f.select field.name,field.options.split(",").collect {|opt| [opt,opt]},:include_blank => true
25
+ end%>
26
+ </li>
27
+ <%end%>
28
+ <li style="text-align:center;">
29
+ <%=f.submit "Submit Inquiry"%>
30
+ </li>
31
+ </ol>
32
+
33
+ </fieldset>
34
+
35
+ <%end%>
@@ -0,0 +1,2 @@
1
+ <h2>Thank you</h2>
2
+ <p>Thank you for your inquiry. A representitive will get back to you as soon as possible</p>
@@ -0,0 +1,6 @@
1
+ <%=content_for :head do%>
2
+ <%= javascript_include_tag "wymeditor/jquery.wymeditor.pack" %>
3
+ <%= stylesheet_link_tag "spud/admin/inquiries" %>
4
+ <%= javascript_include_tag "spud/admin/inquiries" %>
5
+ <%end%>
6
+ <%= render :template => 'layouts/spud/admin/detail' %>
@@ -0,0 +1,22 @@
1
+ <%=content_for :data_controls do%>
2
+ <%=link_to "Forms",spud_admin_inquiry_forms_path(),:class => "button",:title => "Forms"%>
3
+ <%end%>
4
+
5
+ <%=content_for :detail do%>
6
+ <div class="page_list">
7
+ <%@inquiries.each do |inquiry|%>
8
+ <div class="page_row">
9
+
10
+ <span class="row_meta"><%=link_to inquiry.email,spud_admin_inquiry_path(inquiry)%></span>
11
+
12
+ <span class="edit_controls">
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>
15
+ <br style="clear:both;"/>
16
+ </div>
17
+ <%end%>
18
+ <%=will_paginate @inquiries%>
19
+
20
+ </div>
21
+
22
+ <%end%>
@@ -0,0 +1,8 @@
1
+ <%=content_for :detail do%>
2
+ <p><strong>From:</strong> <%=link_to @inquiry.email,"mailto:#{@inquiry.email}"%></p>
3
+ <%@inquiry.spud_inquiry_fields.each do |field|%>
4
+ <p><strong><%=field.name%></strong>
5
+ <%=field.value%>
6
+ </p>
7
+ <%end%>
8
+ <%end%>
@@ -0,0 +1,31 @@
1
+
2
+ <fieldset>
3
+ <legend>Form Info</legend>
4
+ <ol>
5
+ <li>
6
+ <%=error_message_on "page","name"%>
7
+ <%=f.label :name, :required=>true%>
8
+ <%=f.text_field :name%>
9
+ </li>
10
+ <li>
11
+ <%=error_message_on "page","recipients"%>
12
+ <%=f.label :recipients, :required=>true%>
13
+ <%=f.text_field :recipients%>
14
+ </li>
15
+ <li>
16
+ <%=error_message_on "page","subject"%>
17
+ <%=f.label :subject, :required=>true%>
18
+ <%=f.text_field :subject%>
19
+ </li>
20
+ <li>
21
+ <%=error_message_on "page","content"%>
22
+ <%=f.label :content, :required=>true%>
23
+ <%=f.text_area :content,:cols => 75,:rows => 5,:class => "wysiwym"%>
24
+ </li>
25
+ </ol>
26
+ </fieldset>
27
+
28
+ <%=f.fields_for :spud_inquiry_form_fields do |builder|%>
29
+ <%=render "spud_inquiry_form_field_fields",:f => builder%>
30
+ <%end%>
31
+ <p><%= link_to_add_fields "Add Field", f, :spud_inquiry_form_fields %></p>
@@ -0,0 +1,34 @@
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]]%>
11
+
12
+
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>
31
+ <%= link_to_remove_fields "Remove", f %>
32
+ </li>
33
+ </ol>
34
+ </fieldset>
@@ -0,0 +1,13 @@
1
+ <%=form_for @inquiry_form,:url => spud_admin_inquiry_form_path(@inquiry_form),:html=>{:class=>"right_aligned_form"} do |f|%>
2
+ <%=render :partial => "form",:locals => {:f => f}%>
3
+ <fieldset class="submit">
4
+ <%=f.submit%> or <%=link_to "cancel",request.referer%>
5
+ </fieldset>
6
+ <%end%>
7
+ <br />
8
+
9
+ <script type="text/javascript">
10
+ $('input[type=submit],.close_dialog').button();
11
+
12
+ </script>
13
+
@@ -0,0 +1,21 @@
1
+ <%=content_for :data_controls do%>
2
+ <%=link_to "New Form",new_spud_admin_inquiry_form_path(),:class => "button",:title => "New Form"%>
3
+ <%end%>
4
+ <%=content_for :detail do%>
5
+ <div class="page_list">
6
+ <%@inquiry_forms.each do |inquiry_form|%>
7
+ <div class="page_row">
8
+
9
+ <span class="row_meta"><%=link_to inquiry_form.name,edit_spud_admin_inquiry_form_path(inquiry_form)%></span>
10
+
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>
14
+ <br style="clear:both;"/>
15
+ </div>
16
+ <%end%>
17
+ <%=will_paginate @inquiry_forms%>
18
+
19
+ </div>
20
+
21
+ <%end%>
@@ -0,0 +1,13 @@
1
+ <%=form_for @inquiry_form,:url => spud_admin_inquiry_forms_path(),:html=>{:class=>"right_aligned_form"} do |f|%>
2
+ <%=render :partial => "form",:locals => {:f => f}%>
3
+ <fieldset class="submit">
4
+ <%=f.submit%> or <%=link_to "cancel",request.referer%>
5
+ </fieldset>
6
+ <%end%>
7
+ <br />
8
+
9
+ <script type="text/javascript">
10
+ $('input[type=submit],.close_dialog').button();
11
+
12
+ </script>
13
+
@@ -0,0 +1,16 @@
1
+
2
+ xml.instruct! :xml, :version => '1.0', :encoding => 'UTF-8'
3
+
4
+ # create the urlset
5
+ xml.urlset :xmlns => 'http://www.sitemaps.org/schemas/sitemap/0.9' do
6
+ @forms.each do |form|
7
+ xml.url do
8
+ if form.url_name == Spud::Inquiries.default_contact_form
9
+ xml.loc contact_url()
10
+ else
11
+ xml.loc contact_url(:id => form.url_name)
12
+ end
13
+ xml.lastmod form.updated_at.strftime('%Y-%m-%d')
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
5
+ </head>
6
+ <body>
7
+ <h2>Inquiry Received</h2>
8
+ <p><strong>From:</strong> <%=link_to @inquiry.email,"mailto:#{@inquiry.email}"%></p>
9
+ <%@inquiry.spud_inquiry_fields.each do |field|%>
10
+ <p><strong><%=field.name%></strong>
11
+ <%=field.value%>
12
+ </p>
13
+ <%end%>
14
+ </body>
15
+ </html>
@@ -0,0 +1,8 @@
1
+
2
+ Inquiry Received
3
+ =================
4
+
5
+ From: <%=@inquiry.email%>
6
+ <%@inquiry.spud_inquiry_fields.each do |field|%>
7
+ <%=field.name%>: <%=field.value%>
8
+ <%end%>
@@ -0,0 +1,48 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ if defined?(Bundler)
6
+ # If you precompile assets before deploying to production, use this line
7
+ Bundler.require *Rails.groups(:assets => %w(development test))
8
+ # If you want your assets lazily compiled in production, use this line
9
+ # Bundler.require(:default, :assets, Rails.env)
10
+ end
11
+
12
+ module SpudTest
13
+ class Application < Rails::Application
14
+ # Settings in config/environments/* take precedence over those specified here.
15
+ # Application configuration should go into files in config/initializers
16
+ # -- all .rb files in that directory are automatically loaded.
17
+
18
+ # Custom directories with classes and modules you want to be autoloadable.
19
+ # config.autoload_paths += %W(#{config.root}/extras)
20
+
21
+ # Only load the plugins named here, in the order given (default is alphabetical).
22
+ # :all can be used as a placeholder for all plugins not explicitly named.
23
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
24
+
25
+ # Activate observers that should always be running.
26
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
27
+
28
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
29
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
30
+ # config.time_zone = 'Central Time (US & Canada)'
31
+
32
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
33
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
34
+ # config.i18n.default_locale = :de
35
+
36
+ # Configure the default encoding used in templates for Ruby 1.9.
37
+ config.encoding = "utf-8"
38
+
39
+ # Configure sensitive parameters which will be filtered from the log file.
40
+ config.filter_parameters += [:password]
41
+
42
+ # Enable the asset pipeline
43
+ config.assets.enabled = true
44
+
45
+ # Version of your assets, change this if you want to expire all your assets
46
+ config.assets.version = '1.0'
47
+ end
48
+ end
data/config/boot.rb ADDED
@@ -0,0 +1,6 @@
1
+ require 'rubygems'
2
+
3
+ # Set up gems listed in the Gemfile.
4
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
5
+
6
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
data/config/routes.rb ADDED
@@ -0,0 +1,18 @@
1
+ Rails.application.routes.draw do
2
+ namespace :spud do
3
+ namespace :admin do
4
+ resources :inquiries
5
+ resources :inquiry_forms
6
+ end
7
+ namespace :inquiries do
8
+ resource :sitemap,:only => [:show]
9
+ end
10
+ end
11
+ match "/contact" => "contacts#show"
12
+ post "contact/inquire" => "contacts#inquire"
13
+ match "contact/thankyou" => "contacts#thankyou"
14
+ match "/contact/:id" => "contacts#show"
15
+
16
+
17
+ end
18
+
@@ -0,0 +1,6 @@
1
+ module Spud
2
+ module Inquiries
3
+ require 'spud_inquiries/configuration'
4
+ require 'spud_inquiries/engine' if defined?(Rails)
5
+ end
6
+ end
@@ -0,0 +1,13 @@
1
+ module Spud
2
+ module Inquiries
3
+ include ActiveSupport::Configurable
4
+
5
+ config_accessor :default_contact_form,:mail_delivery_format,:base_layout,:from_address,:enable_sitemap
6
+
7
+ self.default_contact_form = "contact"
8
+ self.base_layout = "application"
9
+ self.mail_delivery_format = :html
10
+ self.from_address = "no-reply@example.org"
11
+ self.enable_sitemap = true
12
+ end
13
+ end
@@ -0,0 +1,17 @@
1
+ require 'spud_core'
2
+ module Spud
3
+ module Inquiries
4
+ class Engine < Rails::Engine
5
+ engine_name :spud_inquiries
6
+ initializer :admin do
7
+ Spud::Core.configure do |config|
8
+ config.admin_applications += [{:name => "Inquiries",:thumbnail => "spud/admin/contacts_thumb.png",:url => "/spud/admin/inquiries",:order => 88}]
9
+ if Spud::Inquiries.enable_sitemap == true
10
+ config.sitemap_urls += [:spud_inquiries_sitemap_url]
11
+ end
12
+ end
13
+
14
+ end
15
+ end
16
+ end
17
+ end
metadata ADDED
@@ -0,0 +1,94 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: spud_inquiries
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - David Estes
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-01-30 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: spud_core
16
+ requirement: &70274607365740 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 0.3.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70274607365740
25
+ description:
26
+ email: destes@redwindsw.com
27
+ executables: []
28
+ extensions: []
29
+ extra_rdoc_files: []
30
+ files:
31
+ - app/assets/images/spud/admin/contacts_thumb.png
32
+ - app/assets/javascripts/spud/admin/inquiries.js
33
+ - app/assets/javascripts/spud/inquiries/sitemaps.js
34
+ - app/assets/stylesheets/spud/admin/inquiries.css
35
+ - app/assets/stylesheets/spud/inquiries/sitemaps.css
36
+ - app/controllers/contacts_controller.rb
37
+ - app/controllers/spud/admin/inquiries_controller.rb
38
+ - app/controllers/spud/admin/inquiry_forms_controller.rb
39
+ - app/controllers/spud/inquiries/sitemaps_controller.rb
40
+ - app/helpers/contacts_helper.rb
41
+ - app/helpers/spud/admin/inquiries_helper.rb
42
+ - app/helpers/spud/admin/inquiry_forms_helper.rb
43
+ - app/helpers/spud/admin/users_helper.rb
44
+ - app/helpers/spud/inquiries/sitemaps_helper.rb
45
+ - app/helpers/spud/user_sessions_helper.rb
46
+ - app/mailers/spud/inquiry_mailer.rb
47
+ - app/models/spud_inquiry.rb
48
+ - app/models/spud_inquiry_field.rb
49
+ - app/models/spud_inquiry_form.rb
50
+ - app/models/spud_inquiry_form_field.rb
51
+ - app/views/contacts/show.html.erb
52
+ - app/views/contacts/thankyou.html.erb
53
+ - app/views/layouts/spud/inquiries/detail.html.erb
54
+ - app/views/spud/admin/inquiries/index.html.erb
55
+ - app/views/spud/admin/inquiries/show.html.erb
56
+ - app/views/spud/admin/inquiry_forms/_form.html.erb
57
+ - app/views/spud/admin/inquiry_forms/_spud_inquiry_form_field_fields.html.erb
58
+ - app/views/spud/admin/inquiry_forms/edit.html.erb
59
+ - app/views/spud/admin/inquiry_forms/index.html.erb
60
+ - app/views/spud/admin/inquiry_forms/new.html.erb
61
+ - app/views/spud/inquiries/sitemaps/show.xml.builder
62
+ - app/views/spud/inquiry_mailer/inquiry_notification.html.erb
63
+ - app/views/spud/inquiry_mailer/inquiry_notification.text.erb
64
+ - config/application.rb
65
+ - config/boot.rb
66
+ - config/routes.rb
67
+ - lib/spud_inquiries.rb
68
+ - lib/spud_inquiries/configuration.rb
69
+ - lib/spud_inquiries/engine.rb
70
+ homepage:
71
+ licenses: []
72
+ post_install_message:
73
+ rdoc_options: []
74
+ require_paths:
75
+ - lib
76
+ required_ruby_version: !ruby/object:Gem::Requirement
77
+ none: false
78
+ requirements:
79
+ - - ! '>='
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ requirements: []
89
+ rubyforge_project:
90
+ rubygems_version: 1.8.15
91
+ signing_key:
92
+ specification_version: 3
93
+ summary: Spud Inquiry/Contact Form Engine
94
+ test_files: []