refinerycms-inquiries 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -5,9 +5,8 @@ gemspec
5
5
  gem 'refinerycms', '~> 2.0.0'
6
6
 
7
7
  group :development, :test do
8
- require 'rbconfig'
9
-
10
8
  gem 'refinerycms-testing', '~> 2.0.0'
9
+ gem 'guard-rspec', '~> 0.6.0'
11
10
 
12
11
  platforms :jruby do
13
12
  gem 'activerecord-jdbcsqlite3-adapter'
@@ -29,13 +28,14 @@ group :development, :test do
29
28
  end
30
29
 
31
30
  platforms :ruby do
32
- gem 'spork', '0.9.0.rc9'
31
+ gem 'spork', '~> 0.9.0.rc'
33
32
  gem 'guard-spork'
34
33
 
35
34
  unless ENV['TRAVIS']
35
+ require 'rbconfig'
36
36
  if RbConfig::CONFIG['target_os'] =~ /darwin/i
37
37
  gem 'rb-fsevent', '>= 0.3.9'
38
- gem 'growl', '~> 1.0.3'
38
+ gem 'ruby_gntp'
39
39
  end
40
40
  if RbConfig::CONFIG['target_os'] =~ /linux/i
41
41
  gem 'rb-inotify', '>= 0.5.1'
@@ -47,8 +47,9 @@ group :development, :test do
47
47
 
48
48
  platforms :jruby do
49
49
  unless ENV['TRAVIS']
50
+ require 'rbconfig'
50
51
  if RbConfig::CONFIG['target_os'] =~ /darwin/i
51
- gem 'growl', '~> 1.0.3'
52
+ gem 'ruby_gntp'
52
53
  end
53
54
  if RbConfig::CONFIG['target_os'] =~ /linux/i
54
55
  gem 'rb-inotify', '>= 0.5.1'
data/Guardfile CHANGED
@@ -1,4 +1,4 @@
1
- guard 'rspec', :version => 2, :cli => "--format Fuubar --color --drb" do
1
+ guard 'rspec', :version => 2, :cli => "--color" do
2
2
  watch(%r{^spec/.+_spec\.rb$})
3
3
  watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
4
4
  watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
@@ -1,53 +1,43 @@
1
1
  module Refinery
2
2
  module Inquiries
3
3
  module Admin
4
- class SettingsController < ::Refinery::AdminController
4
+ class SettingsController < Refinery::AdminController
5
5
 
6
- crudify :'refinery/setting',
7
- :title_attribute => "name",
8
- :order => 'name ASC',
9
- :redirect_to_url => 'refinery.inquiries_admin_inquiries_path'
6
+ before_filter :check_setting, :only => [:edit, :update]
7
+ after_filter :save_subject_for_confirmation, :save_message_for_confirmation, :only => :update
10
8
 
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
9
+ def edit
10
+ @setting = Refinery::Setting.find(params[:id])
11
+ end
15
12
 
16
- protected
13
+ def update
14
+ @setting = Refinery::Setting.find(params[:id])
17
15
 
18
- def rewrite_flash?
19
- yield
16
+ if @setting.update_attributes(params[:setting])
17
+ flash[:notice] = t('refinery.crudify.updated', :what => @setting.name.gsub("inquiry_", "").titleize)
20
18
 
