Skip to content
Browse files

changing the data load to load json to allow formatted strings

  • Loading branch information...
1 parent c9ffba3 commit 30a3822365a145e1472834501d38c15a97488867 @retroryan retroryan committed
Showing with 28 additions and 24 deletions.
  1. +4 −11 app/controllers/Labeler.java
  2. +23 −12 app/views/Labeler/labelNextPlace.html
  3. +1 −1 app/views/main.html
View
15 app/controllers/Labeler.java
@@ -26,21 +26,14 @@
public static int maxID = 0;
public static RandomData randomData = new RandomDataImpl();
- public static void storeLabelChoice(String ambigId, String ambigPlace, String placeId, String placeName, String placeFullName) {
- //System.out.println(ambigId + ambigPlace+ placeName + placeFullName);
- int ambigIdInt = Integer.parseInt(ambigId.trim());
- int standardizedId = Integer.parseInt(placeId.trim());
- MatchResult matchResult = new MatchResult(ambigIdInt, ambigPlace, standardizedId, placeName, placeFullName);
+ public static void storeLabelChoice(MatchResult matchResult) {
matchResult.save();
-
- AmbigResults ambigResults = new AmbigResults(ambigIdInt, ambigPlace, placeFullName);
-
- labelNextPlace(ambigResults);
+ labelNextPlace();
}
- public static void labelNextPlace(AmbigResults ambigResults) {
- render(ambigResults);
+ public static void labelNextPlace() {
+ render();
}
public static void getNextPlace() {
View
35 app/views/Labeler/labelNextPlace.html
@@ -19,7 +19,7 @@
$.each(ambigPlaceList, function (index, item) {
var tableRowStr = '<tr>' + addColumn('<input type="submit" class="btn primary" name="' + index + '" value="Select">');
- tableRowStr += addColumn(item.fullName);
+ tableRowStr += addLinkColumn(item.id, item.fullName);
tableRowStr += addColumn(item.altNames);
tableRowStr += addColumn(item.types);
tableRowStr += addColumn(item.alsoLocatedIn);
@@ -48,13 +48,29 @@
}
- function submitAmbigChoice(placeId, placeName, placeFullName) {
+ function addLinkColumn(id, fullName) {
+ var rowString;
+ if (typeof(fullName) != "undefined") {
+ //The id's -1, -2, -3 are the alternative choices when none of the places match and should not be a link
+ if (id > -1) {
+ encodedFullName = fullName.replace(/ /gi,"_");
+ rowString = '<a href="http://www.werelate.org/Place:' + encodedFullName + '">' + fullName + '</a>';
+ }
+ else {
+ rowString = fullName;
+ }
+ return "<td>" + rowString + "</td>";
+ }
+ return "<td></td>";
+ }
+
+ function submitAmbigChoice(standardizedId, standardizedName, standardizedFullName) {
//document.storeLabelChoice.setAttribute("method","post");
- addAttribute("ambigId",ambigId);
- addAttribute("ambigPlace",ambigPlace);
- addAttribute("placeId",placeId);
- addAttribute("placeName",placeName);
- addAttribute("placeFullName",placeFullName);
+ addAttribute("matchResult.ambigId",ambigId);
+ addAttribute("matchResult.ambigPlace",ambigPlace);
+ addAttribute("matchResult.standardizedId",standardizedId);
+ addAttribute("matchResult.standardizedName",standardizedName);
+ addAttribute("matchResult.standardizedFullName",standardizedFullName);
$("#storeLabelChoice").submit();
}
@@ -72,11 +88,6 @@
<div class="content">
- #{if ambigResults}
- <h3>Labeled ${ambigResults.ambigPlace} as "${ambigResults.fullname}"</h3>
- <p></p><p></p><p></p><p></p>
- #{/if}
-
<h3>Choose the Best Match For</h3>
<h1 id="ambigPlaceLabel"></h1>
View
2 app/views/main.html
@@ -46,7 +46,7 @@
<div class="topbar-inner">
<div class="container-fluid">
<div style="float:left"><a class="brand" href="/">Place matcher</a></div>
-<!-- <div style="float:right"><a href="@{Application.comparePlacesUpload()}">Compare Places file</a></div> -->
+ <div style="float:left"><a class="brand" href="@{Labeler.labelNextPlace()}" style="font-size: 15px;">Choose the best match</a></div>
<div style="float:right"><a class="download" href="http://github.com/DallanQ/Places">Download the source</a></div>
</div>
</div>

0 comments on commit 30a3822

Please sign in to comment.
Something went wrong with that request. Please try again.