refinerycms-inquiries 0.9.9.2 → 0.9.9.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,10 +5,9 @@ class Admin::InquirySettingsController < Admin::BaseController
5
5
  :order => 'name ASC',
6
6
  :redirect_to_url => "admin_inquiries_url"
7
7
 
8
- before_filter :redirect_back_to_inquiries?, :only => [:index]
9
8
  before_filter :set_url_override?, :only => [:edit, :update]
10
- after_filter :save_subject_for_confirmation?, :only => [:create, :update]
11
- around_filter :rewrite_flash?, :only => [:create, :update]
9
+ after_filter :save_subject_for_confirmation?, :only => :update
10
+ around_filter :rewrite_flash?, :only => :update
12
11
 
13
12
  protected
14
13
  def rewrite_flash?
@@ -21,10 +20,6 @@ protected
21
20
  InquirySetting.confirmation_subject = params[:subject] if params.keys.include?('subject')
22
21
  end
23
22
 
24
- def redirect_back_to_inquiries?
25
- redirect_to admin_inquiries_url
26
- end
27
-
28
23
  def set_url_override?
29
24
  @url_override = admin_inquiry_setting_url(@refinery_setting, :dialog => from_dialog?)
30
25
  end
@@ -2,10 +2,6 @@ class InquiriesController < ApplicationController
2
2
 
3
3
  before_filter :find_page, :only => [:create, :new]
4
4
 
5
- def index
6
- redirect_to :action => "new"
7
- end
8
-
9
5
  def thank_you
10
6
  @page = Page.find_by_link_url("/contact/thank_you", :include => [:parts, :slugs])
11
7
  end
@@ -15,11 +15,7 @@ class Inquiry < ActiveRecord::Base
15
15
  default_scope :order => 'created_at DESC' # previously scope :newest
16
16
 
17
17
  def self.latest(number = 7, include_spam = false)
18
- unless include_spam
19
- ham.limit(number)
20
- else
21
- limit(number)
22
- end
18
+ include_spam ? limit(number) : ham.limit(number)
23
19
  end
24
20
 
25
21
  end
@@ -22,7 +22,7 @@ class InquirySetting < ActiveRecord::Base
22
22
 
23
23
  def self.notification_recipients
24
24
  RefinerySetting.find_or_set(:inquiry_notification_recipients,
25
- (defined?(Role) ? Role[:refinery].users.first.email : '' rescue ''))
25
+ ((Role[:refinery].users.first.email rescue nil) if defined?(Role)).to_s)
26
26
  end
27
27
 
28
28
  def self.notification_subject
@@ -5,10 +5,10 @@
5
5
  </span>
6
6
  <span class='actions'>
7
7
  <%= link_to refinery_icon_tag('delete.png'), admin_inquiry_url(inquiry),
8
+ { :method => :delete,
9
+ :confirm => t('shared.admin.delete.message', :title => inquiry.name) },
8
10
  :class => "cancel confirm-delete",
9
- :title => t('admin.inquiries.delete'),
10
- :'data-confirm' => t('shared.admin.delete.message', :title => inquiry.name),
11
- :'data-method' => "delete" -%>
11
+ :title => t('admin.inquiries.delete') -%>
12
12
 
13
13
  <%= link_to refinery_icon_tag('zoom.png'), admin_inquiry_url(inquiry),
14
14
  :title => t('.read_inquiry') -%>
@@ -65,9 +65,7 @@
65
65
  <strong><%= t('.message') %></strong>
66
66
  </td>
67
67
  <td>
68
- <p style='margin-top: 0px'>
69
- <%= @inquiry.message.gsub("\r\n\r\n", "\r\n").gsub("\r\n", "</p><p>") %>
70
- </p>
68
+ <%= simple_format @inquiry.message, :style => 'margin-top: 0' %>
71
69
  </td>
72
70
  </tr>
73
71
  </table>
@@ -12,7 +12,7 @@
12
12
  <% else %>
13
13
  <% if @grouped_inquiries.any? -%>
14
14
  <% @grouped_inquiries.each do |container| %>
