spec/dummy/tmp/cache/assets/CEE/250/sprockets%2F96688f33f2f8aa261bf6701c1d6d7575 in medivo-0.0.4 vs spec/dummy/tmp/cache/assets/CEE/250/sprockets%2F96688f33f2f8aa261bf6701c1d6d7575 in medivo-0.0.7

- old
+ new

@@ -1,20 +1,31 @@ -o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1318603732.318259^[: @value{I" +o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1319563271.903666Õª: @value{I" class:EFI"BundledAsset; FI"id; -F"%125ce9d77e25948a5b28a07cc0dcc846I"logical_path; +F"%0c6214f6b8d1f92265686c590b946f82I"logical_path; FI"medivo/models.js; FI" pathname; FI"c/Users/danielsudol/projects/medivo/medivo_resource/app/assets/javascripts/medivo/models.coffee; FI"content_type; FI"application/javascript; FI" mtime; -FI"2011-10-14T16:47:56+02:00; +FI"2011-10-25T16:59:05+01:00; FI" body; -FI"˜ -(function() { +FI"H(function() { + var isNumber; + var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) { + for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } + function ctor() { this.constructor = child; } + ctor.prototype = parent.prototype; + child.prototype = new ctor; + child.__super__ = parent.prototype; + return child; + }; + isNumber = function(n) { + return !isNaN(parseFloat(n)) && isFinite(n); + }; String.prototype.capitalize = function() { return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase(); }; String.prototype.titleize = function() { var parts, res; @@ -24,92 +35,145 @@ return res.push(part.capitalize()); }); return res.join(" "); }; Handlebars.registerHelper("rounded", function(number) { - if (number !== void 0) { + if (isNumber(number)) { 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(); + if (!(this.data && this.data.address)) { + return; } + return this.data.address.replace(/(\s*,\s*$)/g, "").titleize(); }); window.Lab = (function() { - Lab.prototype.marker = null; Lab.prototype.map_tooltip_template = Handlebars.compile("{{titleize name}}\n{{address_without_comma address}}\n{{titleize city}},{{state}} "); function Lab(data) { this.data = data; + this.index = null; + this.marker = null; + this.point = null; } Lab.prototype.clearMarker = function() { if (this.marker) { this.marker.setMap(null); return this.marker = null; } }; - Lab.prototype.setMarker = function(map, markerBounds) { + Lab.prototype.setMarker = function(map, markerBounds, index) { this.point = new google.maps.LatLng(this.data.lat, this.data.lng); - this.marker = this.makeMarker(map); + this.marker = this.makeMarker(map, index); if (markerBounds) { return markerBounds.extend(this.point); } }; - Lab.prototype.makeMarker = function(map) { + Lab.prototype.makeMarker = function(map, index) { return new google.maps.Marker({ position: this.point, map: map, title: this.map_tooltip_template(this.data), - icon: this.makeIcon() + icon: this.makeIcon(index) }); }; Lab.prototype.makeIcon = function() { - return new google.maps.MarkerImage("/assets/medivo/lab.png"); + return "/assets/medivo/lab.png"; }; + Lab.prototype.icon = function() { + if (this.marker) { + return this.marker.icon; + } + return this.makeIcon(); + }; return Lab; })(); + window.OrderedLab = (function() { + __extends(OrderedLab, Lab); + function OrderedLab(index, data) { + this.index = index; + this.data = data; + } + OrderedLab.prototype.makeIcon = function() { + if (!isNumber(this.index)) { + OrderedLab.__super__.makeIcon.call(this); + } + return "/assets/medivo/marker" + this.makeLetter(this.index) + ".png"; + }; + OrderedLab.prototype.makeLetter = function(number) { + if (number >= 0 && number <= 26) { + return String.fromCharCode(number + 65); + } + return ''; + }; + OrderedLab.prototype.icon = function() { + if (this.marker) { + return this.marker.icon; + } + return this.makeIcon(this.index); + }; + return OrderedLab; + })(); window.LabList = (function() { LabList.prototype.show_number = 3; function LabList(lab_info, show_number) { this.labs = []; if (show_number) { this.show_number = show_number; } - console.log(this.show_number); this.setLabs(lab_info); } LabList.prototype.getLabs = function() { return this.labs.slice(0, this.show_number); }; LabList.prototype.setLabs = function(lab_info) { var labs; this.clearMarkers(); labs = this.labs = []; - return $.each(lab_info, function(index, lab_data) { - return labs.push(new Lab(lab_data)); - }); + if (lab_info !== void 0) { + 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; })(); + window.OrderedLabList = (function() { + __extends(OrderedLabList, LabList); + function OrderedLabList() { + OrderedLabList.__super__.constructor.apply(this, arguments); + } + OrderedLabList.prototype.setLabs = function(lab_info) { + var labs; + this.clearMarkers(); + labs = this.labs = []; + if (lab_info !== void 0) { + return $.each(lab_info, function(index, lab_data) { + return labs.push(new OrderedLab(index, lab_data)); + }); + } + }; + return OrderedLabList; + })(); }).call(this); ; TI"asset_paths; F[I"c/Users/danielsudol/projects/medivo/medivo_resource/app/assets/javascripts/medivo/models.coffee; FI"dependency_paths; F[{I" path; FI"c/Users/danielsudol/projects/medivo/medivo_resource/app/assets/javascripts/medivo/models.coffee; FI" mtime; -FIu: Time Î倀¿: @_zoneI" CEST; -T: offseti I"hexdigest; -F"%44ed492b90aa5f8e1ed32a58e4897ddcI" _version; -F"%36821fa1f19faa0dcebe2dd0b27ced36 +FIu: Time /ç€Pì: @_zoneI"BST; +T: offsetiI"hexdigest; +F"%b88d9b48549ec4a847d708dd10875549I" _version; +F"%46dde6621c301f4928e3b34efee9e3b5 \ No newline at end of file