refinerycms-inquiries 2.1.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +5 -6
  3. data/Gemfile +14 -18
  4. data/Rakefile +0 -1
  5. data/app/assets/stylesheets/refinery/inquiries/inquiries.css.scss +3 -0
  6. data/app/controllers/refinery/inquiries/admin/inquiries_controller.rb +9 -3
  7. data/app/controllers/refinery/inquiries/admin/settings_controller.rb +34 -16
  8. data/app/controllers/refinery/inquiries/inquiries_controller.rb +29 -13
  9. data/app/mailers/refinery/inquiries/inquiry_mailer.rb +20 -10
  10. data/app/models/refinery/inquiries/inquiry.rb +13 -11
  11. data/app/models/refinery/inquiries/setting.rb +33 -31
  12. data/app/views/refinery/inquiries/admin/inquiries/_submenu.html.erb +7 -7
  13. data/app/views/refinery/inquiries/admin/settings/_confirmation_email_form.html.erb +2 -2
  14. data/app/views/refinery/inquiries/inquiries/_form.html.erb +35 -0
  15. data/app/views/refinery/inquiries/inquiries/new.html.erb +4 -38
  16. data/bin/rails +5 -0
  17. data/bin/rake +21 -0
  18. data/bin/rspec +22 -0
  19. data/bin/spring +18 -0
  20. data/config/locales/bg.yml +2 -2
  21. data/config/locales/cs.yml +2 -2
  22. data/config/locales/da.yml +2 -2
  23. data/config/locales/de.yml +2 -2
  24. data/config/locales/en-GB.yml +2 -2
  25. data/config/locales/en.yml +2 -2
  26. data/config/locales/es.yml +2 -2
  27. data/config/locales/fr.yml +2 -2
  28. data/config/locales/it.yml +1 -1
  29. data/config/locales/lt.yml +2 -2
  30. data/config/locales/lv.yml +2 -2
  31. data/config/locales/nb.yml +2 -2
  32. data/config/locales/nl.yml +2 -2
  33. data/config/locales/pl.yml +2 -2
  34. data/config/locales/pt-BR.yml +2 -2
  35. data/config/locales/ru.yml +2 -2
  36. data/config/locales/sk.yml +2 -2
  37. data/config/locales/sl.yml +2 -2
  38. data/config/locales/sv.yml +2 -2
  39. data/config/locales/zh-CN.yml +2 -2
  40. data/config/locales/zh-TW.yml +79 -0
  41. data/config/routes.rb +11 -7
  42. data/db/migrate/20101208082840_create_inquiries.rb +4 -3
  43. data/db/seeds.rb +9 -11
  44. data/lib/generators/refinery/inquiries/templates/config/initializers/refinery/inquiries.rb.erb +8 -0
  45. data/lib/refinery/inquiries/configuration.rb +6 -0
  46. data/lib/refinery/inquiries/engine.rb +3 -7
  47. data/readme.md +23 -10
  48. data/refinerycms-inquiries.gemspec +4 -3
  49. data/spec/factories/inquiry.rb +4 -2
  50. data/spec/features/refinery/inquiries/admin/inquiries_spec.rb +32 -43
  51. data/spec/features/refinery/inquiries/inquiries_spec.rb +37 -32
  52. data/spec/features/refinery/inquiries/mailer_spec.rb +15 -14
  53. data/spec/models/refinery/inquiries/inquiry_spec.rb +62 -20
  54. data/spec/models/refinery/inquiries/setting_spec.rb +19 -0
  55. data/spec/spec_helper.rb +3 -3
  56. metadata +39 -18
@@ -1,8 +1,6 @@
1
1
  <div id='actions'>
2
2
  <ul>
3
- <li>
4
- <%= render "/refinery/admin/search", :url => request.path.gsub("//", "/") %>
5
- </li>
3
+ <li><%= render "/refinery/admin/search", :url => request.path.gsub("//", "/") %></li>
6
4
  <li <%= "class='selected'" if params[:action] == "index" %>>
7
5
  <%= link_to t('.inbox'), refinery.inquiries_admin_inquiries_path, :class => "email_icon" %>
8
6
  </li>
@@ -15,13 +13,15 @@
15
13
  </li>
16
14
  <li>