21
- flash[:notice] = flash[:notice].to_s.gsub(/(\'.*\')/) {|m| m.titleize}.gsub('Inquiry ', '')
19
+ unless request.xhr? or from_dialog?
20
+ redirect_back_or_default(refinery.inquiries_admin_inquiries_path)
21
+ else
22
+ render :text => "<script type='text/javascript'>parent.window.location = '#{refinery.inquiries_admin_inquiries_path}';</script>"
23
+ end
24
+ end
22
25
  end
23
26
 
24
- def save_subject_for_confirmation?
25
- Refinery::Inquiries::Setting.confirmation_subject = params[:subject] if params.keys.include?('subject')
26
- end
27
+ protected
27
28
 
28
- def save_message_for_confirmation?
29
- Refinery::Inquiries::Setting.confirmation_message = params[:message] if params.keys.include?('message')
30
- end
29
+ def check_setting
30
+ setting = params[:id].gsub("inquiry_", "")
31
31
 
32
- def set_url_override?
33
- @url_override = refinery.inquiries_admin_setting_path(@setting, :dialog => from_dialog?)
32
+ Refinery::Inquiries::Setting.send(setting) if Refinery::Inquiries::Setting.respond_to?(setting)
34
33
  end
35
34
 
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
35
+ def save_subject_for_confirmation
36
+ Refinery::Inquiries::Setting.confirmation_subject = params[:subject] if params.keys.include?('subject')
37
+ end
49
38
 
50
- @setting = Refinery::Setting.find_by_name(params[:id])
39
+ def save_message_for_confirmation
40
+ Refinery::Inquiries::Setting.confirmation_message = params[:message] if params.keys.include?('message')
51
41
  end
52
42
 
53
43
  end
@@ -1,4 +1,4 @@
1
- <%= form_for @setting, :url => (@url_override || @url) do |f| %>
1
+ <%= form_for @setting, :url => refinery.inquiries_admin_setting_path(@setting) do |f| %>
2
2
 
3
3
  <p>
4
4
  <%= t('.explanation') %>
@@ -1,4 +1,4 @@
1
- <%= form_for @setting, :url => (@url_override || @url) do |f| %>
1
+ <%= form_for @setting, :url => refinery.inquiries_admin_setting_path(@setting) do |f| %>
2
2
 
3
3
  <div class='field'>
4
4
  <span class='label_with_help'>
@@ -2,7 +2,8 @@ nl:
2
2
  refinery:
3
3
  plugins:
4
4
  refinerycms_inquiries:
5
- title: Contact aanvragen
5
+ title: Contactaanvragen
6
+ description: Contactformulier en beheer van vragen
6
7
  inquiries:
7
8
  inquiries:
8
9
  new:
@@ -20,10 +21,10 @@ nl:
20
21
  inbox: Inbox
21
22
  spam: Spam
22
23
  update_notified: Wijzig wie op de hoogte wordt gesteld van vragen
23
- edit_confirmation_email: Bewerk bevestigings email
24
+ edit_confirmation_email: Bewerk bevestigings-e-mail
24
25
  index:
25
26
  no_inquiries: Je hebt nog geen vragen ontvangen.
26
- no_spam: Jeej! Je hebt geen spam.
27
+ no_spam: Hoera! Je hebt geen spam.
27
28
  show:
28
29
  details: Details
29
30
  age: Leeftijd
@@ -34,44 +35,43 @@ nl:
34
35
  inquiry: Vraag
35
36
  to: Aan
36
37
  from: Van
37
- click_to_email: Klik hier om een e-mail te sturen
38
+ click_to_email: Klik hier om een e-mail te sturen naar dit adres
38
39
  phone: Telefoonnummer
39
40
  date: Datum
40
41
  message: Bericht
41
42
  settings:
42
43
  notification_recipients_form:
43
44
  inquiry_settings_value_name: Stuur notificaties naar
44
- explanation: "Iedere keer wanneer iemand het vraag formulier invult op uw website, stuurt Refinery een email waarin staat dat er een nieuwe vraag ontvangen is."
45
- hint: "Vul hierboven een email adres in. Wilt u naar meerdere adressen notificaties sturen? Vul dan meerdere email adressen in gescheiden door comma's"
45
+ hint: "Wilt u naar meerdere adressen notificaties sturen? Vul dan meerdere e-mailadressen in gescheiden door komma's"
46
46
  example: "Bijvoorbeeld: ik@domein.com, vrienden@msn.com, collegas@werk.com"
47
47
  confirmation_email_form:
48
48
  to: Aan
49
49
  from: Van
50
50
  subject: Onderwerp
51
51
  click_to_edit_subject: Klik hier om het onderwerp bewerken
52
- explanation: "Iedere keer wanneer iemand het vraag formulier invult op uw website, stuurt Refinery een email naar die persoon waarin staat dat de vraag ontvangen is."
53
- below_edit_email_sent: Hieronder kun je de email die verzonden wordt bewerken.
52
+ explanation: "Telkens wanneer iemand het contactformulier invult op je website, stuurt Refinery een bevestiging naar de verzender."
53
+ below_edit_email_sent: Hieronder kun je de e-mail die verzonden wordt bewerken.
54
54
  the_customer_making_inquiry: De persoon die de heeft vraag gesteld
55
55
  message: Bericht
56
- note: "Notitie: plaats de tekst %name% overal in je email waar je de naam van de vragende persoon wilt invoegen"
56
+ note: "N.B.: plaats de tekst %name% overal in de e-mail waar je de naam van de vragende persoon wilt invoegen"
57
57
  inquiry_mailer:
58
58
  notification:
59
59
  greeting: Hallo
60
- you_recieved_new_inquiry: Je hebt een nieuwe vraag via de website ontvangen.
61
- inquiry_starts: --- begin van de vraag---
62
- inquiry_ends: --- einde van de vraag---
60
+ you_recieved_new_inquiry: Je hebt een nieuwe vraag ontvangen via je website.
61
+ inquiry_starts: --- begin van de vraag ---
62
+ inquiry_ends: --- einde van de vraag ---
63
63
  from: Van
64
- email: Email
64
+ email: E-mail
65
65
  phone: Telefoon
66
66
  message: Bericht
67
- closing_line: Vriendelijke groeten,
68
- ps: P.S. Alle vragen woren opgeslagen in de "vragen" sectie van uw website.All your inquiries are stored in the "Inquiries" section of Refinery.
69
- activerecord:
67
+ closing_line: Met vriendelijk groet,
68
+ ps: P.S. Alle vragen woren opgeslagen in de sectie "Contactaanvragen" van Refinery.
69
+ activerecord:
70
70
  models:
71
71
  refinery/inquiry: Vraag
72
72
  attributes:
73
73
  refinery/inquiry:
74
74
  name: Naam
75
- email: 'Email'
75
+ email: 'E-mail'
76
76
  phone: Telefoon
77
77
  message: Bericht
data/db/seeds.rb CHANGED
@@ -14,11 +14,13 @@ if defined?(::Refinery::Page)
14
14
  })