15
- <h3><%= l((inquiry_group = container.last).first.created_at) %></h3>
15
+ <h3><%= l((inquiry_group = container.last).first.created_at, :format => :short) %></h3>
16
16
  <ul>
17
17
  <%= render :partial => 'inquiry', :collection => inquiry_group %>
18
18
  </ul>
@@ -41,7 +41,6 @@ en:
41
41
  inquiry_settings:
42
42
  notification_recipients_form:
43
43
  inquiry_settings_value_name: Send notifications to
44
- explanation: Every time someone contacts you on your website, Refinery sends out an email to say there is a new inquiry.
45
44
  hint: When a new inquiry is submitted, Refinery will send an email notification to you.
46
45
  example: "Enter your email address(es) like: jack@work.com, jill@office.com"
47
46
  confirmation_email_form:
@@ -1,67 +1,80 @@
1
1
  it:
2
2
  plugins:
3
3
  refinery_inquiries:
4
- title: Richieste di informazioni
5
- activerecord:
6
- models:
7
- inquiry: Inchiesta
8
- attributes:
9
- inquiry:
10
- to: A
11
- from: Da
12
- click_to_email: Clicca per questo indirizzo e-mail
13
- phone: Telefono
14
- date: Data
15
- message: Messaggio
4
+ title: Richiesta di informazioni
5
+ description: Fornisce un modulo di contatto e memorizza le richieste
16
6
  inquiries:
17
7
  new:
18
- header_message: "Un problema si è verificato"
8
+ header_message: "si è verificato un problema"
19
9
  message: "I seguenti problemi devono essere corretti:"
20
10
  send: Invia messaggio
21
11
  privacy_policy: "Noi diamo valore alla tua privacy"
22
12
  admin:
23
13
  inquiries:
24
14
  inquiry:
25
- move_inquiry_to_closed: Spostare questa inchiesta chiusa
26
- move_inquiry_to_open: Spostare questa indagine per aprire
27
- read_inquiry: Leggi l'inchiesta
15
+ move_inquiry_to_closed: Spostare questa richiesta in stato chiuso
16
+ move_inquiry_to_open: Spostare questa richiesta in stato aperto
17
+ read_inquiry: Leggi la domanda
28
18
  remove_inquiry: "Sei sicuro di voler cancellare la richiesta di '%{name}'?"
29
- title: Rimuovere questa indagine per sempre.
19
+ title: Rimuovere per sempre questa richiesta.
30
20
  toggle_status:
31
- closed: "Inchiesta '%{inquiry}' è chiuso"
32
- reopened: "Inchiesta '%{inquiry}' si riapre"
21
+ closed: "La richiesta '%{inquiry}' è chiusa"
22
+ reopened: "La richiesta '%{inquiry}' si riapre"
33
23
  index:
34
- no_inquiries: Non hai ancora ricevuto alcuna richiesta in.
24
+ no_inquiries: Non hai ancora ricevuto alcuna richiesta.
35
25
  show:
36
26
  details: Dettagli
37
- click_to_email: Clicca per e-mail
27
+ click_to_email: Clicca per inviare una e-mail a questo indirizzo
38
28
  status: Stato
39
29
  open: Aperto
40
30
  closed: Chiuso
41
31
  age: Età
42
32
  actions: Azioni
43
33
  back_to_all_inquiries: Torna a tutte le richieste
44
- inquiry: Inchiesta
34
+ inquiry: Richiesta
45
35
  submenu:
46
- update_notified: Aggiornamento chi viene notificata
36
+ update_notified: Aggiornare destinatario notifica
47
37
  edit_confirmation_email: Modifica email di conferma
48
38
  inquiry_settings:
49
39
  update:
50
- updated: "'%{setting}' stato aggiornato con successo."
40
+ updated: "'%{setting}' è stato aggiornato con successo."
51
41
  notification_recipients_form:
52
42
  inquiry_settings_value_name: Invia a notifiche