17
15
  <%= link_to t('.update_notified'),
18
- refinery.edit_inquiries_admin_setting_path(:inquiry_notification_recipients, :dialog => true, :height => 300),
19
- :class => "user_comment_icon" %>
16
+ refinery.edit_inquiries_admin_setting_path(:inquiry_notification_recipients, dialog: true, height: 300),
17
+ class: "user_comment_icon",
18
+ id: "update_notified" %>
20
19
  </li>
21
20
  <li>
22
21
  <%= link_to t('.edit_confirmation_email'),
23
- refinery.edit_inquiries_admin_setting_path(:inquiry_confirmation_body, :dialog => true),
24
- :class => "edit_email_icon" %>
22
+ refinery.edit_inquiries_admin_setting_path(:inquiry_confirmation_body, dialog: true),
23
+ class: "edit_email_icon",
24
+ id: "edit_confirmation_email" %>
25
25
  </li>
26
26
  </ul>
27
27
  </div>
@@ -29,7 +29,7 @@
29
29
  <label class='stripped'><%= t('.subject') %> (<%= locale.to_s %>)</label>
30
30
  </td>
31
31
  <td>
32
- <%= text_field_tag "subject[][#{locale.to_s}]", Refinery::Inquiries::Setting.confirmation_subject(locale),
32
+ <%= text_field_tag "setting[subject[#{locale.to_s}]]", Refinery::Inquiries::Setting.confirmation_subject(locale),
33
33
  :class => 'widest' %>
34
34
  </td>
35
35
  </tr>
@@ -39,7 +39,7 @@
39
39
  :class => 'stripped' %> (<%= locale.to_s %>)
40
40
  </td>
41
41
  <td>
42
- <%= text_area_tag "message[][#{locale.to_s}]", Refinery::Inquiries::Setting.confirmation_message(locale), # required, we can't use :value
42
+ <%= text_area_tag "setting[message[#{locale.to_s}]]", Refinery::Inquiries::Setting.confirmation_message(locale), # required, we can't use :value
43
43
  :rows => "5",
44
44
  :class => 'widest' %>
45
45
  <br/>
@@ -0,0 +1,35 @@
1
+ <%= form_for [refinery, :inquiries, inquiry] do |f| %>
2
+ <%= render :partial => "/refinery/admin/error_messages",
3
+ :locals => {
4
+ :object => inquiry,
5
+ :include_object_name => true
6
+ } %>
7
+ <div class="field">
8
+ <%= f.label :name, :class => 'placeholder-fallback required' %>
9
+ <%= f.text_field :name, :class => 'text', :required => 'required',
10
+ :placeholder => (t('name', :scope => 'activerecord.attributes.refinery/inquiries/inquiry') if Refinery::Inquiries.show_placeholders) %>
11
+ </div>
12
+ <div class="field">
13
+ <%= f.label :email, :class => 'placeholder-fallback required' %>
14
+ <%= f.email_field :email, :class => 'text email', :required => 'required',
15
+ :placeholder => (t('email', :scope => 'activerecord.attributes.refinery/inquiries/inquiry') if Refinery::Inquiries.show_placeholders) %>
16
+ </div>
17
+
18
+ <% if Refinery::Inquiries.show_phone_number_field %>
19
+ <div class="field">
20
+ <%= f.label :phone, :class => 'placeholder-fallback' %>
21
+ <%= f.text_field :phone, :class => 'text phone',
22
+ :placeholder => (t('phone', :scope => 'activerecord.attributes.refinery/inquiries/inquiry') if Refinery::Inquiries.show_placeholders) %>
23
+ </div>
24
+ <% end %>
25
+
26
+ <div class='field message_field'>
27
+ <%= f.label :message, :class => 'placeholder-fallback required' %>
28
+ <%= f.text_area :message, :rows => 8, :required => 'required',
29
+ :placeholder => (t('message', :scope => 'activerecord.attributes.refinery/inquiries/inquiry') if Refinery::Inquiries.show_placeholders) %>
30
+ </div>
31
+ <div class="actions">
32
+ <%= f.submit t('.send') %>
33
+ <%= link_to t('.privacy_policy'), "/pages/privacy-policy", :id => "privacy_link" if Refinery::Inquiries.show_contact_privacy_link %>
34
+ </div>
35
+ <% end %>
@@ -1,42 +1,8 @@
1
1
  <% content_for :body do %>