15
15
  contact_us_page.parts.create({
16
16
  :title => "Body",
17
- :body => "<p>Get in touch with us. Just use the form below and we'll get back to you as soon as we can.</p>"
17
+ :body => "<p>Get in touch with us. Just use the form below and we'll get back to you as soon as we can.</p>",
18
+ :position => 0
18
19
  })
19
20
  contact_us_page.parts.create({
20
21
  :title => "Side Body",
21
- :body => ""
22
+ :body => "",
23
+ :position => 1
22
24
  })
23
25
  end
24
26
 
@@ -32,7 +34,8 @@ if defined?(::Refinery::Page)
32
34
  })
33
35
  thank_you_page.parts.create({
34
36
  :title => "Body",
35
- :body => "<p>We've received your inquiry and will get back to you with a response shortly.</p><p><a href='/'>Return to the home page</a></p>"
37
+ :body => "<p>We've received your inquiry and will get back to you with a response shortly.</p><p><a href='/'>Return to the home page</a></p>",
38
+ :position => 0
36
39
  })
37
40
  end
38
41
 
@@ -44,7 +47,12 @@ if defined?(::Refinery::Page)
44
47
  })
45
48
  privacy_policy_page.parts.create({
46
49
  :title => "Body",
47
- :body => "<p>We respect your privacy. We do not market, rent or sell our email list to any outside parties.</p><p>We need your e-mail address so that we can ensure that the people using our forms are bona fide. It also allows us to send you e-mail newsletters and other communications, if you opt-in. Your postal address is required in order to send you information and pricing, if you request it.</p><p>Please call us at 123 456 7890 if you have any questions or concerns.</p>"
50
+ :body => "<p>We respect your privacy. We do not market, rent or sell our email list to any outside parties.</p><p>We need your e-mail address so that we can ensure that the people using our forms are bona fide. It also allows us to send you e-mail newsletters and other communications, if you opt-in. Your postal address is required in order to send you information and pricing, if you request it.</p><p>Please call us at 123 456 7890 if you have any questions or concerns.</p>",
51
+ :position => 0
48
52
  })
49
53
  end
50
54
  end
55
+
56
+ (Refinery::Inquiries::Setting.methods.sort - ActiveRecord::Base.methods).each do |setting|
57
+ Refinery::Inquiries::Setting.send(setting) unless setting.to_s =~ /=$/
58
+ end
data/readme.md CHANGED
@@ -17,10 +17,11 @@ Then type the following at command line inside your Refinery CMS application's r
17
17
  To install the migrations, run:
18
18
 
19
19
  rails generate refinery:inquiries
20
-
21
- Next migrate your database and you're done:
22
-
23
20
  rake db:migrate
21
+
22
+ Add pages to the database and you're done:
23
+
24
+ rake db:seed
24
25
 
25
26
  ## About
26
27
 
@@ -1,6 +1,8 @@
1
+ # Encoding: UTF-8
2
+
1
3
  Gem::Specification.new do |s|
2
4
  s.name = %q{refinerycms-inquiries}
