refinerycms-inquiries 2.0.3 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +4 -1
- data/.travis.yml +14 -6
- data/Gemfile +26 -53
- data/Rakefile +2 -0
- data/app/controllers/refinery/inquiries/admin/inquiries_controller.rb +1 -1
- data/app/controllers/refinery/inquiries/inquiries_controller.rb +1 -1
- data/app/helpers/refinery/inquiries/inquiries_helper.rb +2 -2
- data/app/mailers/refinery/inquiries/inquiry_mailer.rb +11 -4
- data/app/models/refinery/inquiries/inquiry.rb +5 -4
- data/app/views/refinery/inquiries/admin/inquiries/_inquiry.html.erb +4 -2
- data/app/views/refinery/inquiries/admin/inquiries/_submenu.html.erb +1 -1
- data/app/views/refinery/inquiries/admin/inquiries/index.html.erb +2 -2
- data/app/views/refinery/inquiries/admin/inquiries/show.html.erb +3 -1
- data/app/views/refinery/inquiries/admin/settings/_confirmation_email_form.html.erb +1 -1
- data/app/views/refinery/inquiries/admin/settings/edit.html.erb +2 -2
- data/app/views/refinery/inquiries/inquiries/new.html.erb +19 -9
- data/app/views/refinery/inquiries/inquiries/thank_you.html.erb +1 -1
- data/app/views/refinery/inquiries/inquiry_mailer/confirmation.text.erb +1 -1
- data/app/views/refinery/inquiries/inquiry_mailer/notification.text.erb +2 -2
- data/config/locales/bg.yml +2 -0
- data/config/locales/cs.yml +2 -0
- data/config/locales/da.yml +2 -1
- data/config/locales/de.yml +2 -0
- data/config/locales/en-GB.yml +2 -0
- data/config/locales/en.yml +2 -0
- data/config/locales/es.yml +2 -0
- data/config/locales/fr.yml +2 -0
- data/config/locales/it.yml +3 -1
- data/config/locales/lt.yml +2 -0
- data/config/locales/lv.yml +2 -1
- data/config/locales/nb.yml +2 -0
- data/config/locales/nl.yml +2 -0
- data/config/locales/pl.yml +2 -0
- data/config/locales/pt-BR.yml +2 -0
- data/config/locales/ru.yml +2 -0
- data/config/locales/sk.yml +2 -0
- data/config/locales/sl.yml +2 -0
- data/config/locales/sv.yml +8 -6
- data/config/locales/zh-CN.yml +2 -0
- data/config/routes.rb +1 -1
- data/db/seeds.rb +3 -1
- data/lib/generators/refinery/inquiries/templates/config/initializers/refinery/inquiries.rb.erb +12 -0
- data/lib/refinery/inquiries.rb +0 -1
- data/lib/refinery/inquiries/configuration.rb +8 -0
- data/license.md +5 -5
- data/readme.md +5 -1
- data/refinerycms-inquiries.gemspec +5 -5
- data/spec/{requests → features}/refinery/inquiries/admin/inquiries_spec.rb +13 -12
- data/spec/features/refinery/inquiries/inquiries_spec.rb +145 -0
- data/spec/features/refinery/inquiries/mailer_spec.rb +41 -0
- data/spec/models/refinery/inquiries/inquiry_spec.rb +9 -9
- data/spec/spec_helper.rb +18 -44
- metadata +21 -28
- data/Guardfile +0 -20
- data/config/locales/lolcat.yml +0 -78
- data/spec/requests/refinery/inquiries/inquiries_spec.rb +0 -81
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f114529cf10c2021be3716ce6f9cc8e50c75a621
|
4
|
+
data.tar.gz: dc9e45204e308791b9f071815c990add3a12670a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: efd97df61475b46d4abbc14ff1cf085e8b1e81835d4fc5c0129c3a31b2f74f1ac6dedc658a91d53df3fac44ed9a794ecbcbd6d9401641fb29552c27d0c36679f
|
7
|
+
data.tar.gz: fc7caa590ec372433a099f6aea1531a36c21e1fbdd157210e469634beda91b742707f4dfa8e82946d5b2219cfa2fcfc968a85311aa6391fd4902b554b86e6016
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
language: ruby
|
2
|
+
bundler_args: --without development
|
3
3
|
before_script:
|
4
4
|
- "sh -e /etc/init.d/xvfb start"
|
5
|
-
- "bundle exec rake refinery:testing:dummy_app
|
5
|
+
- "bundle exec rake refinery:testing:dummy_app"
|
6
6
|
script:
|
7
7
|
- "DISPLAY=:99.0 bundle exec rspec spec"
|
8
8
|
notifications:
|
@@ -12,11 +12,19 @@ notifications:
|
|
12
12
|
skip_join: true
|
13
13
|
channels:
|
14
14
|
- "irc.freenode.org#refinerycms"
|
15
|
+
campfire:
|
16
|
+
on_success: always
|
17
|
+
on_failure: always
|
18
|
+
rooms:
|
19
|
+
- secure: "JaX+Ckvdd2wqL2bD6t8PHvMDBHxWBlCrkBKPcDKxV0t0DOwzzzwxMryVqcRi\nPsmM/zvmWFATDyRmivhNOpu4lRg9RytSroxZ9nkmbLDqjCyEAZ6tv4yZXME/\nPaxPwmfwgS9g8TKjj3lSWS7rEpqqg0D5S0XIfIHrj6KB6LUmFHc="
|
15
20
|
env:
|
16
21
|
- DB=postgresql
|
17
22
|
- DB=mysql
|
23
|
+
matrix:
|
24
|
+
allow_failures:
|
25
|
+
- rvm: rbx-19mode
|
18
26
|
rvm:
|
19
|
-
-
|
27
|
+
- 2.0.0
|
20
28
|
- 1.9.3
|
21
|
-
- rbx
|
22
|
-
- jruby
|
29
|
+
- rbx-19mode
|
30
|
+
- jruby-19mode
|
data/Gemfile
CHANGED
@@ -1,64 +1,34 @@
|
|
1
|
-
source '
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
5
|
-
gem 'refinerycms', '~> 2.
|
5
|
+
gem 'refinerycms', '~> 2.1.0'
|
6
|
+
gem 'refinerycms-acts-as-indexed', '~> 1.0.0'
|
6
7
|
|
7
|
-
group :
|
8
|
-
gem 'refinerycms-testing', '~> 2.
|
9
|
-
gem '
|
10
|
-
|
11
|
-
platforms :jruby do
|
12
|
-
gem 'activerecord-jdbcsqlite3-adapter'
|
13
|
-
gem 'activerecord-jdbcmysql-adapter'
|
14
|
-
gem 'activerecord-jdbcpostgresql-adapter'
|
15
|
-
gem 'jruby-openssl'
|
16
|
-
end
|
17
|
-
|
18
|
-
unless defined?(JRUBY_VERSION)
|
19
|
-
gem 'sqlite3'
|
20
|
-
gem 'mysql2'
|
21
|
-
gem 'pg'
|
22
|
-
end
|
23
|
-
|
24
|
-
platforms :mswin, :mingw do
|
25
|
-
gem 'win32console'
|
26
|
-
gem 'rb-fchange', '~> 0.0.5'
|
27
|
-
gem 'rb-notifu', '~> 0.0.4'
|
28
|
-
end
|
8
|
+
group :test do
|
9
|
+
gem 'refinerycms-testing', '~> 2.1.0'
|
10
|
+
gem 'capybara-email', '~> 2.1.2'
|
11
|
+
end
|
29
12
|
|
30
|
-
|
31
|
-
|
32
|
-
|
13
|
+
# Database Configuration
|
14
|
+
unless ENV['TRAVIS']
|
15
|
+
gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
|
16
|
+
gem 'sqlite3', :platform => :ruby
|
17
|
+
end
|
33
18
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
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
|
19
|
+
if !ENV['TRAVIS'] || ENV['DB'] == 'mysql'
|
20
|
+
gem 'activerecord-jdbcmysql-adapter', :platform => :jruby
|
21
|
+
gem 'jdbc-mysql', '= 5.1.13', :platform => :jruby
|
22
|
+
gem 'mysql2', :platform => :ruby
|
23
|
+
end
|
47
24
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
if RbConfig::CONFIG['target_os'] =~ /darwin/i
|
52
|
-
gem 'ruby_gntp'
|
53
|
-
end
|
54
|
-
if RbConfig::CONFIG['target_os'] =~ /linux/i
|
55
|
-
gem 'rb-inotify', '>= 0.5.1'
|
56
|
-
gem 'libnotify', '~> 0.1.3'
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
25
|
+
if !ENV['TRAVIS'] || ENV['DB'] == 'postgresql'
|
26
|
+
gem 'activerecord-jdbcpostgresql-adapter', :platform => :jruby
|
27
|
+
gem 'pg', :platform => :ruby
|
60
28
|
end
|
61
29
|
|
30
|
+
gem 'jruby-openssl', :platform => :jruby
|
31
|
+
|
62
32
|
# Refinery/rails should pull in the proper versions of these
|
63
33
|
group :assets do
|
64
34
|
gem 'sass-rails'
|
@@ -66,4 +36,7 @@ group :assets do
|
|
66
36
|
gem 'uglifier'
|
67
37
|
end
|
68
38
|
|
69
|
-
|
39
|
+
# Load local gems according to Refinery developer preference.
|
40
|
+
if File.exist? local_gemfile = File.expand_path('../.gemfile', __FILE__)
|
41
|
+
eval File.read(local_gemfile)
|
42
|
+
end
|
data/Rakefile
CHANGED
@@ -16,7 +16,7 @@ module Refinery
|
|
16
16
|
@inquiry = ::Refinery::Inquiries::Inquiry.new(params[:inquiry])
|
17
17
|
|
18
18
|
if @inquiry.save
|
19
|
-
if @inquiry.ham?
|
19
|
+
if @inquiry.ham? || Refinery::Inquiries.send_notifications_for_inquiries_marked_as_spam
|
20
20
|
begin
|
21
21
|
::Refinery::Inquiries::InquiryMailer.notification(@inquiry, request).deliver
|
22
22
|
rescue
|
@@ -6,15 +6,22 @@ module Refinery
|
|
6
6
|
@inquiry = inquiry
|
7
7
|
mail :subject => Refinery::Inquiries::Setting.confirmation_subject(Globalize.locale),
|
8
8
|
:to => inquiry.email,
|
9
|
-
:from =>
|
9
|
+
:from => ::I18n.t('from_name',
|
10
|
+
:scope => 'refinery.inquiries.config',
|
11
|
+
:site_name => Refinery::Core.site_name,
|
12
|
+
:name => @inquiry.name) + " <#{Refinery::Inquiries.from_name}@#{request.domain}>",
|
10
13
|
:reply_to => Refinery::Inquiries::Setting.notification_recipients.split(',').first
|
11
14
|
end
|
12
15
|
|
13
16
|
def notification(inquiry, request)
|
14
17
|
@inquiry = inquiry
|
15
|
-
mail :subject
|
16
|
-
:to
|
17
|
-
:from
|
18
|
+
mail :subject => Refinery::Inquiries::Setting.notification_subject,
|
19
|
+
:to => Refinery::Inquiries::Setting.notification_recipients,
|
20
|
+
:from => ::I18n.t('from_name',
|
21
|
+
:scope => 'refinery.inquiries.config',
|
22
|
+
:site_name => Refinery::Core.site_name,
|
23
|
+
:name => @inquiry.name) + " <#{Refinery::Inquiries.from_name}@#{request.domain}>",
|
24
|
+
:reply_to => inquiry.email
|
18
25
|
end
|
19
26
|
|
20
27
|
end
|
@@ -1,3 +1,6 @@
|
|
1
|
+
require 'refinery/core/base_model'
|
2
|
+
require 'filters_spam'
|
3
|
+
|
1
4
|
module Refinery
|
2
5
|
module Inquiries
|
3
6
|
class Inquiry < Refinery::Core::BaseModel
|
@@ -9,10 +12,8 @@ module Refinery
|
|
9
12
|
:extra_spam_words => %w()
|
10
13
|
|
11
14
|
validates :name, :presence => true
|
15
|
+
validates :email, :format => { :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i }
|
12
16
|
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
|
|
17
18
|
default_scope :order => 'created_at DESC'
|
18
19
|
|
@@ -24,4 +25,4 @@ module Refinery
|
|
24
25
|
|
25
26
|
end
|
26
27
|
end
|
27
|
-
end
|
28
|
+
end
|
@@ -1,14 +1,16 @@
|
|
1
1
|
<li class='clearfix record <%= cycle("on", "on-hover") %>'>
|
2
2
|
<span class='title'>
|
3
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>
|
4
|
+
<span class="preview"><%= truncate(strip_tags(sanitize(inquiry.message)), :length => 60) -%></span>
|
5
5
|
</span>
|
6
6
|
<span class='actions'>
|
7
7
|
<%= link_to refinery_icon_tag('delete.png'),
|
8
8
|
refinery.inquiries_admin_inquiry_path(inquiry),
|
9
9
|
:class => "cancel confirm-delete",
|
10
10
|
:title => t('refinery.inquiries.admin.inquiries.delete'),
|
11
|
-
:
|
11
|
+
:data => {
|
12
|
+
:confirm => t('refinery.admin.delete.message', :title => inquiry.name)
|
13
|
+
},
|
12
14
|
:method => :delete -%>
|
13
15
|
|
14
16
|
<%= link_to refinery_icon_tag('zoom.png'), refinery.inquiries_admin_inquiry_path(inquiry),
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<div id='actions'>
|
2
2
|
<ul>
|
3
3
|
<li>
|
4
|
-
<%= render
|
4
|
+
<%= render "/refinery/admin/search", :url => request.path.gsub("//", "/") %>
|
5
5
|
</li>
|
6
6
|
<li <%= "class='selected'" if params[:action] == "index" %>>
|
7
7
|
<%= link_to t('.inbox'), refinery.inquiries_admin_inquiries_path, :class => "email_icon" %>
|
@@ -1,7 +1,7 @@
|
|
1
|
-
<%= render
|
1
|
+
<%= render "submenu" %>
|
2
2
|
<div id='records'>
|
3
3
|
<% if searching? %>
|
4
|
-
|
4
|
+
<%= render 'refinery/admin/search_header', :url => request.path.gsub("//", "/") %>
|
5
5
|
<% if @inquiries.any? %>
|
6
6
|
<%= will_paginate @inquiries %>
|
7
7
|
<ul>
|
@@ -20,7 +20,9 @@
|
|
20
20
|
refinery.inquiries_admin_inquiry_path(@inquiry),
|
21
21
|
:class => 'delete_icon no-tooltip confirm-delete',
|
22
22
|
:title => t('refinery.inquiries.admin.inquiries.delete'),
|
23
|
-
:
|
23
|
+
:data => {
|
24
|
+
:confirm => t('refinery.admin.delete.message', :title => @inquiry.name)
|
25
|
+
},
|
24
26
|
:method => :delete %>
|
25
27
|
</li>
|
26
28
|
</ul>
|
@@ -23,7 +23,7 @@
|
|
23
23
|
<%= "#{Refinery::Core.site_name} <no-reply@#{request.domain}>".html_safe %>
|
24
24
|
</td>
|
25
25
|
</tr>
|
26
|
-
<%
|
26
|
+
<% Refinery::I18n.frontend_locales.each do |locale| %>
|
27
27
|
<tr>
|
28
28
|
<td>
|
29
29
|
<label class='stripped'><%= t('.subject') %> (<%= locale.to_s %>)</label>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<% if @setting.name.to_s.titleize == "Inquiry Notification Recipients" %>
|
2
|
-
<%= render
|
2
|
+
<%= render "notification_recipients_form", :edit => true -%>
|
3
3
|
<% else %>
|
4
|
-
<%= render
|
4
|
+
<%= render "confirmation_email_form", :edit => true -%>
|
5
5
|
<% end %>
|
@@ -1,4 +1,6 @@
|
|
1
|
-
<% content_for :
|
1
|
+
<% content_for :body do %>
|
2
|
+
<%= raw @page.content_for(Refinery::Pages.default_parts.first.to_sym) if Refinery::Pages.default_parts.any? %>
|
3
|
+
|
2
4
|
<div class='inquiries'>
|
3
5
|
<%= form_for [refinery, :inquiries, @inquiry] do |f| %>
|
4
6
|
<%= render :partial => "/refinery/admin/error_messages",
|
@@ -8,19 +10,27 @@
|
|
8
10
|
} %>
|
9
11
|
<div class="field">
|
10
12
|
<%= f.required_label :name, :class => 'placeholder-fallback' %>
|
11
|
-
<%= f.text_field :name, :class => 'text', :required => 'required',
|
13
|
+
<%= f.text_field :name, :class => 'text', :required => 'required',
|
14
|
+
:placeholder => t('name', :scope => 'activerecord.attributes.refinery/inquiries/inquiry') if Refinery::Inquiries.show_placeholders %>
|
12
15
|
</div>
|
13
16
|
<div class="field">
|
14
17
|
<%= f.required_label :email, :class => 'placeholder-fallback' %>
|
15
|
-
<%= f.email_field :email, :class => 'text email', :required => 'required',
|
16
|
-
|
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/inquiries/inquiry') %>
|
18
|
+
<%= f.email_field :email, :class => 'text email', :required => 'required',
|
19
|
+
:placeholder => t('email', :scope => 'activerecord.attributes.refinery/inquiries/inquiry') if Refinery::Inquiries.show_placeholders %>
|
20
20
|
</div>
|
21
|
+
|
22
|
+
<% if Refinery::Inquiries.show_phone_number_field %>
|
23
|
+
<div class="field">
|
24
|
+
<%= f.label :phone, :class => 'placeholder-fallback' %>
|
25
|
+
<%= f.text_field :phone, :class => 'text phone',
|
26
|
+
:placeholder => t('phone', :scope => 'activerecord.attributes.refinery/inquiries/inquiry') if Refinery::Inquiries.show_placeholders %>
|
27
|
+
</div>
|
28
|
+
<% end %>
|
29
|
+
|
21
30
|
<div class='field message_field'>
|
22
31
|
<%= f.required_label :message, :class => 'placeholder-fallback' %>
|
23
|
-
<%= f.text_area :message, :rows => 8, :required => 'required',
|
32
|
+
<%= f.text_area :message, :rows => 8, :required => 'required',
|
33
|
+
:placeholder => t('message', :scope => 'activerecord.attributes.refinery/inquiries/inquiry') if Refinery::Inquiries.show_placeholders %>
|
24
34
|
</div>
|
25
35
|
<div class="actions">
|
26
36
|
<%= f.submit t('.send') %>
|
@@ -29,4 +39,4 @@
|
|
29
39
|
<% end %>
|
30
40
|
</div>
|
31
41
|
<% end %>
|
32
|
-
<%= render
|
42
|
+
<%= render "/refinery/content_page" %>
|
@@ -1 +1 @@
|
|
1
|
-
<%= render
|
1
|
+
<%= render "/refinery/content_page" %>
|
@@ -1 +1 @@
|
|
1
|
-
<%=raw Refinery::Inquiries::Setting.confirmation_message(Globalize.locale).gsub("%name%", @inquiry.name)
|
1
|
+
<%=raw Refinery::Inquiries::Setting.confirmation_message(Globalize.locale).gsub("%name%", @inquiry.name) -%>
|
@@ -8,11 +8,11 @@
|
|
8
8
|
<%=raw t('.email') %>: <%= @inquiry.email %>
|
9
9
|
<%=raw t('.phone') %>: <%= @inquiry.phone %>
|
10
10
|
<%=raw t('.message') %>:
|
11
|
-
<%=strip_tags(@inquiry.message) %>
|
11
|
+
<%=raw strip_tags(@inquiry.message) %>
|
12
12
|
|
13
13
|
<%=raw t('.inquiry_ends') %>
|
14
14
|
|
15
15
|
<%=raw t('.closing_line') %>,
|
16
16
|
<%=raw Refinery::Core.site_name %>
|
17
17
|
|
18
|
-
<%=raw t('.ps')
|
18
|
+
<%=raw t('.ps') -%>
|
data/config/locales/bg.yml
CHANGED
data/config/locales/cs.yml
CHANGED
data/config/locales/da.yml
CHANGED
@@ -4,6 +4,8 @@ da:
|
|
4
4
|
refinerycms_inquiries:
|
5
5
|
title: Henvendelser
|
6
6
|
inquiries:
|
7
|
+
config:
|
8
|
+
from_name: "%{name} [%{site_name}]"
|
7
9
|
inquiries:
|
8
10
|
new:
|
9
11
|
header_message: "Der er et mindre problem"
|
@@ -22,7 +24,6 @@ da:
|
|
22
24
|
closed: "Henvendelsen '%{inquiry}' er lukket"
|
23
25
|
reopened: "Henvendelsen '%{inquiry}' er genåbnet"
|
24
26
|
index:
|
25
|
-
search_results_for: "Søgeresultat for '%{query}'"
|
26
27
|
no_inquiries: Du har endnu ikke modtaget nogen henvendelser.
|
27
28
|
show:
|
28
29
|
details: Detaljer
|
data/config/locales/de.yml
CHANGED
data/config/locales/en-GB.yml
CHANGED