2
- <%= raw @page.content_for(Refinery::Pages.default_parts.first.to_sym) if Refinery::Pages.default_parts.any? %>
3
-
4
- <div class='inquiries'>
5
- <%= form_for [refinery, :inquiries, @inquiry] do |f| %>
6
- <%= render :partial => "/refinery/admin/error_messages",
7
- :locals => {
8
- :object => @inquiry,
9
- :include_object_name => true
10
- } %>
11
- <div class="field">
12
- <%= f.required_label :name, :class => 'placeholder-fallback' %>
13
- <%= f.text_field :name, :class => 'text', :required => 'required',
14
- :placeholder => t('name', :scope => 'activerecord.attributes.refinery/inquiries/inquiry') if Refinery::Inquiries.show_placeholders %>
15
- </div>
16
- <div class="field">
17
- <%= f.required_label :email, :class => 'placeholder-fallback' %>
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
- </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 %>
2
+ <%= raw @page.content_for(Refinery::Pages.default_parts.first[:slug].to_sym) if Refinery::Pages.default_parts.any? %>
29
3
 
30
- <div class='field message_field'>
31
- <%= f.required_label :message, :class => 'placeholder-fallback' %>
32
- <%= f.text_area :message, :rows => 8, :required => 'required',
33
- :placeholder => t('message', :scope => 'activerecord.attributes.refinery/inquiries/inquiry') if Refinery::Inquiries.show_placeholders %>
34
- </div>
35
- <div class="actions">
36
- <%= f.submit t('.send') %>
37
- <%= link_to t('.privacy_policy'), "/pages/privacy-policy", :id => "privacy_link" if Refinery::Inquiries.show_contact_privacy_link %>
38
- </div>
39
- <% end %>
4
+ <div class='inquiries'>
5
+ <%= render "/refinery/inquiries/inquiries/form", inquiry: @inquiry %>
40
6
  </div>
41
7
  <% end %>
42
- <%= render "/refinery/content_page" %>
8
+ <%= render "/refinery/content_page" %>
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ ENGINE_PATH = File.expand_path('../..', __FILE__)
5
+ load File.expand_path('../../spec/dummy/bin/rails', __FILE__)
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'rake' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+ begin
9
+ if Dir.exist?(File.expand_path('../../spec/dummy', __FILE__))
10
+ load File.expand_path("../spring", __FILE__)
11
+ end
12
+ rescue LoadError
13
+ end
14
+ require 'pathname'
15
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
16
+ Pathname.new(__FILE__).realpath)
17
+
18
+ require 'rubygems'
19
+ require 'bundler/setup'
20
+
21
+ load Gem.bin_path('rake', 'rake')
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'rspec' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ begin
10
+ if Dir.exist?(File.expand_path('../../spec/dummy', __FILE__))
11
+ load File.expand_path("../spring", __FILE__)
12
+ end
13
+ rescue LoadError
14
+ end
15
+ require 'pathname'
16
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
17
+ Pathname.new(__FILE__).realpath)
18
+
19
+ require 'rubygems'
20
+ require 'bundler/setup'
21
+
22
+ load Gem.bin_path('rspec-core', 'rspec')
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # This file loads spring without using Bundler, in order to be fast
4
+ # It gets overwritten when you run the `spring binstub` command
5
+
6
+ unless defined?(Spring)
7
+ require "rubygems"
8
+ require "bundler"
9
+
10
+ if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m)
11
+ ENV["GEM_PATH"] = ([Bundler.bundle_path.to_s] + Gem.path).join(File::PATH_SEPARATOR)
12
+ ENV["GEM_HOME"] = ""
13
+ Gem.paths = ENV
14
+
15
+ gem "spring", match[1]
16
+ require "spring/binstub"
17
+ end
18
+ end
@@ -6,9 +6,9 @@ bg:
6
6
  description: Осигурява форма за контакт и съхранение на запитвания
7
7
  inquiries:
8
8
  config:
9
- from_name: "%{name} [%{site_name}]"
9
+ from_name: "%{name} - %{site_name}"
10
10
  inquiries:
