refinerycms-inquiries 0.9.8 → 0.9.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/admin/inquiry_settings_controller.rb +17 -2
- data/app/views/admin/inquiries/_submenu.html.erb +2 -2
- data/app/views/admin/inquiry_settings/_confirmation_email_form.html.erb +2 -2
- data/app/views/admin/inquiry_settings/_notification_recipients_form.html.erb +1 -1
- data/app/views/admin/inquiry_settings/edit.html.erb +1 -1
- data/lib/inquiries.rb +5 -2
- metadata +3 -2
@@ -1,12 +1,19 @@
|
|
1
1
|
class Admin::InquirySettingsController < Admin::BaseController
|
2
2
|
|
3
|
-
crudify :
|
3
|
+
crudify :refinery_setting, :title_attribute => "name", :order => 'name ASC', :redirect_to_url => "admin_inquiries_url"
|
4
4
|
|
5
5
|
before_filter :redirect_back_to_inquiries?, :only => [:index]
|
6
6
|
before_filter :set_url_override?, :only => [:edit]
|
7
7
|
after_filter :save_subject_for_confirmation?, :only => [:create, :update]
|
8
|
+
around_filter :rewrite_flash?, :only => [:create, :update]
|
8
9
|
|
9
10
|
protected
|
11
|
+
def rewrite_flash?
|
12
|
+
yield
|
13
|
+
|
14
|
+
flash[:notice] = flash[:notice].to_s.gsub(/(\'.*\')/) {|m| m.titleize}.gsub('Inquiry ', '')
|
15
|
+
end
|
16
|
+
|
10
17
|
def save_subject_for_confirmation?
|
11
18
|
InquirySetting.confirmation_subject = params[:subject] if params.keys.include?('subject')
|
12
19
|
end
|
@@ -16,7 +23,15 @@ protected
|
|
16
23
|
end
|
17
24
|
|
18
25
|
def set_url_override?
|
19
|
-
@url_override = admin_inquiry_setting_url(@
|
26
|
+
@url_override = admin_inquiry_setting_url(@refinery_setting.name.to_sym, :dialog => from_dialog?)
|
27
|
+
end
|
28
|
+
|
29
|
+
def find_refinery_setting
|
30
|
+
# prime the setting first, if it's valid.
|
31
|
+
if InquirySetting.methods.include?(params[:id].to_s.gsub('inquiry_', ''))
|
32
|
+
InquirySetting.send(params[:id].to_s.gsub('inquiry_', '').to_sym)
|
33
|
+
end
|
34
|
+
@refinery_setting = RefinerySetting.find_by_name(params[:id])
|
20
35
|
end
|
21
36
|
|
22
37
|
end
|
@@ -15,12 +15,12 @@
|
|
15
15
|
</li>
|
16
16
|
<li>
|
17
17
|
<%= link_to t('.update_notified'),
|
18
|
-
edit_admin_inquiry_setting_url(
|
18
|
+
edit_admin_inquiry_setting_url(:inquiry_notification_recipients, :dialog => true, :height => 300),
|
19
19
|
:class => "user_comment_icon" %>
|
20
20
|
</li>
|
21
21
|
<li>
|
22
22
|
<%= link_to t('.edit_confirmation_email'),
|
23
|
-
edit_admin_inquiry_setting_url(
|
23
|
+
edit_admin_inquiry_setting_url(:inquiry_confirmation_body, :dialog => true),
|
24
24
|
:class => "edit_email_icon" %>
|
25
25
|
</li>
|
26
26
|
</ul>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= form_for([:admin, @
|
1
|
+
<%= form_for([:admin, @refinery_setting], :url => (@url_override || @url)) do |f| %>
|
2
2
|
|
3
3
|
<p>
|
4
4
|
<%= t('.explanation') %>
|
@@ -28,7 +28,7 @@
|
|
28
28
|
<label class='stripped'><%= t('.subject') %></label>
|
29
29
|
</td>
|
30
30
|
<td>
|
31
|
-
<%= text_field_tag 'subject', InquirySetting.confirmation_subject
|
31
|
+
<%= text_field_tag 'subject', InquirySetting.confirmation_subject,
|
32
32
|
:class => 'widest' %>
|
33
33
|
</td>
|
34
34
|
</tr>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<% if @
|
1
|
+
<% if @refinery_setting.name.to_s.titleize == "Inquiry Notification Recipients" %>
|
2
2
|
<%= render :partial => "notification_recipients_form", :locals => {:edit => true} -%>
|
3
3
|
<% else %>
|
4
4
|
<%= render :partial => "confirmation_email_form", :locals => {:edit => true} -%>
|
data/lib/inquiries.rb
CHANGED
@@ -1,11 +1,14 @@
|
|
1
1
|
require 'refinery'
|
2
|
+
require 'filters_spam'
|
2
3
|
|
3
4
|
module Refinery
|
4
5
|
module Inquiries
|
5
6
|
class Engine < Rails::Engine
|
6
|
-
config.
|
7
|
+
config.to_prepare do
|
7
8
|
require 'filters_spam'
|
8
|
-
|
9
|
+
end
|
10
|
+
|
11
|
+
config.after_initialize do
|
9
12
|
Refinery::Plugin.register do |plugin|
|
10
13
|
plugin.title = "Inquiries"
|
11
14
|
plugin.name = "refinery_inquiries"
|
metadata
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: refinerycms-inquiries
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 37
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
9
|
- 8
|
10
|
-
|
10
|
+
- 1
|
11
|
+
version: 0.9.8.1
|
11
12
|
platform: ruby
|
12
13
|
authors:
|
13
14
|
- Resolve Digital
|