module TicketsHelper def smart_links_parser(html,site) html = html.gsub("href=\"/uploads/","href=\"http://#{site.site_domain}/uploads/") html = html.gsub("src=\"/uploads/","src=\"http://#{site.site_domain}/uploads/") return html end def smart_store_link_parser(html) html = html.gsub("href=\"/uploads/","href=\"http://#{request.host_with_port}/uploads/") html = html.gsub("src=\"/uploads/","src=\"http://#{request.host_with_port}/uploads/") return html end def send_notification_emails(response, ticket) response.user_tags.each do |u| user = User.find(u) rescue nil if !user.nil? mp = user.member_profile send_email(mp.email,ticket,response,user.name) if !mp.email.nil? sleep(2.seconds) end end end def send_email(useremail,ticket,response, username) url = "#{request.protocol}#{request.host_with_port}/#{I18n.locale}/admin/tickets/#{ticket.id.to_s}#response_#{response.id.to_s}" email = Email.new(:mail_to => useremail, :mail_subject => "Tagged : #{ticket.subject}.", :template => "email/ticket_tag_email.html.erb", :template_data => {"url" => url, "mention" => current_user.name, "name" => username}) email.deliver end end