Skip to content

Commit

Permalink
experimental opportunity and filters feature, use v1.0 tag for stable…
Browse files Browse the repository at this point in the history
… ffc code
  • Loading branch information
jose.gordo committed May 3, 2010
1 parent 9a26733 commit bbf1f48
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion app/models/mailing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ class Mailing < ActiveRecord::Base
belongs_to :user
has_attached_file :attc, :url => "/mailings/:id/attachment", :path => ":rails_root/files/supervised_mailings/attachments/:id/:filename"

simple_column_search :name, :match => :middle, :escape => lambda { |query| query.gsub(/[^\w\s\-\.']/, "").strip }
acts_as_criteria :i18n => lambda { |text| I18n.t(text) },
:mantain_current_query => lambda { |query, controller_name, session| session["#{controller_name}_current_query".to_sym] = query },
:restrict => { :method => "my", :options => lambda { |current_user| { :user => current_user, :order => current_user.pref[:accounts_sort_by] || Account.sort_by } } },
:paginate => { :method => "paginate", :options => lambda { |current_user| { :page => 1, :per_page => current_user.pref[:accounts_per_page]} } },
:simple => { :columns => [:name], :match => :contains, :escape => lambda { |query| query.gsub(/[^\w\s\-\.']/, "").strip } }
uses_user_permissions
acts_as_paranoid
#sortable :by => [ "name ASC", "created_at DESC", "updated_at DESC" ], :default => "status DESC, mailings.created_at DESC"
Expand Down
1 change: 1 addition & 0 deletions lib/crm_supervised_mailings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
Account.send(:include, AccountMailingMailAssociations)
Contact.send(:include, ContactMailingMailAssociations)
Lead.send(:include, LeadMailingMailAssociations)
Opportunity.send(:include, OpportunityMailingMailAssociations)

# Make issues observable.
ActivityObserver.instance.send :add_observer!, Mailing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class CrmSupervisedMailingsViewHooks < FatFreeCRM::Callback::Base
EOS

#----------------------------------------------------------------------------
[ :account, :contact, :lead ].each do |model|
[ :account, :contact, :lead, :opportunity ].each do |model|

define_method :"index_#{model}_sidebar_bottom" do |view, context|
Haml::Engine.new(ACTIONS_FOR_SHOW).render(view, :model => context[model])
Expand Down

0 comments on commit bbf1f48

Please sign in to comment.