refinerycms-inquiries 0.9.8 → 0.9.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,19 @@
1
1
  class Admin::InquirySettingsController < Admin::BaseController
2
2
 
3
- crudify :inquiry_setting, :title_attribute => "name", :order => 'name ASC', :redirect_to_url => "admin_inquiries_url"
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(@inquiry_setting, :dialog => from_dialog?)
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(InquirySetting.notification_recipients, :dialog => true, :height => 300),
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(InquirySetting.confirmation_body, :dialog => true),
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, @inquiry_setting], :url => (@url_override || @url)) do |f| %>
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.value,
31
+ <%= text_field_tag 'subject', InquirySetting.confirmation_subject,
32
32
  :class => 'widest' %>
33
33
  </td>
34
34
  </tr>
@@ -1,4 +1,4 @@
1
- <%= form_for([:admin, @inquiry_setting], :url => (@url_override || @url)) do |f| %>
1
+ <%= form_for([:admin, @refinery_setting], :url => (@url_override || @url)) do |f| %>
2
2
 
3
3
  <div class='field'>
4
4
  <span class='label_with_help'>
@@ -1,4 +1,4 @@
1
- <% if @inquiry_setting.name == "Notification Recipients" %>
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.after_initialize do
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: 43
4
+ hash: 37
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
9
  - 8
10
- version: 0.9.8
10
+ - 1
11
+ version: 0.9.8.1
11
12
  platform: ruby
12
13
  authors:
13
14
  - Resolve Digital