refinerycms-inquiries 1.0.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/.travis.yml +16 -0
- data/Gemfile +68 -0
- data/Guardfile +20 -0
- data/Rakefile +19 -0
- data/app/assets/stylesheets/refinery/inquiries/inquiries.css.scss +21 -0
- data/app/controllers/refinery/inquiries/admin/inquiries_controller.rb +50 -0
- data/app/controllers/refinery/inquiries/admin/settings_controller.rb +56 -0
- data/app/controllers/refinery/inquiries/inquiries_controller.rb +47 -0
- data/app/helpers/refinery/inquiries/inquiries_helper.rb +6 -0
- data/app/mailers/refinery/inquiries/inquiry_mailer.rb +22 -0
- data/app/models/refinery/inquiries/inquiry.rb +27 -0
- data/app/models/refinery/inquiries/setting.rb +63 -0
- data/app/views/refinery/inquiries/admin/inquiries/_inquiry.html.erb +27 -0
- data/app/views/refinery/inquiries/admin/inquiries/_submenu.html.erb +27 -0
- data/app/views/{admin → refinery/inquiries/admin}/inquiries/index.html.erb +2 -2
- data/app/views/{admin → refinery/inquiries/admin}/inquiries/show.html.erb +9 -7
- data/app/views/refinery/inquiries/admin/settings/_confirmation_email_form.html.erb +59 -0
- data/app/views/{admin/inquiry_settings → refinery/inquiries/admin/settings}/_notification_recipients_form.html.erb +3 -3
- data/app/views/{admin/inquiry_settings → refinery/inquiries/admin/settings}/edit.html.erb +1 -1
- data/app/views/refinery/inquiries/inquiries/new.html.erb +32 -0
- data/app/views/refinery/inquiries/inquiries/thank_you.html.erb +1 -0
- data/app/views/refinery/inquiries/inquiry_mailer/confirmation.text.erb +1 -0
- data/app/views/refinery/inquiries/inquiry_mailer/notification.text.erb +18 -0
- data/config/locales/bg.yml +77 -0
- data/config/locales/cs.yml +68 -66
- data/config/locales/da.yml +60 -58
- data/config/locales/de.yml +69 -67
- data/config/locales/en-GB.yml +68 -66
- data/config/locales/en.yml +68 -66
- data/config/locales/es.yml +71 -69
- data/config/locales/fr.yml +69 -67
- data/config/locales/it.yml +70 -68
- data/config/locales/lolcat.yml +69 -67
- data/config/locales/lt.yml +69 -67
- data/config/locales/lv.yml +69 -67
- data/config/locales/nb.yml +70 -68
- data/config/locales/nl.yml +69 -67
- data/config/locales/pl.yml +69 -67
- data/config/locales/pt-BR.yml +69 -67
- data/config/locales/ru.yml +69 -67
- data/config/locales/sk.yml +69 -67
- data/config/locales/sl.yml +69 -67
- data/config/locales/sv.yml +69 -67
- data/config/locales/zh-CN.yml +69 -67
- data/config/routes.rb +16 -16
- data/db/migrate/20101208082840_create_inquiries.rb +16 -34
- data/db/seeds.rb +50 -0
- data/lib/generators/refinery/inquiries/inquiries_generator.rb +19 -0
- data/lib/refinery/inquiries/configuration.rb +9 -0
- data/lib/refinery/inquiries/engine.rb +28 -0
- data/lib/refinery/inquiries.rb +26 -0
- data/lib/refinerycms-inquiries.rb +1 -23
- data/readme.md +12 -4
- data/refinerycms-inquiries.gemspec +11 -86
- data/spec/factories/inquiry.rb +7 -0
- data/spec/models/refinery/inquiries/inquiry_spec.rb +52 -0
- data/spec/requests/refinery/inquiries/admin/inquiries_spec.rb +138 -0
- data/spec/requests/refinery/inquiries/inquiries_spec.rb +81 -0
- data/spec/spec_helper.rb +56 -0
- data/tasks/rspec.rake +4 -0
- metadata +114 -39
- data/app/controllers/admin/inquiries_controller.rb +0 -41
- data/app/controllers/admin/inquiry_settings_controller.rb +0 -43
- data/app/controllers/inquiries_controller.rb +0 -43
- data/app/helpers/inquiries_helper.rb +0 -2
- data/app/mailers/inquiry_mailer.rb +0 -20
- data/app/models/inquiry.rb +0 -21
- data/app/models/inquiry_setting.rb +0 -33
- data/app/views/admin/inquiries/_inquiry.html.erb +0 -24
- data/app/views/admin/inquiries/_submenu.html.erb +0 -27
- data/app/views/admin/inquiry_settings/_confirmation_email_form.html.erb +0 -57
- data/app/views/inquiries/new.html.erb +0 -34
- data/app/views/inquiries/thank_you.html.erb +0 -1
- data/app/views/inquiry_mailer/confirmation.html.erb +0 -1
- data/app/views/inquiry_mailer/notification.html.erb +0 -18
- data/db/migrate/20101208082841_remove_position_and_open_from_inquiries.rb +0 -11
- data/db/seeds/pages_for_inquiries.rb +0 -55
- data/features/create_inquiries.feature +0 -38
- data/features/manage_inquiries.feature +0 -57
- data/features/step_definitions/inquiry_steps.rb +0 -25
- data/features/support/factories.rb +0 -7
- data/features/support/paths.rb +0 -26
- data/lib/gemspec.rb +0 -29
- data/lib/generators/refinerycms_inquiries_generator.rb +0 -6
- data/lib/inquiries.rb +0 -2
- data/spec/models/inquiry_spec.rb +0 -59
data/.gitignore
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
before_script:
|
2
|
+
- "bundle exec rake refinery:testing:dummy_app > /dev/null"
|
3
|
+
script: "bundle exec rspec ./spec"
|
4
|
+
notifications:
|
5
|
+
email:
|
6
|
+
- parndt@gmail.com
|
7
|
+
- ugis.ozolss@gmail.com
|
8
|
+
env:
|
9
|
+
- DB=postgresql
|
10
|
+
- DB=mysql
|
11
|
+
rvm:
|
12
|
+
- 1.8.7
|
13
|
+
- 1.9.2
|
14
|
+
- 1.9.3
|
15
|
+
- rbx
|
16
|
+
- jruby
|
data/Gemfile
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
source 'http://rubygems.org'
|
2
|
+
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
gem 'refinerycms', '~> 2.0.0'
|
6
|
+
|
7
|
+
group :development, :test do
|
8
|
+
require 'rbconfig'
|
9
|
+
|
10
|
+
gem 'refinerycms-testing', '~> 2.0.0'
|
11
|
+
|
12
|
+
platforms :jruby do
|
13
|
+
gem 'activerecord-jdbcsqlite3-adapter'
|
14
|
+
gem 'activerecord-jdbcmysql-adapter'
|
15
|
+
gem 'activerecord-jdbcpostgresql-adapter'
|
16
|
+
gem 'jruby-openssl'
|
17
|
+
end
|
18
|
+
|
19
|
+
unless defined?(JRUBY_VERSION)
|
20
|
+
gem 'sqlite3'
|
21
|
+
gem 'mysql2'
|
22
|
+
gem 'pg'
|
23
|
+
end
|
24
|
+
|
25
|
+
platforms :mswin, :mingw do
|
26
|
+
gem 'win32console'
|
27
|
+
gem 'rb-fchange', '~> 0.0.5'
|
28
|
+
gem 'rb-notifu', '~> 0.0.4'
|
29
|
+
end
|
30
|
+
|
31
|
+
platforms :ruby do
|
32
|
+
gem 'spork', '0.9.0.rc9'
|
33
|
+
gem 'guard-spork'
|
34
|
+
|
35
|
+
unless ENV['TRAVIS']
|
36
|
+
if RbConfig::CONFIG['target_os'] =~ /darwin/i
|
37
|
+
gem 'rb-fsevent', '>= 0.3.9'
|
38
|
+
gem 'growl', '~> 1.0.3'
|
39
|
+
end
|
40
|
+
if RbConfig::CONFIG['target_os'] =~ /linux/i
|
41
|
+
gem 'rb-inotify', '>= 0.5.1'
|
42
|
+
gem 'libnotify', '~> 0.1.3'
|
43
|
+
gem 'therubyracer', '~> 0.9.9'
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
platforms :jruby do
|
49
|
+
unless ENV['TRAVIS']
|
50
|
+
if RbConfig::CONFIG['target_os'] =~ /darwin/i
|
51
|
+
gem 'growl', '~> 1.0.3'
|
52
|
+
end
|
53
|
+
if RbConfig::CONFIG['target_os'] =~ /linux/i
|
54
|
+
gem 'rb-inotify', '>= 0.5.1'
|
55
|
+
gem 'libnotify', '~> 0.1.3'
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# Refinery/rails should pull in the proper versions of these
|
62
|
+
group :assets do
|
63
|
+
gem 'sass-rails'
|
64
|
+
gem 'coffee-rails'
|
65
|
+
gem 'uglifier'
|
66
|
+
end
|
67
|
+
|
68
|
+
gem 'jquery-rails'
|
data/Guardfile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
guard 'rspec', :version => 2, :cli => "--format Fuubar --color --drb" do
|
2
|
+
watch(%r{^spec/.+_spec\.rb$})
|
3
|
+
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
4
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
5
|
+
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/controllers/#{m[1]}_#{m[2]}_spec.rb", "spec/requests/#{m[1]}_spec.rb"] }
|
6
|
+
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
7
|
+
watch('spec/spec_helper.rb') { "spec" }
|
8
|
+
watch('config/routes.rb') { "spec/routing" }
|
9
|
+
watch('app/controllers/application_controller.rb') { "spec/controllers" }
|
10
|
+
# Capybara request specs
|
11
|
+
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
|
12
|
+
end
|
13
|
+
|
14
|
+
guard 'spork', :wait => 60, :cucumber => false, :rspec_env => { 'RAILS_ENV' => 'test' } do
|
15
|
+
watch('config/application.rb')
|
16
|
+
watch('config/environment.rb')
|
17
|
+
watch(%r{^config/environments/.+\.rb$})
|
18
|
+
watch(%r{^config/initializers/.+\.rb$})
|
19
|
+
watch('spec/spec_helper.rb')
|
20
|
+
end
|
data/Rakefile
ADDED
@@ -0,0 +1,19 @@
|
|
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
|
+
|
8
|
+
ENGINE_PATH = File.dirname(__FILE__)
|
9
|
+
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
10
|
+
|
11
|
+
if File.exists?(APP_RAKEFILE)
|
12
|
+
load 'rails/tasks/engine.rake'
|
13
|
+
end
|
14
|
+
|
15
|
+
require "refinerycms-testing"
|
16
|
+
Refinery::Testing::Railtie.load_tasks
|
17
|
+
Refinery::Testing::Railtie.load_dummy_tasks(ENGINE_PATH)
|
18
|
+
|
19
|
+
load File.expand_path('../tasks/rspec.rake', __FILE__)
|
@@ -0,0 +1,21 @@
|
|
1
|
+
.inquiries {
|
2
|
+
form {
|
3
|
+
padding-top: 12px;
|
4
|
+
label {
|
5
|
+
width: 150px;
|
6
|
+
float: left;
|
7
|
+
}
|
8
|
+
input {
|
9
|
+
width: 200px;
|
10
|
+
}
|
11
|
+
.field {
|
12
|
+
margin: 12px 0px;
|
13
|
+
}
|
14
|
+
.actions {
|
15
|
+
margin-left: 150px;
|
16
|
+
input {
|
17
|
+
width: auto;
|
18
|
+
}
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Refinery
|
2
|
+
module Inquiries
|
3
|
+
module Admin
|
4
|
+
class InquiriesController < ::Refinery::AdminController
|
5
|
+
|
6
|
+
crudify :'refinery/inquiries/inquiry',
|
7
|
+
:title_attribute => "name",
|
8
|
+
:order => "created_at DESC"
|
9
|
+
|
10
|
+
helper_method :group_by_date
|
11
|
+
|
12
|
+
before_filter :find_all_ham, :only => [:index]
|
13
|
+
before_filter :find_all_spam, :only => [:spam]
|
14
|
+
before_filter :get_spam_count, :only => [:index, :spam]
|
15
|
+
|
16
|
+
def index
|
17
|
+
@inquiries = @inquiries.with_query(params[:search]) if searching?
|
18
|
+
@inquiries = @inquiries.page(params[:page])
|
19
|
+
end
|
20
|
+
|
21
|
+
def spam
|
22
|
+
self.index
|
23
|
+
render :action => 'index'
|
24
|
+
end
|
25
|
+
|
26
|
+
def toggle_spam
|
27
|
+
find_inquiry
|
28
|
+
@inquiry.toggle!(:spam)
|
29
|
+
|
30
|
+
redirect_to :back
|
31
|
+
end
|
32
|
+
|
33
|
+
protected
|
34
|
+
|
35
|
+
def find_all_ham
|
36
|
+
@inquiries = Refinery::Inquiries::Inquiry.ham
|
37
|
+
end
|
38
|
+
|
39
|
+
def find_all_spam
|
40
|
+
@inquiries = Refinery::Inquiries::Inquiry.spam
|
41
|
+
end
|
42
|
+
|
43
|
+
def get_spam_count
|
44
|
+
@spam_count = Refinery::Inquiries::Inquiry.count(:conditions => {:spam => true})
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module Refinery
|
2
|
+
module Inquiries
|
3
|
+
module Admin
|
4
|
+
class SettingsController < ::Refinery::AdminController
|
5
|
+
|
6
|
+
crudify :'refinery/setting',
|
7
|
+
:title_attribute => "name",
|
8
|
+
:order => 'name ASC',
|
9
|
+
:redirect_to_url => 'refinery.inquiries_admin_inquiries_path'
|
10
|
+
|
11
|
+
before_filter :set_url_override?, :only => [:edit, :update]
|
12
|
+
after_filter :save_subject_for_confirmation?, :only => :update
|
13
|
+
after_filter :save_message_for_confirmation?, :only => :update
|
14
|
+
around_filter :rewrite_flash?, :only => :update
|
15
|
+
|
16
|
+
protected
|
17
|
+
|
18
|
+
def rewrite_flash?
|
19
|
+
yield
|
20
|
+
|
21
|
+
flash[:notice] = flash[:notice].to_s.gsub(/(\'.*\')/) {|m| m.titleize}.gsub('Inquiry ', '')
|
22
|
+
end
|
23
|
+
|
24
|
+
def save_subject_for_confirmation?
|
25
|
+
Refinery::Inquiries::Setting.confirmation_subject = params[:subject] if params.keys.include?('subject')
|
26
|
+
end
|
27
|
+
|
28
|
+
def save_message_for_confirmation?
|
29
|
+
Refinery::Inquiries::Setting.confirmation_message = params[:message] if params.keys.include?('message')
|
30
|
+
end
|
31
|
+
|
32
|
+
def set_url_override?
|
33
|
+
@url_override = refinery.inquiries_admin_setting_path(@setting, :dialog => from_dialog?)
|
34
|
+
end
|
35
|
+
|
36
|
+
def find_setting
|
37
|
+
# ensure that we're dealing with the name of the setting, not the id.
|
38
|
+
begin
|
39
|
+
if params[:id].to_i.to_s == params[:id]
|
40
|
+
params[:id] = Refinery::Setting.find(params[:id]).name.to_s
|
41
|
+
end
|
42
|
+
rescue
|
43
|
+
end
|
44
|
+
|
45
|
+
# prime the setting first, if it's valid.
|
46
|
+
if Refinery::Inquiries::Setting.methods.map(&:to_sym).include?(params[:id].to_s.gsub('inquiry_', '').to_sym)
|
47
|
+
Refinery::Inquiries::Setting.send(params[:id].to_s.gsub('inquiry_', '').to_sym)
|
48
|
+
end
|
49
|
+
|
50
|
+
@setting = Refinery::Setting.find_by_name(params[:id])
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Refinery
|
2
|
+
module Inquiries
|
3
|
+
class InquiriesController < ::ApplicationController
|
4
|
+
|
5
|
+
before_filter :find_page, :only => [:create, :new]
|
6
|
+
|
7
|
+
def thank_you
|
8
|
+
@page = ::Refinery::Page.find_by_link_url("/contact/thank_you")
|
9
|
+
end
|
10
|
+
|
11
|
+
def new
|
12
|
+
@inquiry = ::Refinery::Inquiries::Inquiry.new
|
13
|
+
end
|
14
|
+
|
15
|
+
def create
|
16
|
+
@inquiry = ::Refinery::Inquiries::Inquiry.new(params[:inquiry])
|
17
|
+
|
18
|
+
if @inquiry.save
|
19
|
+
if @inquiry.ham?
|
20
|
+
begin
|
21
|
+
::Refinery::Inquiries::InquiryMailer.notification(@inquiry, request).deliver
|
22
|
+
rescue
|
23
|
+
logger.warn "There was an error delivering an inquiry notification.\n#{$!}\n"
|
24
|
+
end
|
25
|
+
|
26
|
+
begin
|
27
|
+
::Refinery::Inquiries::InquiryMailer.confirmation(@inquiry, request).deliver
|
28
|
+
rescue
|
29
|
+
logger.warn "There was an error delivering an inquiry confirmation:\n#{$!}\n"
|
30
|
+
end if ::Refinery::Inquiries::Setting.send_confirmation?
|
31
|
+
end
|
32
|
+
|
33
|
+
redirect_to refinery.thank_you_inquiries_inquiries_path
|
34
|
+
else
|
35
|
+
render :action => 'new'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
protected
|
40
|
+
|
41
|
+
def find_page
|
42
|
+
@page = ::Refinery::Page.find_by_link_url("/contact")
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Refinery
|
2
|
+
module Inquiries
|
3
|
+
class InquiryMailer < ActionMailer::Base
|
4
|
+
|
5
|
+
def confirmation(inquiry, request)
|
6
|
+
@inquiry = inquiry
|
7
|
+
mail :subject => Refinery::Inquiries::Setting.confirmation_subject(Globalize.locale),
|
8
|
+
:to => inquiry.email,
|
9
|
+
:from => "\"#{Refinery::Core.site_name}\" <no-reply@#{request.domain}>",
|
10
|
+
:reply_to => Refinery::Inquiries::Setting.notification_recipients.split(',').first
|
11
|
+
end
|
12
|
+
|
13
|
+
def notification(inquiry, request)
|
14
|
+
@inquiry = inquiry
|
15
|
+
mail :subject => Refinery::Inquiries::Setting.notification_subject,
|
16
|
+
:to => Refinery::Inquiries::Setting.notification_recipients,
|
17
|
+
:from => "\"#{Refinery::Core.site_name}\" <no-reply@#{request.domain}>"
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Refinery
|
2
|
+
module Inquiries
|
3
|
+
class Inquiry < Refinery::Core::BaseModel
|
4
|
+
|
5
|
+
filters_spam :message_field => :message,
|
6
|
+
:email_field => :email,
|
7
|
+
:author_field => :name,
|
8
|
+
:other_fields => [:phone],
|
9
|
+
:extra_spam_words => %w()
|
10
|
+
|
11
|
+
validates :name, :presence => true
|
12
|
+
validates :message, :presence => true
|
13
|
+
validates :email, :format=> { :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i }
|
14
|
+
|
15
|
+
acts_as_indexed :fields => [:name, :email, :message, :phone]
|
16
|
+
|
17
|
+
default_scope :order => 'created_at DESC'
|
18
|
+
|
19
|
+
attr_accessible :name, :phone, :message, :email
|
20
|
+
|
21
|
+
def self.latest(number = 7, include_spam = false)
|
22
|
+
include_spam ? limit(number) : ham.limit(number)
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module Refinery
|
2
|
+
module Inquiries
|
3
|
+
class Setting
|
4
|
+
|
5
|
+
class << self
|
6
|
+
def confirmation_body
|
7
|
+
Refinery::Setting.find_or_set(:inquiry_confirmation_body,
|
8
|
+
"Thank you for your inquiry %name%,\n\nThis email is a receipt to confirm we have received your inquiry and we'll be in touch shortly.\n\nThanks."
|
9
|
+
)
|
10
|
+
end
|
11
|
+
|
12
|
+
def confirmation_subject(locale='en')
|
13
|
+
Refinery::Setting.find_or_set("inquiry_confirmation_subject_#{locale}".to_sym,
|
14
|
+
"Thank you for your inquiry",
|
15
|
+
:scoping => "inquiries")
|
16
|
+
end
|
17
|
+
|
18
|
+
def confirmation_subject=(value)
|
19
|
+
value.first.keys.each do |locale|
|
20
|
+
Refinery::Setting.set("inquiry_confirmation_subject_#{locale}".to_sym, {
|
21
|
+
:value => value.first[locale.to_sym],
|
22
|
+
:scoping => "inquiries"
|
23
|
+
})
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def confirmation_message(locale='en')
|
28
|
+
Refinery::Setting.find_or_set("inquiry_confirmation_message_#{locale}".to_sym,
|
29
|
+
Refinery::Setting[:inquiry_confirmation_body],
|
30
|
+
:scoping => "inquiries")
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
def confirmation_message=(value)
|
35
|
+
value.first.keys.each do |locale|
|
36
|
+
Refinery::Setting.set("inquiry_confirmation_message_#{locale}".to_sym, {
|
37
|
+
:value => value.first[locale.to_sym],
|
38
|
+
:scoping => "inquiries"
|
39
|
+
})
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def notification_recipients
|
44
|
+
Refinery::Setting.find_or_set(:inquiry_notification_recipients,
|
45
|
+
((Refinery::Role[:refinery].users.first.email rescue nil) if defined?(Refinery::Role)).to_s,
|
46
|
+
:scoping => "inquiries")
|
47
|
+
end
|
48
|
+
|
49
|
+
def notification_subject
|
50
|
+
Refinery::Setting.find_or_set(:inquiry_notification_subject,
|
51
|
+
"New inquiry from your website",
|
52
|
+
:scoping => "inquiries")
|
53
|
+
end
|
54
|
+
|
55
|
+
def send_confirmation?
|
56
|
+
Refinery::Setting.find_or_set(:inquiry_send_confirmation,
|
57
|
+
true,
|
58
|
+
:scoping => "inquiries")
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<li class='clearfix record <%= cycle("on", "on-hover") %>'>
|
2
|
+
<span class='title'>
|
3
|
+
<%= link_to inquiry.name, refinery.inquiries_admin_inquiry_path(inquiry) %> <%= t('.said') %>
|
4
|
+
<span class="preview"><%= truncate(strip_tags(inquiry.message), :length => 60) -%></span>
|
5
|
+
</span>
|
6
|
+
<span class='actions'>
|
7
|
+
<%= link_to refinery_icon_tag('delete.png'),
|
8
|
+
refinery.inquiries_admin_inquiry_path(inquiry),
|
9
|
+
:class => "cancel confirm-delete",
|
10
|
+
:title => t('refinery.inquiries.admin.inquiries.delete'),
|
11
|
+
:confirm => t('refinery.admin.delete.message', :title => inquiry.name),
|
12
|
+
:method => :delete -%>
|
13
|
+
|
14
|
+
<%= link_to refinery_icon_tag('zoom.png'), refinery.inquiries_admin_inquiry_path(inquiry),
|
15
|
+
:title => t('.read_inquiry') -%>
|
16
|
+
|
17
|
+
<% if inquiry.spam? %>
|
18
|
+
<%= link_to refinery_icon_tag('email.png'),
|
19
|
+
refinery.toggle_spam_inquiries_admin_inquiry_path(inquiry),
|
20
|
+
:title => t('.mark_as_ham') -%>
|
21
|
+
<% else %>
|
22
|
+
<%= link_to refinery_icon_tag('bin_closed.png'),
|
23
|
+
refinery.toggle_spam_inquiries_admin_inquiry_path(inquiry),
|
24
|
+
:title => t('.mark_as_spam') -%>
|
25
|
+
<% end %>
|
26
|
+
</span>
|
27
|
+
</li>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<div id='actions'>
|
2
|
+
<ul>
|
3
|
+
<li>
|
4
|
+
<%= render :partial => "/refinery/admin/search", :locals => {:url => request.path} %>
|
5
|
+
</li>
|
6
|
+
<li <%= "class='selected'" if params[:action] == "index" %>>
|
7
|
+
<%= link_to t('.inbox'), refinery.inquiries_admin_inquiries_path, :class => "email_icon" %>
|
8
|
+
</li>
|
9
|
+
<li <%= "class='selected'" if params[:action] == "spam" %>>
|
10
|
+
<% if @spam_count > 0 %>
|
11
|
+
<%= link_to "#{t('.spam')} (#{@spam_count})", refinery.spam_inquiries_admin_inquiries_path, :class => "spam_icon" %>
|
12
|
+
<% else %>
|
13
|
+
<%= link_to t('.spam'), refinery.spam_inquiries_admin_inquiries_path, :class => "spam_empty_icon" %>
|
14
|
+
<% end %>
|
15
|
+
</li>
|
16
|
+
<li>
|
17
|
+
<%= link_to t('.update_notified'),
|
18
|
+
refinery.edit_inquiries_admin_setting_path(:inquiry_notification_recipients, :dialog => true, :height => 300),
|
19
|
+
:class => "user_comment_icon" %>
|
20
|
+
</li>
|
21
|
+
<li>
|
22
|
+
<%= link_to t('.edit_confirmation_email'),
|
23
|
+
refinery.edit_inquiries_admin_setting_path(:inquiry_confirmation_body, :dialog => true),
|
24
|
+
:class => "edit_email_icon" %>
|
25
|
+
</li>
|
26
|
+
</ul>
|
27
|
+
</div>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<%= render :partial => "submenu" %>
|
2
2
|
<div id='records'>
|
3
3
|
<% if searching? %>
|
4
|
-
<h2><%= t('
|
4
|
+
<h2><%= t('refinery.admin.search.results_for', :query => params[:search]) %></h2>
|
5
5
|
<% if @inquiries.any? %>
|
6
6
|
<%= will_paginate @inquiries %>
|
7
7
|
<ul>
|
@@ -9,7 +9,7 @@
|
|
9
9
|
</ul>
|
10
10
|
<%= will_paginate @inquiries %>
|
11
11
|
<% else %>
|
12
|
-
<p><%= t('
|
12
|
+
<p><%= t('refinery.admin.search.no_results') %></p>
|
13
13
|
<% end %>
|
14
14
|
<% else %>
|
15
15
|
<% if @inquiries.any? -%>
|
@@ -11,14 +11,16 @@
|
|
11
11
|
<h2><%= t('.actions') %></h2>
|
12
12
|
<ul>
|
13
13
|
<li>
|
14
|
-
<%= link_to t('.back_to_all_inquiries'),
|
14
|
+
<%= link_to t('.back_to_all_inquiries'),
|
15
|
+
refinery.inquiries_admin_inquiries_path,
|
16
|
+
:class => "back_icon" %>
|
15
17
|
</li>
|
16
18
|
<li>
|
17
|
-
<%= link_to t('admin.inquiries.delete'),
|
18
|
-
|
19
|
+
<%= link_to t('refinery.inquiries.admin.inquiries.delete'),
|
20
|
+
refinery.inquiries_admin_inquiry_path(@inquiry),
|
19
21
|
:class => 'delete_icon no-tooltip confirm-delete',
|
20
|
-
:title => t('admin.inquiries.delete'),
|
21
|
-
:confirm => t('
|
22
|
+
:title => t('refinery.inquiries.admin.inquiries.delete'),
|
23
|
+
:confirm => t('refinery.admin.delete.message', :title => @inquiry.name),
|
22
24
|
:method => :delete %>
|
23
25
|
</li>
|
24
26
|
</ul>
|
@@ -31,7 +33,7 @@
|
|
31
33
|
<strong><%= t('.to') %></strong>
|
32
34
|
</td>
|
33
35
|
<td>
|
34
|
-
<%=
|
36
|
+
<%= Refinery::Core.config.site_name %>
|
35
37
|
</td>
|
36
38
|
</tr>
|
37
39
|
<tr>
|
@@ -65,7 +67,7 @@
|
|
65
67
|
<strong><%= t('.message') %></strong>
|
66
68
|
</td>
|
67
69
|
<td>
|
68
|
-
<%= simple_format @inquiry.message, :style => 'margin-top: 0' %>
|
70
|
+
<%= simple_format strip_tags(@inquiry.message), :style => 'margin-top: 0' %>
|
69
71
|
</td>
|
70
72
|
</tr>
|
71
73
|
</table>
|
@@ -0,0 +1,59 @@
|
|
1
|
+
<%= form_for @setting, :url => (@url_override || @url) do |f| %>
|
2
|
+
|
3
|
+
<p>
|
4
|
+
<%= t('.explanation') %>
|
5
|
+
</p>
|
6
|
+
<p>
|
7
|
+
<%= t('.below_edit_email_sent') %>
|
8
|
+
</p>
|
9
|
+
<table id='inquiry'>
|
10
|
+
<tr>
|
11
|
+
<td>
|
12
|
+
<label class='stripped'><%= t('.to') %></label>
|
13
|
+
</td>
|
14
|
+
<td>
|
15
|
+
<%= t('.the_customer_making_inquiry') %>
|
16
|
+
</td>
|
17
|
+
</tr>
|
18
|
+
<tr>
|
19
|
+
<td>
|
20
|
+
<label class='stripped'><%= t('.from') %></label>
|
21
|
+
</td>
|
22
|
+
<td>
|
23
|
+
<%= "#{Refinery::Core.site_name} <no-reply@#{request.domain}>".html_safe %>
|
24
|
+
</td>
|
25
|
+
</tr>
|
26
|
+
<% (defined?(Refinery::I18n) && Refinery::I18n.frontend_locales || [::I18n.locale]).each do |locale| %>
|
27
|
+
<tr>
|
28
|
+
<td>
|
29
|
+
<label class='stripped'><%= t('.subject') %> (<%= locale.to_s %>)</label>
|
30
|
+
</td>
|
31
|
+
<td>
|
32
|
+
<%= text_field_tag "subject[][#{locale.to_s}]", Refinery::Inquiries::Setting.confirmation_subject(locale),
|
33
|
+
:class => 'widest' %>
|
34
|
+
</td>
|
35
|
+
</tr>
|
36
|
+
<tr>
|
37
|
+
<td valign='top'>
|
38
|
+
<%= f.label :value, t('.message'),
|
39
|
+
:class => 'stripped' %> (<%= locale.to_s %>)
|
40
|
+
</td>
|
41
|
+
<td>
|
42
|
+
<%= text_area_tag "message[][#{locale.to_s}]", Refinery::Inquiries::Setting.confirmation_message(locale), # required, we can't use :value
|
43
|
+
:rows => "5",
|
44
|
+
:class => 'widest' %>
|
45
|
+
<br/>
|
46
|
+
<em><%= t('.note') %></em>
|
47
|
+
</td>
|
48
|
+
</tr>
|
49
|
+
<% end %>
|
50
|
+
</table>
|
51
|
+
|
52
|
+
<%= render :partial => "/refinery/admin/form_actions",
|
53
|
+
:locals => {
|
54
|
+
:f => f,
|
55
|
+
:continue_editing => false,
|
56
|
+
:cancel_url => refinery.inquiries_admin_inquiries_path,
|
57
|
+
:hide_delete => true
|
58
|
+
} %>
|
59
|
+
<% end %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= form_for
|
1
|
+
<%= form_for @setting, :url => (@url_override || @url) do |f| %>
|
2
2
|
|
3
3
|
<div class='field'>
|
4
4
|
<span class='label_with_help'>
|
@@ -15,11 +15,11 @@
|
|
15
15
|
<%= t('.example') %>
|
16
16
|
</p>
|
17
17
|
|
18
|
-
<%= render :partial => "/
|
18
|
+
<%= render :partial => "/refinery/admin/form_actions",
|
19
19
|
:locals => {
|
20
20
|
:f => f,
|
21
21
|
:continue_editing => false,
|
22
|
-
:cancel_url =>
|
22
|
+
:cancel_url => refinery.inquiries_admin_inquiries_path,
|
23
23
|
:hide_delete => true
|
24
24
|
} %>
|
25
25
|
<% end %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<% if @
|
1
|
+
<% if @setting.name.to_s.titleize == "Inquiry Notification Recipients" %>
|
2
2
|
<%= render :partial => "notification_recipients_form", :locals => {:edit => true} -%>
|
3
3
|
<% else %>
|
4
4
|
<%= render :partial => "confirmation_email_form", :locals => {:edit => true} -%>
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<% content_for :body_content_left do %>
|
2
|
+
<div class='inquiries'>
|
3
|
+
<%= form_for [refinery, :inquiries, @inquiry] do |f| %>
|
4
|
+
<%= render :partial => "/refinery/admin/error_messages",
|
5
|
+
:locals => {
|
6
|
+
:object => @inquiry,
|
7
|
+
:include_object_name => true
|
8
|
+
} %>
|
9
|
+
<div class="field">
|
10
|
+
<%= f.required_label :name, :class => 'placeholder-fallback' %>
|
11
|
+
<%= f.text_field :name, :class => 'text', :required => 'required', :placeholder => t('name', :scope => 'activerecord.attributes.refinery/inquiry') %>
|
12
|
+
</div>
|
13
|
+
<div class="field">
|
14
|
+
<%= f.required_label :email, :class => 'placeholder-fallback' %>
|
15
|
+
<%= f.email_field :email, :class => 'text email', :required => 'required', :placeholder => t('email', :scope => 'activerecord.attributes.refinery/inquiry') %>
|
16
|
+
</div>
|
17
|
+
<div class="field">
|
18
|
+
<%= f.label :phone, :class => 'placeholder-fallback' %>
|
19
|
+
<%= f.text_field :phone, :class => 'text phone', :placeholder => t('phone', :scope => 'activerecord.attributes.refinery/inquiry') %>
|
20
|
+
</div>
|
21
|
+
<div class='field message_field'>
|
22
|
+
<%= f.required_label :message, :class => 'placeholder-fallback' %>
|
23
|
+
<%= f.text_area :message, :rows => 8, :required => 'required', :placeholder => t('message', :scope => 'activerecord.attributes.refinery/inquiry') %>
|
24
|
+
</div>
|
25
|
+
<div class="actions">
|
26
|
+
<%= f.submit t('.send') %>
|
27
|
+
<%= link_to t('.privacy_policy'), "/pages/privacy-policy", :id => "privacy_link" if Refinery::Inquiries.show_contact_privacy_link %>
|
28
|
+
</div>
|
29
|
+
<% end %>
|
30
|
+
</div>
|
31
|
+
<% end %>
|
32
|
+
<%= render :partial => "/refinery/content_page" %>
|