11
- new:
11
+ form:
12
12
  send: Изпращане на съобщение
13
13
  privacy_policy: Високо ценим Вашите лични данни
14
14
  admin:
@@ -6,9 +6,9 @@ cs:
6
6
  description: Zajišťuje kontaktní formulář a uchovává zaslané dotazy.
7
7
  inquiries:
8
8
  config:
9
- from_name: "%{name} [%{site_name}]"
9
+ from_name: "%{name} - %{site_name}"
10
10
  inquiries:
11
- new:
11
+ form:
12
12
  send: Odeslat zprávu
13
13
  privacy_policy: Vážíme si Vaše soukromí
14
14
  admin:
@@ -5,9 +5,9 @@ da:
5
5
  title: Henvendelser
6
6
  inquiries:
7
7
  config:
8
- from_name: "%{name} [%{site_name}]"
8
+ from_name: "%{name} - %{site_name}"
9
9
  inquiries:
10
- new:
10
+ form:
11
11
  header_message: "Der er et mindre problem"
12
12
  message: "Følgende skal rettes:"
13
13
  send: Send besked
@@ -6,9 +6,9 @@ de:
6
6
  description: Stellt ein Kontaktformular zur Verfügung und speichert Kontaktanfragen
7
7
  inquiries:
8
8
  config:
9
- from_name: "%{name} [%{site_name}]"
9
+ from_name: "%{name} - %{site_name}"
10
10
  inquiries:
11
- new:
11
+ form:
12
12
  send: Nachricht senden
13
13
  privacy_policy: Ihre Privatsphäre ist uns wichtig
14
14
  admin:
@@ -6,9 +6,9 @@ en-GB:
6
6
  description: Provides a contact form and stores enquiries
7
7
  inquiries:
8
8
  config:
9
- from_name: "%{name} [%{site_name}]"
9
+ from_name: "%{name} - %{site_name}"
10
10
  inquiries:
11
- new:
11
+ form:
12
12
  send: Send message
13
13
  privacy_policy: We value your privacy
14
14
  admin:
@@ -6,9 +6,9 @@ en:
6
6
  description: Provides a contact form and stores inquiries
7
7
  inquiries:
8
8
  config:
9
- from_name: "%{name} [%{site_name}]"
9
+ from_name: "%{name} - %{site_name}"
10
10
  inquiries:
11
- new:
11
+ form:
12
12
  send: Send message
13
13
  privacy_policy: We value your privacy
14
14
  admin:
@@ -5,9 +5,9 @@ es:
5
5
  title: Consultas
6
6
  inquiries:
7
7
  config:
8
- from_name: "%{name} [%{site_name}]"
8
+ from_name: "%{name} - %{site_name}"
9
9
  inquiries:
10
- new:
10
+ form:
11
11
  send: Enviar mensaje
12
12
  privacy_policy: "Nosotros valoramos tu privacidad"
13
13
  admin:
@@ -6,9 +6,9 @@ fr:
6
6
  description: Fournit un formulaire de contact et gère les demandes de contacts.
7
7
  inquiries:
8
8
  config:
9
- from_name: "%{name} [%{site_name}]"
9
+ from_name: "%{name} - %{site_name}"
10
10
  inquiries:
11
- new:
11
+ form:
12
12
  send: Envoyer un message
13
13
  privacy_policy: Nous respectons votre vie privée
14
14
  admin:
@@ -6,7 +6,7 @@ it:
6
6
  description: Fornisce un modulo di contatto e memorizza le richieste
7
7
  inquiries:
8
8
  config:
9
- from_name: "%{name} [%{site_name}]"
9
+ from_name: "%{name} - %{site_name}"
10
10
  inquiries:
11
11
  new:
12
12
  header_message: si è verificato un problema
@@ -6,9 +6,9 @@ lt:
6
6
  description: Suteikia kontaktų formą ir saugo užklausas
7
7
  inquiries:
8
8
  config:
9
- from_name: "%{name} [%{site_name}]"
9
+ from_name: "%{name} - %{site_name}"
10
10
  inquiries:
11
- new:
11
+ form:
12
12
  send: Siųsti žinutę
13
13
  privacy_policy: Mes vertiname jūsų privatumą
14
14
  admin:
