spec/dummy/tmp/cache/assets/D84/210/sprockets%2Fabd0103ccec2b428ac62c94e4c40b384 in medivo-0.0.1 vs spec/dummy/tmp/cache/assets/D84/210/sprockets%2Fabd0103ccec2b428ac62c94e4c40b384 in medivo-0.0.2
- old
+ new
@@ -1,8 +1,8 @@
-o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1318517686.9361222 ém:@value{ I"length:EFiAŸI"digest;
-F"%3469cb244d0b526120a5f9f3833f48b9I"source;
-FI"AŸ/*!
+o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1318541826.5017011 ß:@value{ I"length:EFis¨I"digest;
+F"%6b8d4022f33daac16d7d5e1bb20acb89I"source;
+FI"s¨/*!
* jQuery JavaScript Library v1.6.2
* http://jquery.com/
*
* Copyright 2011, John Resig
* Dual licensed under the MIT or GPL Version 2 licenses.
@@ -10840,10 +10840,29 @@
}
};
Handlebars.compile = Handlebars.VM.compile;;
(function() {
+ window.LabListView = (function() {
+ LabListView.prototype.el = null;
+ LabListView.prototype.template = null;
+ function LabListView(lab_list) {
+ this.lab_list = lab_list;
+ this.el = $('ul#lab_list');
+ this.template = Handlebars.compile($('#lab_item_template').html());
+ this.render();
+ }
+ LabListView.prototype.render = function() {
+ var view;
+ view = this;
+ view.el.empty();
+ return $.each(this.lab_list.labs, function(index, lab) {
+ return view.el.append($(view.template(lab.data)));
+ });
+ };
+ return LabListView;
+ })();
window.MapView = (function() {
function MapView(collection, center_point) {
this.collection = collection;
this.center_point = center_point;
if (!this.collection) {
@@ -10907,16 +10926,43 @@
};
return MapView;
})();
}).call(this);
(function() {
+ String.prototype.capitalize = function() {
+ return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase();
+ };
+ String.prototype.titleize = function() {
+ var parts, res;
+ res = [];
+ parts = this.split(" ");
+ $.each(parts, function(index, part) {
+ return res.push(part.capitalize());
+ });
+ return res.join(" ");
+ };
+ Handlebars.registerHelper("rounded", function(number) {
+ if (number !== void 0) {
+ return parseFloat(number).toFixed(2);
+ }
+ });
+ Handlebars.registerHelper("titleize", function(string) {
+ if (string !== void 0) {
+ return string.titleize();
+ }
+ });
+ Handlebars.registerHelper("address_without_comma", function(lab) {
+ if (this.address !== void 0) {
+ return this.address.replace(/(\s*,\s*$)/g, "").titleize();
+ }
+ });
window.Lab = (function() {
function Lab(data) {
this.data = data;
}
Lab.prototype.marker = null;
- Lab.prototype.map_tooltip_template = Handlebars.compile("{{name}}\n{{address}}\n{{city}},{{state}} ");
+ Lab.prototype.map_tooltip_template = Handlebars.compile("{{titleize name}}\n{{address_without_comma address}}\n{{titleize city}},{{state}} ");
Lab.prototype.clearMarker = function() {
if (this.marker) {
this.marker.setMap(null);
return this.marker = null;
}
@@ -10940,37 +10986,59 @@
return new google.maps.MarkerImage("/assets/medivo/lab.png");
};
return Lab;
})();
window.LabList = (function() {
- function LabList(data) {
+ function LabList(lab_info) {
+ this.labs = [];
+ this.setLabs(lab_info);
+ }
+ LabList.prototype.setLabs = function(lab_info) {
var labs;
- this.data = data;
+ this.clearMarkers();
labs = this.labs = [];
- $.each(this.data, function(index, lab_data) {
+ return $.each(lab_info, function(index, lab_data) {
return labs.push(new Lab(lab_data));
});
- }
+ };
LabList.prototype.clearMarkers = function() {
return $.each(this.labs, function(index, lab) {
return lab.clearMarker();
});
};
return LabList;
})();
}).call(this);
(function() {
$(document).ready(function() {
- var data, lab_list, map_view;
+ var data, lab_list, lab_list_view, map_view;
+ map_view = null;
+ lab_list = null;
data = $('#lab_list_container').data('labs');
if (data) {
lab_list = new window.LabList(data.labs);
map_view = new window.MapView(lab_list, data.zip_location);
- return map_view.render();
+ lab_list_view = new window.LabListView(lab_list);
+ map_view.render();
} else {
- return console.log('no data');
+ console.log('no data');
}
+ return $("form#lab_data_search").bind('ajax:beforeSend', function(event, data) {
+ var span, zip_code;
+ zip_code = $(this).find('#zip_code').val();
+ if (!zip_code.match(/\d{5}/)) {
+ span = $('<span>Zip code should be 5 digits</span>');
+ $('form#lab_data_search .error_message').append(span);
+ span.fadeOut(4000);
+ return false;
+ }
+ }).bind('ajax:success', function(event, data) {
+ lab_list.setLabs(data.labs);
+ map_view.center_point = data.zip_location;
+ map_view.render();
+ return $('form#lab_data_search input[type=submit]').prop("disabled", false);
+ }).bind('ajax:complete', function(event, data) {});
});
}).call(this);
// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
@@ -10978,6 +11046,6 @@
// the compiled file.
//
;
;
FI"
_version;
-F"%ed720fea8b25328febb3eb8ae09a9e8f
+F"%83fb6e2bada2e008c568adc1611599f8
\ No newline at end of file