<commit_before>define(["backbone", "config", "leaflet", "ref-location"],
       function(B, config, L, refLocation) {
    function styleMarkerForState(marker, isHovered, isSelected) {

    }

    function styleMarker(marker, permit) {
        // Apply the appropriate styles for the marker's current hovered
        // and selection state.
        var isHovered = permit.get("hovered"),
            isSelected = permit.get("selected");

        styleMarkerForState(marker, isHovered, isSelected);
    }

    return B.View.extend({
        initialize: function() {
            var map = L.map(this.el),
                layer = L.tileLayer("http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png"),
                zoningLayer = L.layerGroup();

            map.fitBounds(config.bounds);

            map.addLayer(layer);
            map.addLayer(zoningLayer);

            this.map = map;
            this.zoningLayer = zoningLayer;

            // Map from case numbers to L.Markers
            this.caseMarker = {};

            this.listenTo(this.collection, "add", this.permitAdded);
            this.listenTo(this.collection, "remove", this.permitRemoved);
            this.listenTo(this.collection, "change", this.changed);

            // Place the reference location marker:
            this.placeReferenceMarker();
            // ... and subscribe to updates:
            this.listenTo(refLocation, "change", this.placeReferenceMarker);

            return this;
        },

        el: function() {
            return document.getElementById(config.mapId);
        },

        // Callbacks:
        permitAdded: function(permit) {
            // What is the actual signature for callbacks??
            var loc = permit.get("location");

            if (!loc)
                return;

            var marker = L.marker(loc);

            marker.addTo(this.zoningLayer);

            this.caseMarker[permit.get("caseNumber")] = marker;

            marker.on("mouseover", function(e) {
                permit.set({hovered: true});
                styleMarker(marker, permit);
            });
            marker.on("mouseout", function(e) {
                permit.set({hovered: false});
                styleMarker(marker, permit);
            });

            this.listenTo(permit, "change", this.permitChangd);
        },

        permitChanged: function(permit) {
            styleMarker(this.getMarkerForPermit(permit), permit);
        },

        permitRemoved: function(permit) {
            var marker = this.getMarkerForPermit(permit);

            if (marker)
                this.zoningLayer.removeLayer(marker);

            delete this.caseMarker[permit.get("caseNumber")];
        },

        // Triggered when a child permit changes
        changed: function(change) {
            var marker = this.getMarkerForPermit(change);

            if (marker) {
                if (change.get("excluded")) {
                    this.zoningLayer.removeLayer(marker);<commit_msg>changed L.marker to use an L.icon referencing custom .png file<commit_after>define(["backbone", "config", "leaflet", "ref-location"],
       function(B, config, L, refLocation) {
    function styleMarkerForState(marker, isHovered, isSelected) {

    }

    function styleMarker(marker, permit) {
        // Apply the appropriate styles for the marker's current hovered
        // and selection state.
        var isHovered = permit.get("hovered"),
            isSelected = permit.get("selected");

        styleMarkerForState(marker, isHovered, isSelected);
    }

    return B.View.extend({
        initialize: function() {
            var map = L.map(this.el),
                layer = L.tileLayer("http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png"),
                zoningLayer = L.layerGroup();

            map.fitBounds(config.bounds);

            map.addLayer(layer);
            map.addLayer(zoningLayer);

            this.map = map;
            this.zoningLayer = zoningLayer;

            // Map from case numbers to L.Markers
            this.caseMarker = {};

            this.listenTo(this.collection, "add", this.permitAdded);
            this.listenTo(this.collection, "remove", this.permitRemoved);
            this.listenTo(this.collection, "change", this.changed);

            // Place the reference location marker:
            this.placeReferenceMarker();
            // ... and subscribe to updates:
            this.listenTo(refLocation, "change", this.placeReferenceMarker);

            return this;
        },

        el: function() {
            return document.getElementById(config.mapId);
        },

        // Callbacks:
        permitAdded: function(permit) {
            // What is the actual signature for callbacks??
            var loc = permit.get("location");

            if (!loc)
                return;

            var normalIcon = L.icon({iconUrl: "images/marker-normal.png"})
            var marker = L.marker(loc, {icon: normalIcon});

            marker.addTo(this.zoningLayer);

            this.caseMarker[permit.get("caseNumber")] = marker;

            marker.on("mouseover", function(e) {
                permit.set({hovered: true});
                styleMarker(marker, permit);
            });
            marker.on("mouseout", function(e) {
                permit.set({hovered: false});
                styleMarker(marker, permit);
            });

            this.listenTo(permit, "change", this.permitChangd);
        },

        permitChanged: function(permit) {
            console.log("changed")
            styleMarker(this.getMarkerForPermit(permit), permit);
        },

        permitRemoved: function(permit) {
            var marker = this.getMarkerForPermit(permit);

            if (marker)
                this.zoningLayer.removeLayer(marker);

            delete this.caseMarker[permit.get("caseNumber")];
        },

        // Triggered when a child permit changes
        changed: function(change) {
            var marker = this.getMarkerForPermit(change);

            if (marker) {
                if (change.get("excluded")) {
                    this.zoningLayer.removeLayer(marker);
{'fraction_non_alphanumeric': 0.12157562003566218, 'fraction_numerical': 0.0, 'mean_word_length': 1.8591288229842446, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1053063', 'n_tokens_mistral': 1685, 'n_tokens_neox': 1610, 'n_words': 325}