@@ -6,9 +6,9 @@ lv:
6
6
  description: Nodrošina kontaktformu un glabā pieprasījumus
7
7
  inquiries:
8
8
  config:
9
- from_name: "%{name} [%{site_name}]"
9
+ from_name: "%{name} - %{site_name}"
10
10
  inquiries:
11
- new:
11
+ form:
12
12
  send: Sūtīt ziņu
13
13
  privacy_policy: Mēs cienam Jūsu privātumu
14
14
  admin:
@@ -6,9 +6,9 @@ nb:
6
6
  description: Legger til et kontaktskjema og lagrer forespørsler
7
7
  inquiries:
8
8
  config:
9
- from_name: "%{name} [%{site_name}]"
9
+ from_name: "%{name} - %{site_name}"
10
10
  inquiries:
11
- new:
11
+ form:
12
12
  send: Send melding
13
13
  privacy_policy: "Vi respekterer ditt privatliv"
14
14
  admin:
@@ -6,9 +6,9 @@ nl:
6
6
  description: Contactformulier en beheer van vragen
7
7
  inquiries:
8
8
  config:
9
- from_name: "%{name} [%{site_name}]"
9
+ from_name: "%{name} - %{site_name}"
10
10
  inquiries:
11
- new:
11
+ form:
12
12
  send: Verstuur uw vraag
13
13
  privacy_policy: Wij respecteren uw privacy
14
14
  admin:
@@ -7,9 +7,9 @@ pl:
7
7
  article: neutral
8
8
  inquiries:
9
9
  config:
10
- from_name: "%{name} [%{site_name}]"
10
+ from_name: "%{name} - %{site_name}"
11
11
  inquiries:
12
- new:
12
+ form:
13
13
  send: Wyślij wiadomość
14
14
  privacy_policy: Cenimy Twoją prywatność
15
15
  admin:
@@ -6,9 +6,9 @@ pt-BR:
6
6
  description: Gerenciar contatos
7
7
  inquiries:
8
8
  config:
9
- from_name: "%{name} [%{site_name}]"
9
+ from_name: "%{name} - %{site_name}"
10
10
  inquiries:
11
- new:
11
+ form:
12
12
  send: Enviar mensagem
13
13
  privacy_policy: "Nós valorizamos sua privacidade"
14
14
  admin:
@@ -6,9 +6,9 @@ ru:
6
6
  description: Предоставляет форму обратной связи и хранит запросы
7
7
  inquiries:
8
8
  config:
9
- from_name: "%{name} [%{site_name}]"
9
+ from_name: "%{name} - %{site_name}"
10
10
  inquiries:
11
- new:
11
+ form:
12
12
  send: Отправить сообщение
13
13
  privacy_policy: Мы относимся с уважением к вашим личным данным
14
14
  admin:
@@ -6,9 +6,9 @@ sk:
6
6
  description: Zabezpečuje kontaktný formulár a uchováva zaslané otázky.
7
7
  inquiries:
8
8
  config:
9
- from_name: "%{name} [%{site_name}]"
9
+ from_name: "%{name} - %{site_name}"
10
10
  inquiries:
11
- new:
11
+ form:
12
12
  send: Odoslať správu
13
13
  privacy_policy: Vážime si Vaše súkromie
14
14
  admin:
@@ -6,9 +6,9 @@ sl:
6
6
  description: Priskrbi kontaktni obrazec in shrani povpraševanja
7
7
  inquiries:
8
8
  config:
9
- from_name: "%{name} [%{site_name}]"
9
+ from_name: "%{name} - %{site_name}"
10
10
  inquiries:
11
- new:
11
+ form:
12
12
  send: Pošlji sporočilo
13
13
  privacy_policy: "Cenimo vašo zasebnost"
14
14
  admin:
@@ -6,9 +6,9 @@ sv:
6
6
  description: Tillhandahåller ett formulär och sparar förfrågningar
7
7
  inquiries:
8
8
  config:
9
- from_name: "%{name} [%{site_name}]"
9
+ from_name: "%{name} - %{site_name}"
10
10
  inquiries:
11
- new:
11
+ form:
12
12
  send: Skicka meddelande
13
13
  privacy_policy: Vi respekterar ditt privatliv
14
14
  admin: