<% if (loggedIn == true || access != 3) { %> <% if (typeof(score) != "undefined") { %>
"><%= score.toFixed(1) %>
<%} %>
<%
if (access == 2) {
print("Access Restricted - ");
}
var descriptorCounts = {};
_.each(stations,function(station, index){
_.each(station.outlets,function(outlet, index) {
var descriptor = utils.getDescriptorForOutlet(outlet);
if (descriptor in descriptorCounts) {
descriptorCounts[descriptor] = descriptorCounts[descriptor] + 1;
} else {
descriptorCounts[descriptor] = 1;
}
});
});
var output = "";
for (var descriptor in descriptorCounts) {
var name = utils.getNameForDescriptor(parseInt(descriptor));
if (descriptorCounts.hasOwnProperty(descriptor) && name != null) {
if (descriptorCounts[descriptor] == 1) {
output += name;
} else {
output += descriptorCounts[descriptor] + " " + name + "s";
}
output += ", ";
}
}
print(output.substring(0, output.length - 2));
%>
<%
if (!embedded) {
var shownStations = 0;
stations = _.sortBy(stations, function(station){
if (station.available == 1) {
return 0;
}
if (station.available == 2) {
return 1;
}
return 2;
});
_.each(stations,function(station, index){
if (typeof(station.network) != "undefined" && shownStations <= 3) {
if (shownStations == 0) { %>
<% } else {
if (shownStations % 2 == 0) { %>
<% }}
shownStations += 1;
%>
<%
print("
" + station.network.name);
if (station.available == 1) {
print("Available");
}
if (station.available == 2) {
print("In Use");
}
if (station.available == 3) {
print("Offline");
}
if (station.available == 4) {
print("Under Repair");
}
print("
");
var outlets_string = "
";
var outlet_names = []
_.each(station.outlets,function(outlet, index) {
var outlet_name = utils.getNameForDescriptor(utils.getDescriptorForOutlet(outlet));
if (outlet_name != null && $.inArray(outlet_name, outlet_names) == -1) {
outlet_names.push(outlet_name);
}
});
_.each(outlet_names,function(name, index) {
outlets_string += name;
if (index < outlet_names.length - 1) {
outlets_string += ", ";
}
});
print(outlets_string + "
");
%>
<% }
});
if (shownStations > 0) {
print("
");
}
} %>
<% if (custom_ports != "") { %>
<%- custom_ports %>
<% } %> <% if (address != "" && !(access == 3 && typeof(owner) !== 'undefined' && owner.hide_address)) { %>
<%- address %>
<% }
var subsections = [];
if (phone != "" && !(access == 3 && typeof(owner) !== 'undefined' && owner.hide_phone)) {
var phone_string = "";
if (phone.length == 10) {
phone_string = '(' + phone.substr(0,3) + ') ' + phone.substr(3,3) + '-' + phone.substr(6,4);
} else {
phone_string = phone;
}
subsections.push({
"title": "Phone",
"value": phone_string
});
}
if (cost) {
if (cost_description == "") {
subsections.push({
"title": "Cost",
"value": 'Cost unknown'
});
} else {
subsections.push({
"title": "Cost",
"value": cost_description
});
}
}
if (payment_enabled) {
subsections.push({
"title": "Pay with PlugShare",
"value": 'Available on PlugShare for
Android and
iPhone'
});
}
else if (pwps_version >= 2 && pwps_version <= 3) {
if (pwps_enabled) {
subsections.push({
"title": "Pay with PlugShare",
"value": '
Pay with PlugShare'
});
} else {
subsections.push({
"title": "Pay with PlugShare",
"value": 'Available on PlugShare for
Android and
iPhone'
});
}
}
if (hours != "") {
subsections.push({
"title": "Hours",
"value": hours
});
}
_.each(subsections,function(section, index){
var margin = 0;
if (index != subsections.length - 1) {
margin = 20;
}
%>
<% if (section['title'] == "Pay with PlugShare") { %> <%= section['value'] %> <% } else { %> <%- section['value'] %> <% } %>
<%
});
if (description != "") { %>
<%= description %>
<% } %> <% if (typeof(photos) != "undefined" && photos.length > 0 && !embedded) { %>
<% var width = photos.length * 76; %>
<% _.each(photos, function(photo, index){ %>
<% }); %>
<% } %> <% if (typeof(reviews) != "undefined" && reviews.length > 0) {
reviews = _.sortBy(reviews, function(review){
return -1 * new Date(review.created_at).getTime();
});
var last_review = null;
for (var i=0;i
<%
if (last_review != null) {
var review = last_review;
var review_icon = null;
if (review.rating == 1) {
review_icon = "https://s3.amazonaws.com/plugshare.production.assets/assets/positive_review_icon.png";
}
if (review.rating == -1) {
review_icon = "https://s3.amazonaws.com/plugshare.production.assets/assets/negative_review_icon.png";
}
var review_user_name = "PlugSharer";
if (typeof(review.user) != "undefined" && review.user.first_name != '') {
review_user_name = review.user.first_name;
}
%> <% if (review_icon != null) { %>
<% } %> <% if (typeof(review.user) != "undefined") { %> <% } %>
<%= moment(review.created_at).format("MMM D, YYYY h:mm A") %> <% }
if (!embedded) { %>
Show Comments <% } %>
<% } %> <% if (typeof(reviews) != "undefined" && reviews.length > 0) { %> You must log in to see home chargers. |
<% } %>