3
- s.version = %q{2.0.0}
5
+ s.version = %q{2.0.1}
4
6
  s.date = "#{Date.today.strftime("%Y-%m-%d")}"
5
7
  s.summary = %q{Inquiry handling functionality for the Refinery CMS project.}
6
8
  s.description = %q{Inquiry handling functionality extracted from Refinery CMS to allow you to have a contact form and manage inquiries in the Refinery backend.}
@@ -15,7 +17,4 @@ Gem::Specification.new do |s|
15
17
  s.add_dependency 'refinerycms-core', '~> 2.0.1'
16
18
  s.add_dependency 'refinerycms-settings', '~> 2.0.1'
17
19
  s.add_dependency 'filters_spam', '~> 0.2'
18
-
19
- # Development dependencies
20
- s.add_development_dependency 'refinerycms-testing', '~> 2.0.0'
21
20
  end
@@ -101,37 +101,47 @@ module Refinery
101
101
  end
102
102
  end
103
103
 
104
- =begin
105
- describe "update who gets notified" do
106
- it "sets receiver", :js => true do
107
- visit refinery.inquiries_admin_inquiries_path
104
+ describe "update who gets notified" do
105
+ before do
106
+ Rails.cache.clear
107
+ Refinery::Inquiries::Setting.notification_recipients
108
+ end
109
+
110
+ it "sets receiver", :js => true do
111
+ visit refinery.inquiries_admin_inquiries_path
108
112
 
109
- click_link "Update who gets notified"
113
+ click_link "Update who gets notified"
110
114
 
111
- within_frame "dialog_iframe" do
112
- fill_in "Send notifications to", :with => "phil@refinerycms.com"
113
- click_button "Save"
114
- end
115
+ within_frame "dialog_iframe" do
116
+ fill_in "setting_value", :with => "phil@refinerycms.com"
117
+ click_button "submit_button"
118
+ end
115
119
 
116
- page.should have_content("'Notification Recipients' was successfully updated.")
120
+ page.should have_content("Notification Recipients was successfully updated.")
121
+ end
117
122
  end
118
- end
119
123
 
120
- describe "updating confirmation email copy" do
121
- it "sets message", :js => true do
122
- visit refinery.inquiries_admin_inquiries_path
124
+ describe "updating confirmation email copy" do
125
+ before do
126
+ Rails.cache.clear
127
+ Refinery::Inquiries::Setting.confirmation_body
128
+ end
123
129
 
124
- click_link "Edit confirmation email"
130
+ it "sets message", :js => true do
131
+ visit refinery.inquiries_admin_inquiries_path
125
132
 
126
- within_frame "dialog_iframe" do
127
- fill_in "Message", :with => "Thanks %name%! We'll never get back to you!"
128
- click_button "Save"
129
- end
133
+ click_link "Edit confirmation email"
134
+
135
+ within_frame "dialog_iframe" do
136
+ fill_in "subject__en", :with => "subject"
137
+ fill_in "message__en", :with => "message"
138
+ click_button "Save"
139
+ end
130
140
 
131
- page.should have_content("'Confirmation Body' was successfully updated.")
141
+ page.should have_content("Confirmation Body was successfully updated.")
142
+ end
132
143
  end
133
- end
134
- =end
144
+
135
145
  end
136
146
  end
137
147
  end
metadata CHANGED
@@ -1,96 +1,73 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: refinerycms-inquiries
3
- version: !ruby/object:Gem::Version
4
- hash: 15
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.1
5
5
  prerelease:
6
- segments:
7
- - 2
8
- - 0
9
- - 0
10
- version: 2.0.0
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Philip Arndt
14
- - "U\xC4\xA3is Ozols"
9
+ - Uģis Ozols
15
10
  - David Jones
16
11
  autorequire:
17
12
  bindir: bin
18
13
  cert_chain: []
19
-
20
- date: 2012-03-06 00:00:00 Z
21
- dependencies:
22
- - !ruby/object:Gem::Dependency
14
+ date: 2012-03-23 00:00:00.000000000 Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
23
17
  name: refinerycms-core
24
- prerelease: false
25
- requirement: &id001 !ruby/object:Gem::Requirement
18
+ requirement: !ruby/object:Gem::Requirement
26
19
  none: false
27
- requirements:
20
+ requirements:
28
21
  - - ~>
29
- - !ruby/object:Gem::Version
30
- hash: 13
31
- segments:
32
- - 2
33
- - 0
34
- - 1
22
+ - !ruby/object:Gem::Version
35
23
  version: 2.0.1
36
24
  type: :runtime
