aso2101 / satavahana-inscriptions

1 stars 0 forks source link

Replace app:inscription-map in view.html with app:map #21

Closed aso2101 closed 7 years ago

aso2101 commented 7 years ago

app:map is invoked elsewhere on the site, and it's nicer, because it pulls dynamic data from the model and uses a separate function to serialize it into geojson. But there seems to a problem with simply replacing app:inscription-map with app:map in view.html: the map doesn't appear (and view.html still has the annoying paging functions from TEIPublisher that are triggered when the map is expanded or collapsed).

wsalesky commented 7 years ago

Okay, there was a bug in the app:map in handling single points on a map. This has been fixed so you can replace all calls to app:inscription-map with app:map and remove app:inscription-map from app.xql. Still need to handle the issues with clashing javascript functions that cause trouble when you attempt to expand/collapse the map.

aso2101 commented 7 years ago

Great. 0497bef replaces them, but before I get rid of app:inscription-map, two more map-related requests:

function addLinksToPlace() {
    var spans = document.getElementsByClassName(placeName);
    if (typeof spans != 'undefined') {
        for (i = 0; i<spans.length; i++) {
            var span = spans.item(i);
            var a = document.createElement("a");
            var b = document.createTextNode(" ");
            var linkText = document.createTextNode("(show on map)");
            a.appendChild(linkText);
            a.href = "javascript:void();";
            a.onclick = function() {
                map.setView(layer.getLatLng());
                layer.openPopup();
                location.hash = '#';
            };
            span.appendChild(b);
            span.appendChild(a);
        }
    }
}
wsalesky commented 7 years ago

Partially resolved. New branch adds centering and uses 'fitBounds' to fit all markers onto map. Still need to fix the javascript to add links to placeNames.

aso2101 commented 7 years ago

Just FYI: 72b99c2 addresses two map-related problems, namely

  1. i undid the changes i made to map.js which caused only one data-point in $data to load
  2. i changed map.xql so that tei:geo doesn't have to be a direct child of tei:place (in fact, it's not supposed to be, as i found out!); this should also work for full-TEI place records (I can confirm that it works with Gaṅgaperūru.xml).
wsalesky commented 7 years ago

Updated map.js to center map on a single or multiple markers. Added script to add 'see on map' links to placeNames that appear on the map, @aso2101 If this works as expected you can close this issue.

aso2101 commented 7 years ago

perfect! fixed with 2cb89e9.

wsalesky commented 7 years ago

Installed the latest version. Looks like there may have been some merge issues? Placement of (show on map) is incorrect, and the panto() function should also trigger a popup when you click on the (show on map)

wsalesky commented 7 years ago

Fixed. Changed a line in app.xql to enable the popups to trigger javascript correctly.

aso2101 commented 7 years ago

I am reopening this issue because of the small outstanding bug we talked about (when closing or opening the map in view.html, there is an error such as "Not found: doc=KanB2-6.xml&&id=" and the page reloads).

wsalesky commented 7 years ago

Fixed on https://github.com/aso2101/satavahana-inscriptions/tree/issue21 Removed id='content-container' to stop default behaviors for javascript animations, which where overriding bootstrap behaviors. (teiPublisher behaviors were for paging, which is not needed for this app, if paging is needed I suggest using another behavior or custom javascript to hide the map.)

@aso2101 Please review and merge if it looks good.

aso2101 commented 7 years ago

merged with 4f968c5 (which also incorporates some cleanup in earlier commits). by the way, these changes fix the default teipublisher behaviors for browse back and browse forward, which we don't use.