53
- explanation: "Ogni volta che qualcuno ti contatti sul suo sito web, Refinery invia una mail a dire che c'è una nuova indagine."
54
- hint: "Inserisci un indirizzo email di cui sopra. Vuoi la notifica di andare a più di una persona? Inserisci più indirizzi email separati da virgole."
43
+ explanation: "Ogni volta che qualcuno ti contatta sul tuo sito web, Refinery invia una mail per avvisare che è presente una nuova richiesta."
44
+ hint: "Inserisci un indirizzo email per l'invio della notifica. Vuoi inviare la notifica a più di una persona? Inserisci più indirizzi email separati da virgole."
55
45
  example: "E.g. me@domain.com, friend@msn.com, workmate@work.com"
56
46
  confirmation_email_form:
57
47
  to: A
58
48
  from: Da
59
- subject: Soggetto
49
+ subject: Oggetto
60
50
  click_to_edit_subject: Clicca qui per modificare l'oggetto
61
- explanation: "Ogni volta che qualcuno ti contatti sul suo sito web, Refinery invia una e-mail per confermare la richiesta con la persona che ha reso."
51
+ explanation: "Ogni volta che qualcuno ti contatti sul tuo sito web, Refinery invia una e-mail alla persona che ti contattato per confermare la richiesta."
62
52
  below_edit_email_sent: Qui di seguito è possibile modificare l'e-mail che viene inviata.
63
- the_customer_making_inquiry: Il cliente rendendo l'indagine
53
+ the_customer_making_inquiry: Chi effettua la richiesta
64
54
  message: Messaggio
65
- note: "Nota: inserire il testo %name% dove desideri che il nome del cliente a comparire nella e-mail"
55
+ note: "Nota: inserire nella email il testo %name% dove si vuole che compiaia il nome di chi invia la richiesta"
66
56
  subject_form:
67
- subject_value_name: Soggetto
57
+ subject_value_name: Oggetto
58
+ inquiry_mailer:
59
+ notification:
60
+ greeting: Ciao a tutti
61
+ you_recieved_new_inquiry: Hai appena ricevuto una nuova richiesta sul tuo sito.
62
+ inquiry_starts: --- inizio della richiesta ---
63
+ inquiry_ends: --- fine della richiesta ---
64
+ from: Da
65
+ email: Email
66
+ phone: Telefono
67
+ message: Messaggio
68
+ closing_line: Saluti
69
+ ps: P.S. Tutte le richiesta ricevute sono salvate nella sezione "Richieste" di Refinery così da poter esser viste in un secondo momento.
70
+ activerecord:
71
+ models:
72
+ inquiry: Domanda
73
+ attributes:
74
+ inquiry:
75
+ to: A
76
+ from: Da
77
+ click_to_email: Clicca per inviare una e-mail a questo indirizzo
78
+ phone: Telefono
79
+ date: Data
80
+ message: Messaggio
@@ -2,6 +2,7 @@ lv:
2
2
  plugins:
3
3
  refinery_inquiries:
4
4
  title: Pieprasījumi
5
+ description: Nodrošina kontaktformu un glabā pieprasījumus
5
6
  inquiries:
6
7
  new:
7
8
  send: Sūtīt ziņu
@@ -1,79 +1,76 @@
1
1
  ru:
2
2
  plugins:
3
3
  refinery_inquiries:
4
- title: "Запросы"
5
- activerecord:
6
- models:
7
- inquiry: "Запрос"
8
- inquiry_setting: "Настройки запроса"
9
- attributes:
10
- inquiry:
11
- to: "Кому"
12
- from: "От"
13
- click_to_email: "Нажмите, чтобы отправить по этому адресу"
14
- phone: "Телефон"
15
- date: "Дата"
16
- message: "Сообщение"
4
+ title: Запросы
5
+ description: Предоставляет форму обратной связи и хранит запросы
17
6
  inquiries:
18
7
  new:
19
- header_message: "Упс. Возникла небольшая проблемка."
20
- message: "Нужно исправить следующие ошибки:"
21
- send: "Отправить сообщение"
22
- privacy_policy: "Мы относимся с уважением к вашим личным данным"
8
+ send: Отправить сообщение
9
+ privacy_policy: Мы относимся с уважением к вашим личным данным
23
10
  admin:
24
11
  inquiries:
12
+ delete: Удалить этот запрос навсегда
25
13
  inquiry:
26
- move_inquiry_to_closed: "Переместить этот запрос в закрытые"
27
- move_inquiry_to_open: "Переместить этот запрос в открытые"
28
- read_inquiry: "Прочитать запрос"
29
- remove_inquiry: "Вы уверены, что хотите удалить запрос от '{{name}}'?"
30
- title: "Удалить этот запрос навсегда"
31
- said: "пишет"
32
- mark_as_spam: "Пометить как спам"
33
- mark_as_ham: "Переместить во Входящие"
34
- toggle_status:
35
- closed: "Запрос '{{inquiry}}' закрыт"
36
- reopened: "Запрос '{{inquiry}}' открыт заново"
14
+ read_inquiry: Прочитать запрос
15
+ said: пишет
16
+ mark_as_spam: Пометить как спам
17
+ mark_as_ham: Переместить во входящие
37
18
  submenu:
38
- inbox: "Входящие"
39
- spam: "Спам"
19
+ inbox: Входящие
20
+ spam: Спам
40
21
  update_notified: Изменить получателей уведомлений
41
- edit_confirmation_email: "Редактировать письмо-подтверждение"
22
+ edit_confirmation_email: Редактировать письмо-подтверждение
42
23
  index:
43
- search_results_for: "Найти результаты для {{query}}"
44
24
  no_inquiries: "Вы еще не получили ни одного запроса."
45
25
  spam:
46
- no_spam: "Ура! Вы не получили спам."
26
+ no_spam: "Ура, спама нет!"
47
27
  show:
48
- details: "Подробности"
49
- click_to_email: "Нажмите, чтобы отправить"
50
- status: "Статус"
51
- open: "Открыт"
52
- closed: "Закрыт"
53
- age: "Срок"
54
- actions: "Действия"
55
- back_to_all_inquiries: "Назад ко всем запросам"
56
- spam: "Спам"
57
- spam_yes: 'да'
58
- inquiry: "Запрос"
59
- title: "Удалить этот запрос навсегда"
28
+ details: Подробности
29
+ age: Срок
30
+ actions: Действия
31
+ back_to_all_inquiries: Назад ко всем запросам
32
+ spam: Спам
33
+ spam_yes: да
34
+ inquiry: Запрос
35
+ to: Кому
36
+ from: От
37
+ click_to_email: Нажмите, чтобы отправить письмо
38
+ phone: Телефон
39
+ date: Дата
40
+ message: Сообщение
60
41
  inquiry_settings:
61
- update:
62
- updated: "'{{setting}}' были успешно обновлены."
63
42
  notification_recipients_form:
64
- inquiry_settings_value_name: "Отправить уведомления"
65
- explanation: "Каждый раз, когда кто-то связывается с вами посредством вашего сайта, Refinery CMS отправляет уведомление на электронную почту."
43
+ inquiry_settings_value_name: Отправлять уведомления
66
44
  hint: "Когда поступит новый запрос, Refinery CMS отправит вам уведомление на электронную почту."
67
- example: "Введите адрес(а) электронной почты через запятую: anna@mail.ru, ivanov@yandex.ru"
45
+ example: "Введите один или несколько адресов электронной почты через запятую: anna@mail.ru, ivanov@yandex.ru"
68
46
  confirmation_email_form:
69
- to: "Кому"
70
- from: "От"
71
- subject: "Тема сообщения"
72
- click_to_edit_subject: "Редактировать тему сообщения"
47
+ to: Кому
48
+ from: От
49
+ subject: Тема сообщения
50
+ click_to_edit_subject: Редактировать тему сообщения
73
51
  explanation: "Каждый раз, когда кто-то связывается с вами посредством вашего сайта, Refinery CMS отправляет ему письмо, подтверждающее принятие запроса."