37
- version_requirements: *id001
38
- - !ruby/object:Gem::Dependency
39
- name: refinerycms-settings
40
25
  prerelease: false
41
- requirement: &id002 !ruby/object:Gem::Requirement
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ none: false
28
+ requirements:
29
+ - - ~>
30
+ - !ruby/object:Gem::Version
31
+ version: 2.0.1
32
+ - !ruby/object:Gem::Dependency
33
+ name: refinerycms-settings
34
+ requirement: !ruby/object:Gem::Requirement
42
35
  none: false
43
- requirements:
36
+ requirements:
44
37
  - - ~>
45
- - !ruby/object:Gem::Version
46
- hash: 13
47
- segments:
48
- - 2
49
- - 0
50
- - 1
38
+ - !ruby/object:Gem::Version
51
39
  version: 2.0.1
52
40
  type: :runtime
53
- version_requirements: *id002
54
- - !ruby/object:Gem::Dependency
55
- name: filters_spam
56
41
  prerelease: false
57
- requirement: &id003 !ruby/object:Gem::Requirement
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: 2.0.1
48
+ - !ruby/object:Gem::Dependency
49
+ name: filters_spam
50
+ requirement: !ruby/object:Gem::Requirement
58
51
  none: false
59
- requirements:
52
+ requirements:
60
53
  - - ~>
61
- - !ruby/object:Gem::Version
62
- hash: 15
63
- segments:
64
- - 0
65
- - 2
66
- version: "0.2"
54
+ - !ruby/object:Gem::Version
55
+ version: '0.2'
67
56
  type: :runtime
68
- version_requirements: *id003
69
- - !ruby/object:Gem::Dependency
70
- name: refinerycms-testing
71
57
  prerelease: false
72
- requirement: &id004 !ruby/object:Gem::Requirement
58
+ version_requirements: !ruby/object:Gem::Requirement
73
59
  none: false
74
- requirements:
60
+ requirements:
75
61
  - - ~>
76
- - !ruby/object:Gem::Version
77
- hash: 15
78
- segments:
79
- - 2
80
- - 0
81
- - 0
82
- version: 2.0.0
83
- type: :development
84
- version_requirements: *id004
85
- description: Inquiry handling functionality extracted from Refinery CMS to allow you to have a contact form and manage inquiries in the Refinery backend.
62
+ - !ruby/object:Gem::Version
63
+ version: '0.2'
64
+ description: Inquiry handling functionality extracted from Refinery CMS to allow you
65
+ to have a contact form and manage inquiries in the Refinery backend.
86
66
  email: info@refinerycms.com
87
67
  executables: []
88
-
89
68
  extensions: []
90
-
91
69
  extra_rdoc_files: []
92
-
93
- files:
70
+ files:
94
71
  - .gitignore
95
72
  - .travis.yml
96
73
  - Gemfile
@@ -155,38 +132,29 @@ files:
155
132
  - tasks/rspec.rake
156
133
  homepage: http://refinerycms.com
157
134
  licenses: []
158
-
159
135
  post_install_message:
160
136
  rdoc_options: []
161
-
162
- require_paths:
137
+ require_paths:
163
138
  - lib
164
- required_ruby_version: !ruby/object:Gem::Requirement
139
+ required_ruby_version: !ruby/object:Gem::Requirement
165
140
  none: false
166
- requirements:
167
- - - ">="
168
- - !ruby/object:Gem::Version
169
- hash: 3
170
- segments:
171
- - 0
172
- version: "0"
173
- required_rubygems_version: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ! '>='
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
145
+ required_rubygems_version: !ruby/object:Gem::Requirement
174
146
  none: false
175
- requirements:
176
- - - ">="
177
- - !ruby/object:Gem::Version
178
- hash: 3
179
- segments:
180
- - 0
181
- version: "0"
147
+ requirements:
148
+ - - ! '>='
149
+ - !ruby/object:Gem::Version
150
+ version: '0'
182
151
  requirements: []
183
-
184
152
  rubyforge_project:
185
- rubygems_version: 1.8.17
153
+ rubygems_version: 1.8.19
186
154
  signing_key:
187
155
  specification_version: 3
188
156
  summary: Inquiry handling functionality for the Refinery CMS project.
189
- test_files:
157
+ test_files:
190
158
  - spec/factories/inquiry.rb
191
159
  - spec/models/refinery/inquiries/inquiry_spec.rb
192
160
  - spec/requests/refinery/inquiries/admin/inquiries_spec.rb