caboose-rets 0.1.148 → 0.1.149
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68a28819b9860946a63a6c66d818e3de06ce3032a7efef61252d3ba3cfdd3664
|
4
|
+
data.tar.gz: 7df5bd377b4dafcd123e479557d8f4ac204400695e383911edb7a942717fa385
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b7b4482a7db84b631efacb67eaeb80589ba9277aedbadce9f0428c25cb9d591b6c429f994d9cc74e1c5b59f7c73086ad3bccbeccf9ff92e6b0ff73daf550837
|
7
|
+
data.tar.gz: 4aa99262bf40a0150976eba72c76a838899c32f5f21e4eed13db6e9959eb56882c40fe038296629297b9c5bf90f80811e27c0ef1e671d23de794d0d9affc7eac
|
@@ -1,4 +1,12 @@
|
|
1
1
|
function rets_save_property(mls_number) {
|
2
|
+
$.each( $("a[data-mls='" + mls_number + "']"), function(k,v) {
|
3
|
+
var oldoc = $(v).attr("onclick");
|
4
|
+
var newoc = $(v).attr("onclick2");
|
5
|
+
$(v).attr("onclick",newoc).attr("onclick2",oldoc);
|
6
|
+
$(v).mouseleave(function() {
|
7
|
+
$(v).addClass("active");
|
8
|
+
});
|
9
|
+
});
|
2
10
|
$.ajax({
|
3
11
|
url: '/api/save-property',
|
4
12
|
type: 'put',
|
@@ -7,20 +15,23 @@ function rets_save_property(mls_number) {
|
|
7
15
|
},
|
8
16
|
success: function(resp) {
|
9
17
|
if (resp && resp.success) {
|
10
|
-
|
11
|
-
var oldoc = $(v).attr("onclick");
|
12
|
-
var newoc = $(v).attr("onclick2");
|
13
|
-
$(v).attr("onclick",newoc).attr("onclick2",oldoc);
|
14
|
-
$(v).mouseleave(function() {
|
15
|
-
$(v).addClass("active");
|
16
|
-
});
|
17
|
-
});
|
18
|
+
gtag('event', 'Saved Listing', {'event_category': 'Listings', 'event_label': ('MLS #' + mls_number),'value': 1});
|
18
19
|
}
|
19
20
|
}
|
20
21
|
});
|
21
22
|
}
|
22
23
|
|
23
24
|
function rets_unsave_property(mls_number) {
|
25
|
+
$.each( $("a[data-mls='" + mls_number + "']"), function(k,v) {
|
26
|
+
var oldoc = $(v).attr("onclick");
|
27
|
+
var newoc = $(v).attr("onclick2");
|
28
|
+
$(v).attr("onclick",newoc).attr("onclick2",oldoc);
|
29
|
+
$(v).mouseleave(function() {
|
30
|
+
$(v).removeClass("active");
|
31
|
+
});
|
32
|
+
if ( $(v).closest(".saved-list").length > 0 )
|
33
|
+
$(v).closest(".property").remove();
|
34
|
+
});
|
24
35
|
$.ajax({
|
25
36
|
url: '/api/unsave-property',
|
26
37
|
type: 'put',
|
@@ -29,16 +40,7 @@ function rets_unsave_property(mls_number) {
|
|
29
40
|
},
|
30
41
|
success: function(resp) {
|
31
42
|
if (resp && resp.success) {
|
32
|
-
|
33
|
-
var oldoc = $(v).attr("onclick");
|
34
|
-
var newoc = $(v).attr("onclick2");
|
35
|
-
$(v).attr("onclick",newoc).attr("onclick2",oldoc);
|
36
|
-
$(v).mouseleave(function() {
|
37
|
-
$(v).removeClass("active");
|
38
|
-
});
|
39
|
-
if ( $(v).closest(".saved-list").length > 0 )
|
40
|
-
$(v).closest(".property").remove();
|
41
|
-
});
|
43
|
+
gtag('event', 'Unsaved Listing', {'event_category': 'Listings', 'event_label': ('MLS #' + mls_number),'value': 1});
|
42
44
|
}
|
43
45
|
}
|
44
46
|
});
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class RetsMailer < ActionMailer::Base
|
2
|
+
|
3
|
+
default from: "noreply <noreply@caboosecms.com>"
|
4
|
+
|
5
|
+
def new_user(agent, user, from_address)
|
6
|
+
@agent = agent
|
7
|
+
@user = user
|
8
|
+
@site = user.site
|
9
|
+
to_address = Rails.env.development? ? 'billy@nine.is' : agent.email
|
10
|
+
bcc_address = Rails.env.development? ? 'billyswifty@gmail.com' : @site.contact_email
|
11
|
+
mail(
|
12
|
+
:to => to_address,
|
13
|
+
:bcc => bcc_address,
|
14
|
+
:from => from_address,
|
15
|
+
:subject => "New User Registration",
|
16
|
+
:reply_to => bcc_address
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
@@ -40,6 +40,27 @@ class CabooseRets::Agent < ActiveRecord::Base
|
|
40
40
|
CabooseRets::RetsImporter.import_agent(self.mls_id)
|
41
41
|
end
|
42
42
|
|
43
|
+
def send_new_user_email(user)
|
44
|
+
if !self.email.blank? && user && user.site
|
45
|
+
settings = Caboose::SmtpConfig.where(:site_id => user.site_id).first
|
46
|
+
if settings
|
47
|
+
delivery_options = {
|
48
|
+
user_name: settings.user_name,
|
49
|
+
password: settings.password,
|
50
|
+
address: settings.address,
|
51
|
+
port: settings.port,
|
52
|
+
domain: settings.domain,
|
53
|
+
authentication: settings.authentication,
|
54
|
+
enable_starttls_auto: settings.enable_starttls_auto
|
55
|
+
}
|
56
|
+
from_address = "#{settings.site.description} <#{settings.from_address}>"
|
57
|
+
msg = CabooseRets::RetsMailer.send("new_user", self, user, from_address)
|
58
|
+
msg.delivery_method.settings.merge!(delivery_options)
|
59
|
+
msg.deliver
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
43
64
|
def self.assign_to_new_user(user)
|
44
65
|
if user && user.site && user.site.use_rets
|
45
66
|
rc = CabooseRets::RetsConfig.where(:site_id => user.site_id).first
|
@@ -53,10 +74,11 @@ class CabooseRets::Agent < ActiveRecord::Base
|
|
53
74
|
agent_index + 1 < agents.count ? agent_index += 1 : agent_index = 0
|
54
75
|
agent = agents[agent_index]
|
55
76
|
end
|
56
|
-
Caboose.log("Assigning agent #{agent.mls_id} to user #{user.id}")
|
77
|
+
Caboose.log("Assigning agent #{agent.mls_id} to user #{user.id}") if Rails.env.development?
|
57
78
|
user.rets_agent_mls_id = agent.mls_id
|
58
79
|
last_agent_mls_id.value = agent.mls_id
|
59
80
|
user.save
|
81
|
+
agent.delay(:queue => 'rets').send_new_user_email(user)
|
60
82
|
last_agent_mls_id.save
|
61
83
|
role = Caboose::Role.where(:name => 'RETS Visitor', :site_id => user.site_id).exists? ? Caboose::Role.where(:name => 'RETS Visitor', :site_id => user.site_id).first : Caboose::Role.create(:name => 'RETS Visitor', :site_id => user.site_id)
|
62
84
|
Caboose::RoleMembership.create(:user_id => user.id, :role_id => role.id)
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<h4>New User Registration</h4>
|
2
|
+
|
3
|
+
<p>A new user has registered for an account on the <%= @site.description %> website. Their information is below:</p>
|
4
|
+
|
5
|
+
<p><strong>Name:</strong> <%= @user.first_name %> <%= @user.last_name %></p>
|
6
|
+
<p><strong>Email Address:</strong> <%= @user.email %></p>
|
7
|
+
<p><strong>Phone Number:</strong> <%= @user.phone %></p>
|
8
|
+
|
9
|
+
<% if @agent && !@agent.full_name.blank? %>
|
10
|
+
<p>This user has been automatically assigned to <%= @agent.full_name.titleize %>.</p>
|
11
|
+
<% end %>
|
data/lib/caboose_rets/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: caboose-rets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.149
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Barry
|
@@ -66,6 +66,7 @@ files:
|
|
66
66
|
- app/controllers/caboose_rets/saved_properties_controller.rb
|
67
67
|
- app/controllers/caboose_rets/saved_searches_controller.rb
|
68
68
|
- app/helpers/caboose_rets/application_helper.rb
|
69
|
+
- app/mailers/rets_mailer.rb
|
69
70
|
- app/models/caboose_rets/agent.rb
|
70
71
|
- app/models/caboose_rets/agent_meta.rb
|
71
72
|
- app/models/caboose_rets/log.rb
|
@@ -106,6 +107,7 @@ files:
|
|
106
107
|
- app/views/caboose_rets/properties/property_not_exists.html.erb
|
107
108
|
- app/views/caboose_rets/properties/test_form.html.erb
|
108
109
|
- app/views/caboose_rets/rets/admin_import_form.html.erb
|
110
|
+
- app/views/caboose_rets/rets_mailer/new_user.html.erb
|
109
111
|
- app/views/caboose_rets/saved_properties/index.html.erb
|
110
112
|
- app/views/caboose_rets/saved_properties/rets_info.html.erb
|
111
113
|
- app/views/caboose_rets/saved_searches/edit.html.erb
|