74
52
  below_edit_email_sent: Ниже вы можете отредактировать отсылаемое письмо
75
53
  the_customer_making_inquiry: "Клиент, делающий запрос"
76
- message: "Сообщение"
77
- note: "Примечание: поместите текст %name% там, где вы хотите, чтобы появилось имя клиента."
78
- subject_form:
79
- subject_value_name: "Тема сообщения"
54
+ message: Сообщение
55
+ note: "Примечание. Поместите текст %name% там, где вы хотите, чтобы появилось имя клиента."
56
+ inquiry_mailer:
57
+ notification:
58
+ greeting: Здравствуйте
59
+ you_recieved_new_inquiry: Вы только что получили новый запрос со своего сайта
60
+ inquiry_starts: --- начало запроса ---
61
+ inquiry_ends: --- конец запроса ---
62
+ from: От
63
+ email: Эл. почта
64
+ phone: Телефон
65
+ message: Сообщение
66
+ closing_line: С наилучшими пожеланиями
67
+ ps: Все запросы вы можете увидеть в соответствующем разделе Refinery.
68
+ activerecord:
69
+ models:
70
+ inquiry: Запрос
71
+ attributes:
72
+ inquiry:
73
+ name: Имя
74
+ email: Эл. почта
75
+ phone: Телефон
76
+ message: Сообщение
data/config/routes.rb CHANGED
@@ -1,13 +1,16 @@
1
1
  Refinery::Application.routes.draw do
2
2
  get '/contact', :to => 'inquiries#new', :as => 'new_inquiry'
3
- resources :contact, :as => :inquiries, :controller => 'inquiries' do
3
+ resources :contact,
4
+ :only => :create,
5
+ :as => :inquiries,
6
+ :controller => 'inquiries' do
4
7
  collection do
5
8
  get :thank_you
6
9
  end
7
10
  end
8
11
 
9
12
  scope(:path => 'refinery', :as => 'admin', :module => 'admin') do
10
- resources :inquiries do
13
+ resources :inquiries, :only => [:index, :show, :destroy] do
11
14
  collection do
12
15
  get :spam
13
16
  end
@@ -15,6 +18,6 @@ Refinery::Application.routes.draw do
15
18
  get :toggle_spam
16
19
  end
17
20
  end
18
- resources :inquiry_settings
21
+ resources :inquiry_settings, :only => [:edit, :update]
19
22
  end
20
23
  end
@@ -0,0 +1,7 @@
1
+ require 'factory_girl'
2
+
3
+ Factory.define :inquiry do |i|
4
+ i.name "Refinery"
5
+ i.email "refinery@cms.com"
6
+ i.message "Hello..."
7
+ end
data/lib/gemspec.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- version = '0.9.9.2'
2
+ version = '0.9.9.3'
3
3
  raise "Could not get version so gemspec can not be built" if version.nil?
4
4
  files = Dir.glob("**/*").flatten.reject do |file|
5
5
  file =~ /\.gem$/
data/readme.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  Include the latest [gem](http://rubygems.org/gems/refinerycms-inquiries) into your Refinery CMS application's Gemfile:
8
8
 
9
- gem "refinerycms-inquiries", '~> 0.9.9.2'
9
+ gem "refinerycms-inquiries", '~> 0.9.9.3'
10
10
 
11
11
  Then type the following at command line inside your Refinery CMS application's root directory:
12
12
 
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{refinerycms-inquiries}
3
- s.version = %q{0.9.9.2}
4
- s.date = %q{2010-10-13}
3
+ s.version = %q{0.9.9.3}
4
+ s.date = %q{2010-11-01}
5
5
  s.summary = %q{Inquiry handling functionality for the Refinery CMS project.}
6
6
  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.}
