Skip to content

Commit

Permalink
Merge pull request #90 from midas-isg/front-end-updates
Browse files Browse the repository at this point in the history
Front end updates
  • Loading branch information
JohnLevander authored Aug 11, 2017
2 parents d596ddb + 4689347 commit 80ae3c6
Show file tree
Hide file tree
Showing 215 changed files with 104,775 additions and 68,992 deletions.
70 changes: 46 additions & 24 deletions app/controllers/Application.java
Original file line number Diff line number Diff line change
@@ -1,53 +1,75 @@
package controllers;

import play.Configuration;
import play.Logger;
import play.Play;
import play.db.jpa.Transactional;
import play.mvc.Controller;
import play.mvc.Http.Context;
import play.mvc.Result;
import security.controllers.UserController;


public class Application extends UserController {

private static String INFO = null;
private static String INFO = null;

public static String info() {
init();
return INFO;
}
public static String info() {
init();
return INFO;
}

private static void init(){
if (INFO == null){
final Configuration cfg = Play.application().configuration();
private static void init() {
if (INFO == null) {
final Configuration cfg = Play.application().configuration();
String version = "Version: " + cfg.getString("app.version");
String dbName = "Database: " + cfg.getString("db.default.url");
INFO = "Copyright 2014-2016 - University of Pittsburgh, "
+ version + ", " + dbName;
}
}

@Transactional
String dbName = "Database: " + cfg.getString("db.default.url");
INFO = "Copyright 2014-2016 - University of Pittsburgh, "
+ version + ", " + dbName;
}
}

public Result index() {
return ok(views.html.search.render("location search", info()));
return basicSearch();
}

@Transactional
public Result concept() {
return ok(views.html.concept.render("location services", info()));

public Result basicSearch() {
return ok(views.html.index.render("search", info()));
}

public Result mapSearch() {
return ok(views.html.map_search.render("map search", info()));
}

public Result advancedSearch() {
return ok(views.html.advanced_search.render("advanced search", info()));
}

public Result translate() {
return ok(views.html.translate.render("translator", info()));
}

public Result results() {
return ok(views.html.results.render("refine search", info()));
}

@Transactional
public Result browser() {
return ok(views.html.browser.render("location browser", info()));
return ok(views.html.browser.render("browser", info()));
}

@Transactional
public Result resolver() {
return ok(views.html.resolver.render("location resolver", info()));
return ok(views.html.resolver.render("resolver", info()));
}

@Transactional
public Result create() {
return ok(views.html.create.render("location creator", info()));
return ok(views.html.create.render("creator", info()));
}

@Transactional
public Result concept() {
Logger.warn("\nWARNING! " + Context.current().request().uri() + " is deprecated and may stop being available in the future!\n");
return ok(views.html.concept.render("concept", info()));
}
}
9 changes: 9 additions & 0 deletions app/controllers/LocationServices.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import play.libs.Jsonp;
import play.mvc.Controller;
import play.mvc.Result;
import play.mvc.Http.Context;

@Api(value = "/api/locations", description = "Endpoint for locations")
public class LocationServices extends Controller {
Expand Down Expand Up @@ -463,6 +464,8 @@ public Result findBulkLocations(
@Deprecated
@Transactional
public Result findBulk() {
Logger.warn("WARNING! " + Context.current().request().uri() + " is deprecated and may stop being available in the future!");

List<Object> result = v1.interactors.GeoJsonRule.findBulk((ArrayNode)request().body().asJson());
return ok(toJson(result));
}
Expand Down Expand Up @@ -515,6 +518,8 @@ public Result listUniqueNames(
@Deprecated
@Transactional
public Result findLocationNames(String q, Integer limit){
Logger.warn("WARNING! " + Context.current().request().uri() + " is deprecated and may stop being available in the future!");

return listUniqueNames(q, limit);
}

Expand Down Expand Up @@ -588,6 +593,8 @@ public Result findByPoint(
@Deprecated
@Transactional
public Result findByLocationPoint(double lat, double lon, boolean verbose) {
Logger.warn("WARNING! " + Context.current().request().uri() + " is deprecated and may stop being available in the future!");

return findByPoint(lat, lon, verbose, null, null, OLD_VERSION);
}

Expand Down Expand Up @@ -795,6 +802,8 @@ public Result findByFeatureCollection(
@Deprecated
@Transactional
public Result findByLocationFeatureCollection(Long superTypeId, Long typeId, boolean verbose) throws Exception {
Logger.warn("WARNING! " + Context.current().request().uri() + " is deprecated and may stop being available in the future!");

return findByFeatureCollection(superTypeId, typeId, verbose);
}

Expand Down
43 changes: 32 additions & 11 deletions app/controllers/UnsecuredApplication.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package controllers;

import play.Configuration;
import play.Logger;
import play.Play;
import play.db.jpa.Transactional;
import play.mvc.Result;
import play.mvc.Http.Context;
import play.mvc.Controller;


Expand Down Expand Up @@ -31,28 +33,47 @@ public Result about() {
return ok(views.html.about.render("about", info()));
}

@Transactional
public Result index() {
return ok(views.html.search.render("location search", info()));
public Result index() {
return basicSearch();
}

@Transactional
public Result concept() {
return ok(views.html.concept.render("location services", info()));

public Result basicSearch() {
return ok(views.html.index.render("search", info()));
}

public Result mapSearch() {
return ok(views.html.map_search.render("map search", info()));
}

public Result advancedSearch() {
return ok(views.html.advanced_search.render("advanced search", info()));
}

public Result translate() {
return ok(views.html.translate.render("translator", info()));
}

public Result results() {
return ok(views.html.results.render("refine search", info()));
}

@Transactional
public Result browser() {
return ok(views.html.browser.render("location browser", info()));
return ok(views.html.browser.render("browser", info()));
}

@Transactional
public Result resolver() {
return ok(views.html.resolver.render("location resolver", info()));
return ok(views.html.resolver.render("resolver", info()));
}

@Transactional
public Result create() {
return ok(views.html.create.render("location creator", info()));
return ok(views.html.create.render("creator", info()));
}

@Transactional
public Result concept() {
Logger.warn("\nWARNING! " + Context.current().request().uri() + " is deprecated and may stop being available in the future!\n");
return ok(views.html.concept.render("concept", info()));
}
}
2 changes: 1 addition & 1 deletion app/views/about.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
}

@main(message, imports, version) {
<iframe class="center-block full-width full-height" src="https://docs.google.com/document/d/1aBj5Vkxmme6MiAPmAF71xDLKHxPfVK8gbf6l0eoxTSA/pub?embedded=true"></iframe>
<iframe id="about-doc" class="center-block" src="https://docs.google.com/document/d/1aBj5Vkxmme6MiAPmAF71xDLKHxPfVK8gbf6l0eoxTSA/pub?embedded=true"></iframe>
}
25 changes: 25 additions & 0 deletions app/views/advanced_map.scala.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<div id="advanced-searchbar-form" style="margin-bottom: 5px; padding-left: 5px; padding-right: 5px;">
<div class="roundbox">
<div class="form-inline">
<div class="form-group horizontal-padding">
<label for="latitude">Latitude</label>
<input id="latitude" class="form-control" type="number" min="-90" max="90" value="0" step="0.000001">
</div>

<div class="form-group horizontal-padding">
<label for="longitude">Longitude</label>
<input id="longitude" class="form-control" type="number" min="-180" max="180" value="0" step="0.000001">
</div>

<div class="pull-right">
<div class="form-group">
<button id="search-button" class="btn btn-primary">Search</button>
</div>
</div>

<div class="clear-both"></div>
</div>
</div>
</div>

<script src='@routes.Assets.at("javascripts/advanced-map.js")'></script>
25 changes: 25 additions & 0 deletions app/views/advanced_options.scala.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
@(search_type: String)

<div style="display: inline-block; padding: 2px;">
<button id="advanced-options-toggle" class="btn btn-sm btn-default">
<span class="glyphicon glyphicon-menu-hamburger"></span>
</button>
</div>

<div class="clear-both"></div>

<div id="advanced-options" style="display: none; margin-top: 2px;">
@{
if(search_type == "searchbar") {
advanced_searchbar()
}
else if(search_type == "map") {
advanced_map()
}
else {
<h1>DOGS RULE!</h1>
}
}
</div>

<script src='@routes.Assets.at("javascripts/advanced-options.js")'></script>
61 changes: 61 additions & 0 deletions app/views/advanced_search.scala.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
@(message: String, version: String)

@imports = {
<link href='@routes.Assets.at("stylesheets/index.css")' rel='stylesheet'>
<link href='@routes.Assets.at("stylesheets/search.css")' rel='stylesheet'>

<!--
<script src='@routes.Assets.at("external_packages/fancytree/jquery.fancytree.js")'></script>
<script src='@routes.Assets.at("javascripts/search-map.js")'></script>
<script src='@routes.Assets.at("javascripts/search-results.js")' type='text/javascript'></script>
<script src='@routes.Assets.at("javascripts/search-rank.js")' type='text/javascript'></script>
<link href='@routes.Assets.at("external_packages/fancytree/ui.fancytree.css")' rel='stylesheet'>
<link href='@routes.Assets.at("stylesheets/fancytree-ext.css")' rel='stylesheet'>
-->
}

@main(message, imports, version) {
<div class="center-block">
<div class="vertical-spaced center-block">
<!-- POST /api/locations/find-bulk -->
<div class="roundbox extra-bottom-space">
<div class="form-group horizontal-padding">
<label for="location-codes-list">Location codes list</label>
<textarea id="location-codes-list" class="form-control" placeholder="ex: '1216' or '1423, 1600, 1900, ...' or (leave empty to query by country)"></textarea>
</div>

<div class="form-group horizontal-padding">
<label for="code-type">Input code type</label>
<select id="code-type" class="form-control">
<option disabled selected value="-1">(not selected)</option>
</select>
</div>
</div>

<!-- GET /api/locations/find-by-coordinate -->
<div class="roundbox extra-bottom-space">
<div class="form-group horizontal-padding">
<label for="location-codes-list">Location codes list</label>
<textarea id="location-codes-list" class="form-control" placeholder="ex: '1216' or '1423, 1600, 1900, ...' or (leave empty to query by country)"></textarea>
</div>

<div class="form-group horizontal-padding">
<label for="code-type">Input code type</label>
<select id="code-type" class="form-control">
<option disabled selected value="-1">(not selected)</option>
</select>
</div>
</div>

</div>

<div id="search-options" class="center-block">
<button class="btn btn-default" onclick="location.assign(CONTEXT)">Name Search</button>
<button class="btn btn-default" onclick="location.assign(CONTEXT + '/map-search');">Map Search</button>
</div>
</div>
}
Loading

0 comments on commit 80ae3c6

Please sign in to comment.