refinerycms-contacts 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 038cb8af15c36018df5d7ed4dc9f4241245369dd
4
+ data.tar.gz: bf086c33cfc9c70ed5637ef488e19f6ddf0bdba8
5
+ SHA512:
6
+ metadata.gz: 9dbdfadc90ab1da15d896954cbbbe9ea64752fff159b1b89199191c7335fc961ac246caaf9047179656358ad472a8353e8e2e2136cc54070c9b076f5a80c45e4
7
+ data.tar.gz: c954f401856440d299b0612f862db5d441a98f10fd6aa677ca6cf3ca75f097ac293715453ff17a3364fba905c1fc605eeaa1d90fb4fbfd4ccd821802d80d1118
@@ -0,0 +1,3 @@
1
+ .idea/*
2
+ .rvmrc
3
+ spec/dummy/*
data/Gemfile CHANGED
@@ -1,73 +1,45 @@
1
- source "http://rubygems.org"
1
+ source "https://rubygems.org"
2
2
 
3
- gemspec
4
-
5
- gem 'refinerycms', '~> 2.0.3'
6
- gem 'refinerycms-i18n', '~> 2.0.2'
3
+ gem "refinerycms-authentication-devise", '~> 1.0.4'
7
4
 
8
- # Database Configuration
9
- platforms :jruby do
10
- gem 'activerecord-jdbcsqlite3-adapter'
11
- gem 'activerecord-jdbcmysql-adapter'
12
- gem 'activerecord-jdbcpostgresql-adapter'
13
- gem 'jruby-openssl'
14
- end
5
+ gemspec
15
6
 
16
- platforms :ruby do
17
- gem 'sqlite3'
18
- gem 'mysql2'
19
- gem 'pg'
20
- end
7
+ gem 'refinerycms', '~> 3.0.5'
21
8
 
22
9
  group :development, :test do
23
- gem 'refinerycms-testing', '~> 2.0.3'
24
- gem 'guard-rspec', '~> 0.7.0'
10
+ gem 'refinerycms-testing', '~> 3.0.5'
11
+ end
25
12
 
13
+ # Add the default visual editor, for now.
14
+ gem 'refinerycms-wymeditor', ['~> 1.0', '>= 1.0.6']
26
15
 
27
- platforms :mswin, :mingw do
28
- gem 'win32console', '~> 1.3.0'
29
- gem 'rb-fchange', '~> 0.0.5'
30
- gem 'rb-notifu', '~> 0.0.4'
31
- end
16
+ group :test do
17
+ gem 'pry'
18
+ gem 'launchy'
19
+ gem 'poltergeist'
20
+ gem 'selenium-webdriver'
21
+ gem 'capybara-screenshot'
22
+ end
32
23
 
33
- platforms :ruby do
34
- gem 'spork', '~> 0.9.0'
35
- gem 'guard-spork', '~> 0.5.2'
24
+ # Database Configuration
25
+ unless ENV['TRAVIS']
26
+ gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
27
+ gem 'sqlite3', :platform => :ruby
28
+ end
36
29
 
37
- unless ENV['TRAVIS']
38
- require 'rbconfig'
39
- if RbConfig::CONFIG['target_os'] =~ /darwin/i
40
- gem 'rb-fsevent', '~> 0.9.0'
41
- gem 'ruby_gntp', '~> 0.3.4'
42
- end
43
- if RbConfig::CONFIG['target_os'] =~ /linux/i
44
- gem 'rb-inotify', '~> 0.8.8'
45
- gem 'libnotify', '~> 0.7.2'
46
- gem 'therubyracer', '~> 0.10.0'
47
- end
48
- end
49
- end
50
30
 
51
- platforms :jruby do
52
- unless ENV['TRAVIS']
53
- require 'rbconfig'
54
- if RbConfig::CONFIG['target_os'] =~ /darwin/i
55
- gem 'ruby_gntp', '~> 0.3.4'
56
- end
57
- if RbConfig::CONFIG['target_os'] =~ /linux/i
58
- gem 'rb-inotify', '~> 0.8.8'
59
- gem 'libnotify', '~> 0.7.2'
60
- end
61
- end
62
- end
31
+ if !ENV['TRAVIS'] || ENV['DB'] == 'postgresql'
32
+ gem 'activerecord-jdbcpostgresql-adapter', :platform => :jruby
33
+ gem 'pg', :platform => :ruby
63
34
  end
64
35
 
65
- # Gems used only for assets and not required
66
- # in production environments by default.
36
+ # Refinery/rails should pull in the proper versions of these
67
37
  group :assets do
68
38
  gem 'sass-rails'
69
39
  gem 'coffee-rails'
70
- gem 'uglifier'
71
40
  end
72
41
 
73
- gem 'jquery-rails', '~> 2.0.0'
42
+ # Load local gems according to Refinery developer preference.
43
+ if File.exist? local_gemfile = File.expand_path('../.gemfile', __FILE__)
44
+ eval File.read(local_gemfile)
45
+ end
@@ -0,0 +1,304 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ refinerycms-contacts (0.2.0)
5
+ recaptcha (~> 0.3.4)
6
+ refinerycms-core (~> 3.0.5)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actionmailer (4.2.7.1)
12
+ actionpack (= 4.2.7.1)
13
+ actionview (= 4.2.7.1)
14
+ activejob (= 4.2.7.1)
15
+ mail (~> 2.5, >= 2.5.4)
16
+ rails-dom-testing (~> 1.0, >= 1.0.5)
17
+ actionpack (4.2.7.1)
18
+ actionview (= 4.2.7.1)
19
+ activesupport (= 4.2.7.1)
20
+ rack (~> 1.6)
21
+ rack-test (~> 0.6.2)
22
+ rails-dom-testing (~> 1.0, >= 1.0.5)
23
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
24
+ actionview (4.2.7.1)
25
+ activesupport (= 4.2.7.1)
26
+ builder (~> 3.1)
27
+ erubis (~> 2.7.0)
28
+ rails-dom-testing (~> 1.0, >= 1.0.5)
29
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
30
+ activejob (4.2.7.1)
31
+ activesupport (= 4.2.7.1)
32
+ globalid (>= 0.3.0)
33
+ activemodel (4.2.7.1)
34
+ activesupport (= 4.2.7.1)
35
+ builder (~> 3.1)
36
+ activerecord (4.2.7.1)
37
+ activemodel (= 4.2.7.1)
38
+ activesupport (= 4.2.7.1)
39
+ arel (~> 6.0)
40
+ activesupport (4.2.7.1)
41
+ i18n (~> 0.7)
42
+ json (~> 1.7, >= 1.7.7)
43
+ minitest (~> 5.1)
44
+ thread_safe (~> 0.3, >= 0.3.4)
45
+ tzinfo (~> 1.1)
46
+ acts_as_indexed (0.8.3)
47
+ addressable (2.5.0)
48
+ public_suffix (~> 2.0, >= 2.0.2)
49
+ arel (6.0.4)
50
+ awesome_nested_set (3.0.3)
51
+ activerecord (>= 4.0.0, < 5)
52
+ babosa (1.0.2)
53
+ bcrypt (3.1.11)
54
+ builder (3.2.2)
55
+ capybara (2.4.4)
56
+ mime-types (>= 1.16)
57
+ nokogiri (>= 1.3.3)
58
+ rack (>= 1.0.0)
59
+ rack-test (>= 0.5.4)
60
+ xpath (~> 2.0)
61
+ capybara-screenshot (1.0.14)
62
+ capybara (>= 1.0, < 3)
63
+ launchy
64
+ childprocess (0.5.9)
65
+ ffi (~> 1.0, >= 1.0.11)
66
+ cliver (0.3.2)
67
+ coderay (1.1.1)
68
+ coffee-rails (4.2.1)
69
+ coffee-script (>= 2.2.0)
70
+ railties (>= 4.0.0, < 5.2.x)
71
+ coffee-script (2.4.1)
72
+ coffee-script-source
73
+ execjs
74
+ coffee-script-source (1.12.2)
75
+ concurrent-ruby (1.0.4)
76
+ database_cleaner (1.3.0)
77
+ decorators (2.0.2)
78
+ railties (>= 4.0.0, < 5.1)
79
+ devise (3.5.10)
80
+ bcrypt (~> 3.0)
81
+ orm_adapter (~> 0.1)
82
+ railties (>= 3.2.6, < 5)
83
+ responders
84
+ thread_safe (~> 0.1)
85
+ warden (~> 1.2.3)
86
+ diff-lcs (1.2.5)
87
+ diffy (3.1.0)
88
+ dragonfly (1.0.12)
89
+ addressable (~> 2.3)
90
+ multi_json (~> 1.0)
91
+ rack (>= 1.3.0)
92
+ erubis (2.7.0)
93
+ execjs (2.7.0)
94
+ factory_girl (4.5.0)
95
+ activesupport (>= 3.0.0)
96
+ factory_girl_rails (4.6.0)
97
+ factory_girl (~> 4.5.0)
98
+ railties (>= 3.0.0)
99
+ ffi (1.9.14)
100
+ font-awesome-sass (4.7.0)
101
+ sass (>= 3.2)
102
+ friendly_id (5.1.0)
103
+ activerecord (>= 4.0.0)
104
+ globalid (0.3.7)
105
+ activesupport (>= 4.1.0)
106
+ globalize (5.0.1)
107
+ activemodel (>= 4.2.0, < 4.3)
108
+ activerecord (>= 4.2.0, < 4.3)
109
+ i18n (0.7.0)
110
+ jquery-rails (4.2.2)
111
+ rails-dom-testing (>= 1, < 3)
112
+ railties (>= 4.2.0)
113
+ thor (>= 0.14, < 2.0)
114
+ jquery-ui-rails (5.0.5)
115
+ railties (>= 3.2.16)
116
+ json (1.8.3)
117
+ launchy (2.4.3)
118
+ addressable (~> 2.3)
119
+ loofah (2.0.3)
120
+ nokogiri (>= 1.5.9)
121
+ mail (2.6.4)
122
+ mime-types (>= 1.16, < 4)
123
+ method_source (0.8.2)
124
+ mime-types (3.1)
125
+ mime-types-data (~> 3.2015)
126
+ mime-types-data (3.2016.0521)
127
+ mini_portile2 (2.1.0)
128
+ minitest (5.10.1)
129
+ multi_json (1.12.1)
130
+ nokogiri (1.7.0)
131
+ mini_portile2 (~> 2.1.0)
132
+ orm_adapter (0.5.0)
133
+ pg (0.19.0)
134
+ poltergeist (1.12.0)
135
+ capybara (~> 2.1)
136
+ cliver (~> 0.3.1)
137
+ websocket-driver (>= 0.2.0)
138
+ pry (0.10.4)
139
+ coderay (~> 1.1.0)
140
+ method_source (~> 0.8.1)
141
+ slop (~> 3.4)
142
+ public_suffix (2.0.4)
143
+ rack (1.6.5)
144
+ rack-test (0.6.3)
145
+ rack (>= 1.0)
146
+ rails-deprecated_sanitizer (1.0.3)
147
+ activesupport (>= 4.2.0.alpha)
148
+ rails-dom-testing (1.0.8)
149
+ activesupport (>= 4.2.0.beta, < 5.0)
150
+ nokogiri (~> 1.6)
151
+ rails-deprecated_sanitizer (>= 1.0.1)
152
+ rails-html-sanitizer (1.0.3)
153
+ loofah (~> 2.0)
154
+ rails-i18n (4.0.9)
155
+ i18n (~> 0.7)
156
+ railties (~> 4.0)
157
+ railties (4.2.7.1)
158
+ actionpack (= 4.2.7.1)
159
+ activesupport (= 4.2.7.1)
160
+ rake (>= 0.8.7)
161
+ thor (>= 0.18.1, < 2.0)
162
+ rake (12.0.0)
163
+ recaptcha (0.3.6)
164
+ refinerycms (3.0.5)
165
+ refinerycms-core (= 3.0.5)
166
+ refinerycms-images (= 3.0.5)
167
+ refinerycms-pages (= 3.0.5)
168
+ refinerycms-resources (= 3.0.5)
169
+ refinerycms-authentication-devise (1.0.4)
170
+ actionmailer (~> 4.2, >= 4.2.0)
171
+ devise (~> 3.0, >= 3.2.4)
172
+ friendly_id (~> 5.1.0)
173
+ refinerycms-core (~> 3.0, >= 3.0.0)
174
+ refinerycms-core (3.0.5)
175
+ actionpack (>= 4.2.3, < 5.0)
176
+ activerecord (>= 4.2.3, < 5.0)
177
+ awesome_nested_set (~> 3.0.0)
178
+ coffee-rails (~> 4.0, >= 4.0.0)
179
+ decorators (~> 2.0.0)
180
+ font-awesome-sass (>= 4.3.0, < 5.0)
181
+ jquery-rails (>= 2.3.0)
182
+ jquery-ui-rails (~> 5.0.0)
183
+ railties (>= 4.2.3, < 5.0)
184
+ refinerycms-i18n (~> 3.0.0)
185
+ sass-rails (>= 4.0, < 5.1)
186
+ truncate_html (~> 0.9)
187
+ will_paginate (~> 3.0.2)
188
+ zilch-authorisation
189
+ refinerycms-i18n (3.0.1)
190
+ rails-i18n (~> 4.0.1)
191
+ routing-filter (>= 0.4.0)
192
+ refinerycms-images (3.0.5)
193
+ dragonfly (~> 1.0.0)
194
+ globalize (>= 4.0.0, < 5.2)
195
+ refinerycms-core (= 3.0.5)
196
+ refinerycms-pages (3.0.5)
197
+ awesome_nested_set (~> 3.0.0)
198
+ babosa (!= 0.3.6)
199
+ diffy (~> 3.1.0)
200
+ friendly_id (>= 5.1.0, < 5.3)
201
+ globalize (>= 4.0.0, < 5.2)
202
+ refinerycms-core (= 3.0.5)
203
+ seo_meta (~> 2.0.0.rc.1)
204
+ speakingurl-rails (~> 8.0.0)
205
+ refinerycms-resources (3.0.5)
206
+ acts_as_indexed (~> 0.8.0)
207
+ dragonfly (~> 1.0.0)
208
+ globalize (>= 4.0.0, < 5.2)
209
+ refinerycms-core (= 3.0.5)
210
+ refinerycms-testing (3.0.5)
211
+ capybara (~> 2.4.3)
212
+ database_cleaner (~> 1.3.0)
213
+ factory_girl_rails (~> 4.6.0)
214
+ refinerycms-core (= 3.0.5)
215
+ rspec-rails (~> 3.0)
216
+ refinerycms-wymeditor (1.1.0)
217
+ refinerycms-core (>= 3.0.0, < 5.0)
218
+ responders (2.3.0)
219
+ railties (>= 4.2.0, < 5.1)
220
+ routing-filter (0.6.0)
221
+ actionpack (>= 4.2, < 5.1)
222
+ activesupport (>= 4.2, < 5.1)
223
+ rspec-core (3.5.4)
224
+ rspec-support (~> 3.5.0)
225
+ rspec-expectations (3.5.0)
226
+ diff-lcs (>= 1.2.0, < 2.0)
227
+ rspec-support (~> 3.5.0)
228
+ rspec-mocks (3.5.0)
229
+ diff-lcs (>= 1.2.0, < 2.0)
230
+ rspec-support (~> 3.5.0)
231
+ rspec-rails (3.5.2)
232
+ actionpack (>= 3.0)
233
+ activesupport (>= 3.0)
234
+ railties (>= 3.0)
235
+ rspec-core (~> 3.5.0)
236
+ rspec-expectations (~> 3.5.0)
237
+ rspec-mocks (~> 3.5.0)
238
+ rspec-support (~> 3.5.0)
239
+ rspec-support (3.5.0)
240
+ rubyzip (1.2.0)
241
+ sass (3.4.23)
242
+ sass-rails (5.0.6)
243
+ railties (>= 4.0.0, < 6)
244
+ sass (~> 3.1)
245
+ sprockets (>= 2.8, < 4.0)
246
+ sprockets-rails (>= 2.0, < 4.0)
247
+ tilt (>= 1.1, < 3)
248
+ selenium-webdriver (3.0.5)
249
+ childprocess (~> 0.5)
250
+ rubyzip (~> 1.0)
251
+ websocket (~> 1.0)
252
+ seo_meta (2.0.0.rc.1)
253
+ railties (>= 3.0.0)
254
+ slop (3.6.0)
255
+ speakingurl-rails (8.0.2)
256
+ railties (>= 3.1)
257
+ sprockets (3.7.1)
258
+ concurrent-ruby (~> 1.0)
259
+ rack (> 1, < 3)
260
+ sprockets-rails (3.2.0)
261
+ actionpack (>= 4.0)
262
+ activesupport (>= 4.0)
263
+ sprockets (>= 3.0.0)
264
+ sqlite3 (1.3.12)
265
+ thor (0.19.4)
266
+ thread_safe (0.3.5)
267
+ tilt (2.0.5)
268
+ truncate_html (0.9.3)
269
+ tzinfo (1.2.2)
270
+ thread_safe (~> 0.1)
271
+ warden (1.2.6)
272
+ rack (>= 1.0)
273
+ websocket (1.2.3)
274
+ websocket-driver (0.6.4)
275
+ websocket-extensions (>= 0.1.0)
276
+ websocket-extensions (0.1.2)
277
+ will_paginate (3.0.12)
278
+ xpath (2.0.0)
279
+ nokogiri (~> 1.3)
280
+ zilch-authorisation (0.0.1)
281
+
282
+ PLATFORMS
283
+ ruby
284
+
285
+ DEPENDENCIES
286
+ activerecord-jdbcpostgresql-adapter
287
+ activerecord-jdbcsqlite3-adapter
288
+ capybara-screenshot
289
+ coffee-rails
290
+ launchy
291
+ pg
292
+ poltergeist
293
+ pry
294
+ refinerycms (~> 3.0.5)
295
+ refinerycms-authentication-devise (~> 1.0.4)
296
+ refinerycms-contacts!
297
+ refinerycms-testing (~> 3.0.5)
298
+ refinerycms-wymeditor (~> 1.0, >= 1.0.6)
299
+ sass-rails
300
+ selenium-webdriver
301
+ sqlite3
302
+
303
+ BUNDLED WITH
304
+ 1.13.7
data/Rakefile CHANGED
@@ -13,8 +13,9 @@ if File.exists?(APP_RAKEFILE)
13
13
  end
14
14
 
15
15
  require "refinerycms-testing"
16
- Refinery::Testing::Railtie.load_tasks
17
16
  Refinery::Testing::Railtie.load_dummy_tasks(ENGINE_PATH)
18
17
 
19
- load File.expand_path('../tasks/testing.rake', __FILE__)
20
18
  load File.expand_path('../tasks/rspec.rake', __FILE__)
19
+
20
+ task :default => :spec
21
+
@@ -4,10 +4,14 @@ module Refinery
4
4
  class ContactsController < ::Refinery::AdminController
5
5
  include ContactsHelper
6
6
  helper :"refinery/contacts/admin/contacts"
7
- cache_sweeper ContactSweeper
8
7
 
9
8
  crudify :'refinery/contacts/contact', :xhr_paging => true
10
9
 
10
+ protected
11
+
12
+ def contact_params
13
+ params.require(:contact).permit(:title, :street, :city, :zip_code, :homepage, :company, :province, :country, :tel1, :tel2, :tel3, :fax, :position, :mails_attributes => [:id, :mail, :_destroy ])
14
+ end
11
15
  end
12
16
  end
13
17
  end
@@ -5,7 +5,5 @@ module Refinery
5
5
  belongs_to :page, :polymorphic => true
6
6
 
7
7
 
8
- attr_accessible :page_id, :page_type, :contact_id , :contact_info
9
-
10
8
  end
11
9
  end
@@ -2,16 +2,12 @@ module Refinery
2
2
  module Contacts
3
3
  class Contact < Refinery::Core::BaseModel
4
4
  has_many :mails
5
- default_scope order("position DESC")
5
+ default_scope -> {order("position DESC")}
6
6
 
7
7
  accepts_nested_attributes_for :mails, :allow_destroy => true
8
8
 
9
9
  self.table_name = 'refinery_contacts'
10
10
 
11
- attr_accessible :title, :street, :city, :zip_code, :homepage, :company, :province, :country, :tel1, :tel2, :tel3, :fax, :position, :mails_attributes
12
-
13
- acts_as_indexed :fields => [:title, :street, :city, :zip_code, :province, :country, :tel1, :tel2, :tel3, :fax]
14
-
15
11
  validates :title, :presence => true, :uniqueness => true
16
12
  validates_format_of :homepage, :with => URI.regexp(['http','https']), :allow_blank => true
17
13
  end
@@ -3,9 +3,6 @@ module Refinery
3
3
  class Mail < Refinery::Core::BaseModel
4
4
  belongs_to :contact
5
5
 
6
- attr_accessible :mail, :position
7
-
8
- acts_as_indexed :fields => [:mail]
9
6
 
10
7
  validates_format_of :mail, :with => /.+@.+\..+/i , :allow_blank => false
11
8
 
@@ -1,6 +1,6 @@
1
1
  <div class='field'>
2
2
  <%= f.label :mail %>
3
- <%= f.text_field :mail %>
3
+ <%= f.text_field :mail, :class=>"mail_field" %>
4
4
 
5
5
  <%= f.hidden_field :_destroy %>
6
6
  <%= link_to t('.remove'), '#', :class=>"remove_fields" %>
@@ -1,14 +1,13 @@
1
1
  <% if @page.mails.present? %>
2
2
  <%= form_for (flash[:mail_message].present?) ? flash[:mail_message] : Refinery::Contacts::MailMessage.new ,
3
- :url=> deliver_contacts_mail_messages_path,
4
- :validate => true do |f| %>
3
+ :url=> deliver_contacts_mail_messages_path do |f| %>
5
4
 
6
5
  <%= render 'refinery/contacts/contacts/success_info' %>
7
6
  <%= render 'refinery/contacts/contacts/error_info' %>
8
7
 
9
8
  <div class="field ">
10
9
  <%= f.label :recipient_id %>
11
- <%= f.collection_select :recipient_id, @page.mails.obfuscated, :id, :mail, { :prompt=> ((@page.mails.length > 1) ? true : false) } %>
10
+ <%= f.collection_select :recipient_id, @page.mails, :id, :mail, { :prompt=> ((@page.mails.length > 1) ? true : false) } %>
12
11
  </div>
13
12
 
14
13
 
@@ -4,7 +4,7 @@ Refinery::Core::Engine.routes.append do
4
4
  namespace :contacts, :path => '' do
5
5
  resources :mail_messages, :only => :deliver do
6
6
  collection do
7
- post :deliver, :as => :deliver
7
+ post :deliver
8
8
  end
9
9
  end
10
10
  end
@@ -1,4 +1,4 @@
1
- (Refinery.i18n_enabled? ? Refinery::I18n.frontend_locales : [:en]).each do |lang|
1
+ (Refinery::I18n.frontend_locales ).each do |lang|
2
2
  I18n.locale = lang
3
3
 
4
4
  if defined?(Refinery::User)
@@ -16,9 +16,6 @@ module Refinery
16
16
  plugin.name = "contacts"
17
17
  plugin.url = proc { Refinery::Core::Engine.routes.url_helpers.contacts_admin_contacts_path }
18
18
  plugin.pathname = root
19
- plugin.activity = {
20
- :class_name => :'refinery/contacts/contact'
21
- }
22
19
 
23
20
  end
24
21
  end
@@ -30,7 +30,6 @@ module Refinery
30
30
  end
31
31
  end
32
32
 
33
- attr_accessible :contact_page
34
33
  end
35
34
  end
36
35
  end
@@ -2,8 +2,8 @@ module Refinery
2
2
  module Contacts
3
3
  class Version
4
4
  @major = 0
5
- @minor = 1
6
- @tiny = '2'
5
+ @minor = 2
6
+ @tiny = '0'
7
7
 
8
8
  class << self
9
9
  attr_reader :major, :minor, :tiny
data/readme.md CHANGED
@@ -6,7 +6,7 @@ Attach contact form to any page with contact information
6
6
 
7
7
  ## Requirements
8
8
 
9
- This version supports Rails 3.2.x and Refinery CMS ~> 2.0.9. (Should work with ~> 2.0.0, not tested)
9
+ This version supports Rails 4.2.x and Refinery CMS ~> 3.0.0.
10
10
 
11
11
  ## Features
12
12
 
@@ -38,7 +38,7 @@ Gem is translated to slovak and english.
38
38
  Open up your ``Gemfile`` and add at the bottom this line:
39
39
 
40
40
  ```ruby
41
- gem 'refinerycms-contacts', '~> 0.1.0'
41
+ gem 'refinerycms-contacts', '~> 0.2.0'
42
42
  ```
43
43
 
44
44
  Now, run
@@ -65,6 +65,18 @@ Seed your database:
65
65
  rake db:seed
66
66
  ```
67
67
 
68
+ Override PagesContoller to get strong params work
69
+
70
+ ```ruby
71
+ rake refinery:override controller=admin/pages_controller
72
+ ```
73
+
74
+ Open that file, find function permitted_page_params and append
75
+
76
+ ```ruby
77
+ contact_page: [:contact_id,:contact_info]
78
+ ```
79
+
68
80
  ### Assets + views
69
81
 
70
82
  If you don't have Chosen JS included in your backend yet, append this code to your_app/config/initializers/refinery/core.rb
@@ -152,7 +164,6 @@ rake assets:precompile
152
164
  ## Todo list
153
165
 
154
166
  * add js pop-up in page's tab to allow create contact "in-place" instead of clicking through menu
155
- * tests :(
156
167
 
157
168
  ## Code
158
169
 
@@ -164,7 +175,10 @@ rake assets:precompile
164
175
  * reCaptcha validation shows errors both for incorrect-captcha-sol and verification_failed key
165
176
 
166
177
  ## Testing
167
- TODO
178
+ * cd to this engine path
179
+ * bundle install
180
+ * rake refinery:testing:dummy_app
181
+ * rake spec
168
182
 
169
183
  ## License
170
184
 
@@ -19,9 +19,9 @@ Gem::Specification.new do |s|
19
19
  #s.test_files = `git ls-files -- spec/*`.split("\n")
20
20
 
21
21
  # Runtime dependencies
22
- s.add_dependency 'refinerycms-core', '~> 2.0.9' # should work ~> 2.0.0 , not tested
23
- s.add_dependency 'recaptcha'
22
+ s.add_dependency 'refinerycms-core', '~> 3.0.5'
23
+ s.add_dependency 'recaptcha', '~> 0.3.4'
24
24
 
25
25
  # Development dependencies (usually used for testing)
26
- # s.add_development_dependency 'refinerycms-testing', '~> 2.0.9'
26
+ s.add_development_dependency 'refinerycms-testing', '~> 3.0.5'
27
27
  end
@@ -1,7 +1,7 @@
1
-
2
1
  FactoryGirl.define do
3
2
  factory :contact, :class => Refinery::Contacts::Contact do
4
- sequence(:title) { |n| "refinery#{n}" }
3
+ title "Title"
4
+ homepage "http://www.matho.sk"
5
5
  end
6
6
  end
7
7
 
@@ -0,0 +1,11 @@
1
+ FactoryGirl.define do
2
+ factory :mail_message, :class => Refinery::Contacts::Mail do
3
+ name "Nazov"
4
+ recipient_id 1
5
+ subject "subject"
6
+ text "text"
7
+ sender_mail "martin.markech@matho.sk"
8
+
9
+ end
10
+ end
11
+
@@ -1,7 +1,6 @@
1
-
2
1
  FactoryGirl.define do
3
2
  factory :mail, :class => Refinery::Contacts::Mail do
4
- sequence(:mail) { |n| "refinery#{n}" }
3
+ mail "martin.markech@matho.sk"
5
4
  end
6
5
  end
7
6
 
@@ -0,0 +1,27 @@
1
+ FactoryGirl.define do
2
+ factory :authentication_devise_user, :class => Refinery::Authentication::Devise::User do
3
+ sequence(:username) { |n| "refinery#{n}" }
4
+ sequence(:email) { |n| "refinery#{n}@example.com" }
5
+ password "refinerycms"
6
+ password_confirmation "refinerycms"
7
+ end
8
+
9
+ factory :authentication_devise_refinery_user, :parent => :authentication_devise_user do
10
+ roles { [ ::Refinery::Authentication::Devise::Role[:refinery] ] }
11
+
12
+ after(:create) do |user|
13
+ ::Refinery::Plugins.registered.each_with_index do |plugin, index|
14
+ user.plugins.create(:name => plugin.name, :position => index)
15
+ end
16
+ end
17
+ end
18
+
19
+ factory :authentication_devise_refinery_superuser, :parent => :authentication_devise_refinery_user do
20
+ roles {
21
+ [
22
+ ::Refinery::Authentication::Devise::Role[:refinery],
23
+ ::Refinery::Authentication::Devise::Role[:superuser]
24
+ ]
25
+ }
26
+ end
27
+ end
@@ -0,0 +1,40 @@
1
+ require "spec_helper"
2
+
3
+ describe "manage contact items", :type => :feature, js: true do
4
+ refinery_login_with_devise :authentication_devise_refinery_superuser
5
+
6
+ describe "new/create" do
7
+ it "allows to create contact" do
8
+ visit refinery.new_contacts_admin_contact_path
9
+
10
+ fill_in "Title", :with => "Creators"
11
+
12
+
13
+ find(:xpath, "//a[@class='add_fields'][1]").click
14
+ find(:xpath, "//a[@class='add_fields'][1]").click
15
+
16
+
17
+ find(:xpath, "(//input[@class='mail_field'])[1]").set("martin.markech@matho.sk")
18
+ find(:xpath, "(//input[@class='mail_field'])[2]").set("martin.markech2@matho.sk")
19
+
20
+ #save_and_open_page
21
+
22
+ fill_in "Company", :with => "Company s.r.o"
23
+ fill_in "Street", :with => "Street"
24
+ fill_in "City", :with => "Bratislava"
25
+ fill_in "Zip Code", :with => "82103"
26
+ fill_in "Province", :with => "Province"
27
+ fill_in "Country", :with => "Slovakia"
28
+ fill_in "Homepage (starts with http://)", :with => "http://www.matho.sk"
29
+ fill_in "Tel1", :with => "+421900000000"
30
+
31
+
32
+ click_button "Save"
33
+
34
+ expect(page).to have_content("'Creators' was successfully added.")
35
+
36
+ expect(Refinery::Contacts::Contact.count).to eq(1)
37
+ expect(Refinery::Contacts::Mail.count).to eq(2)
38
+ end
39
+ end
40
+ end
@@ -1,55 +1,32 @@
1
- def setup_environment
2
- # Configure Rails Environment
3
- ENV["RAILS_ENV"] ||= 'test'
4
-
5
- if File.exist?(dummy_path = File.expand_path('../dummy/config/environment.rb', __FILE__))
6
- require dummy_path
7
- elsif File.dirname(__FILE__) =~ %r{vendor/extensions}
8
- # Require the path to the refinerycms application this is vendored inside.
9
- require File.expand_path('../../../../../config/environment', __FILE__)
10
- end
11
-
12
- require 'rspec/rails'
13
- require 'capybara/rspec'
14
-
15
- Rails.backtrace_cleaner.remove_silencers!
16
-
17
- RSpec.configure do |config|
18
- config.mock_with :rspec
19
- config.treat_symbols_as_metadata_keys_with_true_values = true
20
- config.filter_run :focus => true
21
- config.run_all_when_everything_filtered = true
22
- end
23
- end
1
+ require 'rubygems'
2
+
3
+ # Configure Rails Environment
4
+ ENV["RAILS_ENV"] ||= 'test'
5
+
6
+ require File.expand_path("../dummy/config/environment", __FILE__)
7
+
8
+ require 'rspec/rails'
9
+ require 'capybara/rspec'
10
+ require 'capybara-screenshot/rspec'
24
11
 
25
- def each_run
26
- Rails.cache.clear
27
- ActiveSupport::Dependencies.clear
28
- FactoryGirl.reload
29
-
30
- # Requires supporting files with custom matchers and macros, etc,
31
- # in ./support/ and its subdirectories including factories.
32
- ([Rails.root.to_s] | ::Refinery::Plugins.registered.pathnames).map{|p|
33
- Dir[File.join(p, 'spec', 'support', '**', '*.rb').to_s]
34
- }.flatten.sort.each do |support_file|
35
- require support_file
36
- end
12
+ Capybara::Screenshot.autosave_on_failure = false
13
+
14
+ Rails.backtrace_cleaner.remove_silencers!
15
+
16
+ RSpec.configure do |config|
17
+ config.mock_with :rspec
18
+ config.filter_run :focus => true
19
+ config.run_all_when_everything_filtered = true
37
20
  end
38
21
 
39
- # If spork is available in the Gemfile it'll be used but we don't force it.
40
- unless (begin; require 'spork'; rescue LoadError; nil end).nil?
41
- Spork.prefork do
42
- # Loading more in this block will cause your tests to run faster. However,
43
- # if you change any configuration or code from libraries loaded here, you'll
44
- # need to restart spork for it take effect.
45
- setup_environment
46
- end
47
-
48
- Spork.each_run do
49
- # This code will be run each time you run your specs.
50
- each_run
51
- end
52
- else
53
- setup_environment
54
- each_run
22
+ # set javascript driver for capybara
23
+ require 'capybara/poltergeist'
24
+ Capybara.javascript_driver = :poltergeist
25
+
26
+ # Requires supporting files with custom matchers and macros, etc,
27
+ # in ./support/ and its subdirectories including factories.
28
+ ([Rails.root.to_s] | ::Refinery::Plugins.registered.pathnames).map{|p|
29
+ Dir[File.join(p, 'spec', 'support', '**', '*.rb').to_s]
30
+ }.flatten.sort.each do |support_file|
31
+ require support_file
55
32
  end
metadata CHANGED
@@ -1,55 +1,77 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: refinerycms-contacts
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.1.2
4
+ version: 0.2.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Martin Markech
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-01-04 00:00:00.000000000 Z
11
+ date: 2016-12-29 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
- type: :runtime
14
+ name: refinerycms-core
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
- version: 2.0.9
19
+ version: 3.0.5
20
+ type: :runtime
22
21
  prerelease: false
23
22
  version_requirements: !ruby/object:Gem::Requirement
24
- none: false
25
23
  requirements:
26
- - - ~>
24
+ - - "~>"
27
25
  - !ruby/object:Gem::Version
28
- version: 2.0.9
29
- name: refinerycms-core
26
+ version: 3.0.5
30
27
  - !ruby/object:Gem::Dependency
28
+ name: recaptcha
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.3.4
31
34
  type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.3.4
41
+ - !ruby/object:Gem::Dependency
42
+ name: refinerycms-testing
32
43
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
44
  requirements:
35
- - - ! '>='
45
+ - - "~>"
36
46
  - !ruby/object:Gem::Version
37
- version: '0'
47
+ version: 3.0.5
48
+ type: :development
38
49
  prerelease: false
39
50
  version_requirements: !ruby/object:Gem::Requirement
40
- none: false
41
51
  requirements:
42
- - - ! '>='
52
+ - - "~>"
43
53
  - !ruby/object:Gem::Version
44
- version: '0'
45
- name: recaptcha
54
+ version: 3.0.5
46
55
  description: Ruby on Rails Contacts extension for Refinery CMS
47
56
  email: martin.markech@matho.sk
48
57
  executables: []
49
58
  extensions: []
50
59
  extra_rdoc_files: []
51
60
  files:
61
+ - ".gitignore"
62
+ - ".idea/.generators"
63
+ - ".idea/.rakeTasks"
64
+ - ".idea/misc.xml"
65
+ - ".idea/modules.xml"
66
+ - ".idea/refinerycms-contacts.iml"
67
+ - ".idea/runConfigurations/Development__refinerycms_contacts.xml"
68
+ - ".idea/runConfigurations/Production__refinerycms_contacts.xml"
69
+ - ".idea/runConfigurations/spec__refinerycms_contacts.xml"
70
+ - ".idea/runConfigurations/test__refinerycms_contacts.xml"
71
+ - ".idea/vcs.xml"
72
+ - ".idea/workspace.xml"
52
73
  - Gemfile
74
+ - Gemfile.lock
53
75
  - Guardfile
54
76
  - LICENSE.md
55
77
  - Rakefile
@@ -67,7 +89,6 @@ files:
67
89
  - app/models/refinery/contacts/mail.rb
68
90
  - app/models/refinery/contacts/mail_message.rb
69
91
  - app/models/refinery/contacts/table_less_model.rb
70
- - app/sweepers/refinery/contacts/admin/contact_sweeper.rb
71
92
  - app/views/refinery/admin/pages/tabs/contacts/_contacts.html.erb
72
93
  - app/views/refinery/admin/pages/tabs/contacts/_contacts_bar.html.erb
73
94
  - app/views/refinery/admin/pages/tabs/contacts/_form.html.erb
@@ -111,37 +132,35 @@ files:
111
132
  - readme.md
112
133
  - refinerycms-contacts.gemspec
113
134
  - script/rails
114
- - spec/models/refinery/contacts/contact_spec.rb
115
- - spec/models/refinery/contacts/mail_spec.rb
116
- - spec/requests/refinery/contacts/admin/contacts_spec.rb
117
- - spec/requests/refinery/contacts/admin/mails_spec.rb
135
+ - spec/factories/contacts.rb
136
+ - spec/factories/mail_message.rb
137
+ - spec/factories/mails.rb
138
+ - spec/factories/user.rb
139
+ - spec/features/manage_contact_spec.rb
118
140
  - spec/spec_helper.rb
119
- - spec/support/factories/refinery/contacts.rb
120
- - spec/support/factories/refinery/mails.rb
121
141
  - tasks/rspec.rake
122
142
  - tasks/testing.rake
123
143
  homepage: http://github.com/Matho/refinerycms-contacts
124
144
  licenses: []
145
+ metadata: {}
125
146
  post_install_message:
126
147
  rdoc_options: []
127
148
  require_paths:
128
149
  - lib
129
150
  required_ruby_version: !ruby/object:Gem::Requirement
130
- none: false
131
151
  requirements:
132
- - - ! '>='
152
+ - - ">="
133
153
  - !ruby/object:Gem::Version
134
154
  version: '0'
135
155
  required_rubygems_version: !ruby/object:Gem::Requirement
136
- none: false
137
156
  requirements:
138
- - - ! '>='
157
+ - - ">="
139
158
  - !ruby/object:Gem::Version
140
159
  version: '0'
141
160
  requirements: []
142
161
  rubyforge_project:
143
- rubygems_version: 1.8.24
162
+ rubygems_version: 2.4.8
144
163
  signing_key:
145
- specification_version: 3
164
+ specification_version: 4
146
165
  summary: Attach contact form to any page in Refinery CMS
147
166
  test_files: []
@@ -1,22 +0,0 @@
1
- module Refinery
2
- module Contacts
3
- module Admin
4
- class ContactSweeper < ActionController::Caching::Sweeper
5
- =begin
6
- # Because of server-side error rendering, caching is commented.
7
- observe Contact
8
-
9
-
10
- def sweep(contact)
11
- expire_fragment("refinery/contacts/contact/#{contact.id}")
12
- end
13
-
14
-
15
- alias_method :after_create, :sweep
16
- alias_method :after_update, :sweep
17
- alias_method :after_destroy, :sweep
18
- =end
19
- end
20
- end
21
- end
22
- end
@@ -1,18 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Refinery
4
- module Contacts
5
- describe Contact do
6
- describe "validations" do
7
- subject do
8
- FactoryGirl.create(:contact,
9
- :title => "Refinery CMS")
10
- end
11
-
12
- it { should be_valid }
13
- its(:errors) { should be_empty }
14
- its(:title) { should == "Refinery CMS" }
15
- end
16
- end
17
- end
18
- end
@@ -1,18 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Refinery
4
- module Contacts
5
- describe Mail do
6
- describe "validations" do
7
- subject do
8
- FactoryGirl.create(:mail,
9
- :mail => "Refinery CMS")
10
- end
11
-
12
- it { should be_valid }
13
- its(:errors) { should be_empty }
14
- its(:mail) { should == "Refinery CMS" }
15
- end
16
- end
17
- end
18
- end
@@ -1,101 +0,0 @@
1
- # encoding: utf-8
2
- require "spec_helper"
3
-
4
- describe Refinery do
5
- describe "Contacts" do
6
- describe "Admin" do
7
- describe "contacts" do
8
- login_refinery_user
9
-
10
- describe "contacts list" do
11
- before do
12
- FactoryGirl.create(:contact, :title => "UniqueTitleOne")
13
- FactoryGirl.create(:contact, :title => "UniqueTitleTwo")
14
- end
15
-
16
- it "shows two items" do
17
- visit refinery.contacts_admin_contacts_path
18
- page.should have_content("UniqueTitleOne")
19
- page.should have_content("UniqueTitleTwo")
20
- end
21
- end
22
-
23
- describe "create" do
24
- before do
25
- visit refinery.contacts_admin_contacts_path
26
-
27
- click_link "Add New Contact"
28
- end
29
-
30
- context "valid data" do
31
- it "should succeed" do
32
- fill_in "Title", :with => "This is a test of the first string field"
33
- click_button "Save"
34
-
35
- page.should have_content("'This is a test of the first string field' was successfully added.")
36
- Refinery::Contacts::Contact.count.should == 1
37
- end
38
- end
39
-
40
- context "invalid data" do
41
- it "should fail" do
42
- click_button "Save"
43
-
44
- page.should have_content("Title can't be blank")
45
- Refinery::Contacts::Contact.count.should == 0
46
- end
47
- end
48
-
49
- context "duplicate" do
50
- before { FactoryGirl.create(:contact, :title => "UniqueTitle") }
51
-
52
- it "should fail" do
53
- visit refinery.contacts_admin_contacts_path
54
-
55
- click_link "Add New Contact"
56
-
57
- fill_in "Title", :with => "UniqueTitle"
58
- click_button "Save"
59
-
60
- page.should have_content("There were problems")
61
- Refinery::Contacts::Contact.count.should == 1
62
- end
63
- end
64
-
65
- end
66
-
67
- describe "edit" do
68
- before { FactoryGirl.create(:contact, :title => "A title") }
69
-
70
- it "should succeed" do
71
- visit refinery.contacts_admin_contacts_path
72
-
73
- within ".actions" do
74
- click_link "Edit this contact"
75
- end
76
-
77
- fill_in "Title", :with => "A different title"
78
- click_button "Save"
79
-
80
- page.should have_content("'A different title' was successfully updated.")
81
- page.should have_no_content("A title")
82
- end
83
- end
84
-
85
- describe "destroy" do
86
- before { FactoryGirl.create(:contact, :title => "UniqueTitleOne") }
87
-
88
- it "should succeed" do
89
- visit refinery.contacts_admin_contacts_path
90
-
91
- click_link "Remove this contact forever"
92
-
93
- page.should have_content("'UniqueTitleOne' was successfully removed.")
94
- Refinery::Contacts::Contact.count.should == 0
95
- end
96
- end
97
-
98
- end
99
- end
100
- end
101
- end
@@ -1,101 +0,0 @@
1
- # encoding: utf-8
2
- require "spec_helper"
3
-
4
- describe Refinery do
5
- describe "Contacts" do
6
- describe "Admin" do
7
- describe "mails" do
8
- login_refinery_user
9
-
10
- describe "mails list" do
11
- before do
12
- FactoryGirl.create(:mail, :mail => "UniqueTitleOne")
13
- FactoryGirl.create(:mail, :mail => "UniqueTitleTwo")
14
- end
15
-
16
- it "shows two items" do
17
- visit refinery.contacts_admin_mails_path
18
- page.should have_content("UniqueTitleOne")
19
- page.should have_content("UniqueTitleTwo")
20
- end
21
- end
22
-
23
- describe "create" do
24
- before do
25
- visit refinery.contacts_admin_mails_path
26
-
27
- click_link "Add New Mail"
28
- end
29
-
30
- context "valid data" do
31
- it "should succeed" do
32
- fill_in "Mail", :with => "This is a test of the first string field"
33
- click_button "Save"
34
-
35
- page.should have_content("'This is a test of the first string field' was successfully added.")
36
- Refinery::Contacts::Mail.count.should == 1
37
- end
38
- end
39
-
40
- context "invalid data" do
41
- it "should fail" do
42
- click_button "Save"
43
-
44
- page.should have_content("Mail can't be blank")
45
- Refinery::Contacts::Mail.count.should == 0
46
- end
47
- end
48
-
49
- context "duplicate" do
50
- before { FactoryGirl.create(:mail, :mail => "UniqueTitle") }
51
-
52
- it "should fail" do
53
- visit refinery.contacts_admin_mails_path
54
-
55
- click_link "Add New Mail"
56
-
57
- fill_in "Mail", :with => "UniqueTitle"
58
- click_button "Save"
59
-
60
- page.should have_content("There were problems")
61
- Refinery::Contacts::Mail.count.should == 1
62
- end
63
- end
64
-
65
- end
66
-
67
- describe "edit" do
68
- before { FactoryGirl.create(:mail, :mail => "A mail") }
69
-
70
- it "should succeed" do
71
- visit refinery.contacts_admin_mails_path
72
-
73
- within ".actions" do
74
- click_link "Edit this mail"
75
- end
76
-
77
- fill_in "Mail", :with => "A different mail"
78
- click_button "Save"
79
-
80
- page.should have_content("'A different mail' was successfully updated.")
81
- page.should have_no_content("A mail")
82
- end
83
- end
84
-
85
- describe "destroy" do
86
- before { FactoryGirl.create(:mail, :mail => "UniqueTitleOne") }
87
-
88
- it "should succeed" do
89
- visit refinery.contacts_admin_mails_path
90
-
91
- click_link "Remove this mail forever"
92
-
93
- page.should have_content("'UniqueTitleOne' was successfully removed.")
94
- Refinery::Contacts::Mail.count.should == 0
95
- end
96
- end
97
-
98
- end
99
- end
100
- end
101
- end