7
7
  s.homepage = %q{http://refinerycms.com}
@@ -64,6 +64,7 @@ Gem::Specification.new do |s|
64
64
  'features/step_definitions',
65
65
  'features/step_definitions/inquiry_steps.rb',
66
66
  'features/support',
67
+ 'features/support/factories.rb',
67
68
  'features/support/paths.rb',
68
69
  'lib',
69
70
  'lib/gemspec.rb',
@@ -71,7 +72,10 @@ Gem::Specification.new do |s|
71
72
  'lib/refinerycms-inquiries.rb',
72
73
  'license.md',
73
74
  'readme.md',
74
- 'refinerycms-inquiries.gemspec'
75
+ 'refinerycms-inquiries.gemspec',
76
+ 'spec',
77
+ 'spec/models',
78
+ 'spec/models/inquiry_spec.rb'
75
79
  ]
76
80
  s.require_path = 'lib'
77
81
 
@@ -0,0 +1,59 @@
1
+ require 'spec_helper'
2
+
3
+ Dir[File.expand_path('../../../features/support/factories.rb', __FILE__)].each {|f| require f}
4
+
5
+ describe Inquiry do
6
+ describe "validations" do
7
+ before(:each) do
8
+ @attr = {
9
+ :name => "rspec",
10
+ :email => "rspec@refinery.com",
11
+ :message => "test"
12
+ }
13
+ end
14
+
15
+ it "rejects empty name" do
16
+ Inquiry.new(@attr.merge(:name => "")).should_not be_valid
17
+ end
18
+
19
+ it "rejects empty message" do
20
+ Inquiry.new(@attr.merge(:message => "")).should_not be_valid
21
+ end
22
+
23
+ it "rejects invalid email format" do
24
+ ["", "@refinerycms.com", "refinery@cms", "refinery@cms.123"].each do |email|
25
+ Inquiry.new(@attr.merge(:email => email)).should_not be_valid
26
+ end
27
+ end
28
+ end
29
+
30
+ describe "default scope" do
31
+ it "orders by created_at in desc" do
32
+ inquiry1 = Factory(:inquiry, :created_at => 1.hour.ago)
33
+ inquiry2 = Factory(:inquiry, :created_at => 2.hours.ago)
34
+ inquiries = Inquiry.all
35
+ inquiries.first.should == inquiry1
36
+ inquiries.second.should == inquiry2
37
+ end
38
+ end
39
+
40
+ describe ".latest" do
41
+ it "returns latest 7 non-spam inquiries by default" do
42
+ 8.times { Factory(:inquiry) }
43
+ Inquiry.last.toggle!(:spam)
44
+ Inquiry.latest.count.should == 7
45
+ end
46
+
47
+ it "returns latest 7 inquiries including spam ones" do
48
+ 4.times { Factory(:inquiry) }
49
+ 3.times { Factory(:inquiry) }
50
+ Inquiry.all[0..2].each { |inquiry| inquiry.toggle!(:spam) }
51
+ Inquiry.latest(7, true).count.should == 7
52
+ end
53
+
54
+ it "returns latest n inquiries" do
55
+ 4.times { Factory(:inquiry) }
56
+ Inquiry.latest(3).count.should == 3
57
+ end
58
+ end
59
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: refinerycms-inquiries
3
3
  version: !ruby/object:Gem::Version
4
- hash: 39
4
+ hash: 37
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
9
  - 9
10
- - 2
11
- version: 0.9.9.2
10
+ - 3
11
+ version: 0.9.9.3
12
12
  platform: ruby
13
13
  authors:
14
14
  - Resolve Digital
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-10-13 00:00:00 +13:00
19
+ date: 2010-11-01 00:00:00 +13:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -80,6 +80,7 @@ files:
80
80
  - features/create_inquiries.feature
81
81
  - features/manage_inquiries.feature
82
82
  - features/step_definitions/inquiry_steps.rb
83
+ - features/support/factories.rb
83
84
  - features/support/paths.rb
84
85
  - lib/gemspec.rb
85
86
  - lib/inquiries.rb
@@ -87,6 +88,7 @@ files:
87
88
  - license.md
88
89
  - readme.md
89
90
  - refinerycms-inquiries.gemspec
91
+ - spec/models/inquiry_spec.rb
90
92
  has_rdoc: true
91
93
  homepage: http://refinerycms.com
92
94
  licenses: []