Class: AlchemyCrm::Admin::ContactsController
- Inherits:
-
BaseController
- Object
- Alchemy::Admin::ResourcesController
- BaseController
- AlchemyCrm::Admin::ContactsController
show all
- Includes:
- CSVMagic::ControllerActions
- Defined in:
- app/controllers/alchemy_crm/admin/contacts_controller.rb
Instance Method Summary
collapse
#alchemy_crm_t, #i18n_t, included, #translate_model_attribute
Instance Method Details
#autocomplete_tag_list ⇒ Object
55
56
57
58
|
# File 'app/controllers/alchemy_crm/admin/contacts_controller.rb', line 55
def autocomplete_tag_list
items = ActsAsTaggableOn::Tag.where(['LOWER(name) LIKE ?', "#{params[:term].downcase}%"])
render :json => json_for_autocomplete(items, :name)
end
|
#export ⇒ Object
49
50
51
52
53
|
# File 'app/controllers/alchemy_crm/admin/contacts_controller.rb', line 49
def export
@contact = Contact.find(params[:id])
@contact.to_vcard
send_file("#{Rails.root.to_s}/tmp/#{@contact.fullname}.vcf")
end
|
#import ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'app/controllers/alchemy_crm/admin/contacts_controller.rb', line 33
def import
if request.post?
if params[:verified] == "1"
if params[:fields] || (params[:file] && !is_vcard_file?(params[:file]))
handle_csv_post_request
else
handle_vcf_post_request
end
else
@error = build_error_message(alchemy_crm_t(:imported_contacts_not_verified))
end
else
render :layout => !request.xhr?
end
end
|
#new ⇒ Object
28
29
30
31
|
# File 'app/controllers/alchemy_crm/admin/contacts_controller.rb', line 28
def new
@contact = Contact.new(:country => ::I18n.locale.to_s.upcase)
render :layout => false
end
|