Skip to content

Commit

Permalink
Merge pull request #102 from spe-uob/dev
Browse files Browse the repository at this point in the history
main <-- dev v0.2.1
  • Loading branch information
James-Millan authored Mar 4, 2022
2 parents 235ec8e + 7b5e46b commit e881866
Show file tree
Hide file tree
Showing 9 changed files with 222 additions and 88 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,22 @@ public String search(
@RequestParam(defaultValue = "", required = false) String q,
@RequestParam(defaultValue = "25", required = false) int nhits,
@RequestParam(defaultValue = "0", required = false) int page,
@RequestParam(defaultValue = "", required = false) String refineField,
@RequestParam(defaultValue = "", required = false) String refineQ,
@RequestParam(defaultValue = "", required = false) String excludeField,
@RequestParam(defaultValue = "", required = false) String excludeQ,
Model model) {
var srq = new SearchRequestBuilder("https://opendata.bristol.gov.uk/", "open-data-gallery-3-european-old-masters");
srq.setQuery(q);
srq.setLimit(nhits);
srq.setOffset(nhits * page);
if (!refineField.equals("") && !refineQ.equals("")) {
srq.refineBy(refineField, refineQ);
}
if (!excludeField.equals("") && !excludeQ.equals("")) {
srq.exclude(excludeField, excludeQ);
}


var response = srq.sendRequest();
model.addAttribute("response", response);
Expand Down
49 changes: 39 additions & 10 deletions src/main/resources/static/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@
text-align: center;
font-size: 48px;
}

#search-button {
background-color: #d6005a;
}

i {
color: white;
}
* {
font-family: "ITCAvantGardeGothicW05-Book", Arial, sans-serif;
}
Expand Down Expand Up @@ -97,14 +105,17 @@ h2 {
margin: 25px 0;
font-size: 0.9em;
font-family: sans-serif;
color: rgba(46, 49, 55, 255);
min-width: 600px;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
}
.styled-table thead tr {
background-color: #d6005a;
color: #ffffff !important;
text-align: left;
}

.styled-table th,
.styled-table td {
color: rgba(46, 49, 55, 255);
max-width: 800px;
padding: 12px 15px;
}
Expand All @@ -118,8 +129,7 @@ h2 {
}

.styled-table tbody tr:last-of-type {
border-bottom: 2px solid rgba(46, 49, 55, 255);
;
border-bottom: thin solid #d6005a;
}

.hidden{
Expand All @@ -129,15 +139,15 @@ h2 {
.shown{
display: block;
}
.styled-table tbody tr:last-of-type {
border-bottom: 2px solid rgba(46, 49, 55, 255);
;
}

.hover{
display: none;
}

.link {
color: #d6005a;
}

.link:hover .hover {
display: block;
position: fixed;
Expand All @@ -160,19 +170,22 @@ h2 {
padding: 16px;
min-width: 160px;
border: none;
z-index: 3;
}
.dropdown-container {
left: 0%;
right: 0;
padding-bottom: 15px;
position: relative;
display: inline-block;
z-index: 3;
}
.dropdown-items {
display: none;
position: absolute;
background-color: lightgrey;
min-width: 160px;
z-index: 1;
z-index: 3;
}
.dropdown-items a {
color: black;
Expand Down Expand Up @@ -224,10 +237,26 @@ h2 {
.BristolMuseum{
background-color: #d6005a;
width: 100%;
max-height: 100;
max-height: 100px;
}

.btn-secondary{
background-color: #53565A !important;
}

.stay {
position: fixed;
top: 0;
width: 100%;
z-index: 3;
}

.info-break {
size: 1000px;
}

.navBut a {
color: white !important;
text-decoration: none !important;
}

3 changes: 3 additions & 0 deletions src/main/resources/templates/error-404.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
<meta charset="utf-8">
<script src="https://use.fontawesome.com/639e5b5645.js"></script>
<link rel="stylesheet" href="/styles.css">
<link href="https://db.onlinewebfonts.com/c/97294bc26984beb9185137b039854f9b?family=D-DIN" rel="stylesheet" type="text/css"/>
<link href="https://db.onlinewebfonts.com/c/8e59fdbc7a7fdb1bab1b12af14615047?family=ITCAvantGardeGothicW05-Book"
rel="stylesheet" type="text/css"/>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<title>Error 404 - Not Found</title>
</head>
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/templates/error-500.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
<meta charset="utf-8">
<script src="https://use.fontawesome.com/639e5b5645.js"></script>
<link rel="stylesheet" href="/styles.css">
<link href="https://db.onlinewebfonts.com/c/97294bc26984beb9185137b039854f9b?family=D-DIN" rel="stylesheet" type="text/css"/>
<link href="https://db.onlinewebfonts.com/c/8e59fdbc7a7fdb1bab1b12af14615047?family=ITCAvantGardeGothicW05-Book"
rel="stylesheet" type="text/css"/>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<title>Error 500 - No Results</title>
</head>
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/templates/error-default.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
<meta charset="utf-8">
<script src="https://use.fontawesome.com/639e5b5645.js"></script>
<link rel="stylesheet" href="/styles.css">
<link href="https://db.onlinewebfonts.com/c/97294bc26984beb9185137b039854f9b?family=D-DIN" rel="stylesheet" type="text/css"/>
<link href="https://db.onlinewebfonts.com/c/8e59fdbc7a7fdb1bab1b12af14615047?family=ITCAvantGardeGothicW05-Book"
rel="stylesheet" type="text/css"/>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<title>Uh-Oh Error</title>
</head>
Expand Down
126 changes: 83 additions & 43 deletions src/main/resources/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<link rel="stylesheet" href="/styles.css">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<link href="//db.onlinewebfonts.com/c/97294bc26984beb9185137b039854f9b?family=D-DIN" rel="stylesheet" type="text/css"/>
<link href="//db.onlinewebfonts.com/c/8e59fdbc7a7fdb1bab1b12af14615047?family=ITCAvantGardeGothicW05-Book"
<link href="https://db.onlinewebfonts.com/c/97294bc26984beb9185137b039854f9b?family=D-DIN" rel="stylesheet" type="text/css"/>
<link href="https://db.onlinewebfonts.com/c/8e59fdbc7a7fdb1bab1b12af14615047?family=ITCAvantGardeGothicW05-Book"
rel="stylesheet" type="text/css"/>
<title>Museum Search Tool</title>
</head>
Expand All @@ -23,58 +23,98 @@
<h1 id="title">Hidden Museums Web Search Tool</h1>
<main class="content">
<div id="search-box" action="search">
<form class="form" action="/search">
<form class="form" action="/search" onsubmit="cleanURL()">
<div class="input-group mb-3">
<input id="q" name="q" class="form-control" type="text" placeholder="Search">
<button id="search-button" class="btn btn-primary" type="submit">
<i class="fa fa-search"></i>
</button>
</div>
<table class="table" id="filters">
<tr>
<th scope="col">Filter</th>
<th scope="col">Option</th>
<th scope="col">Input</th>
</tr>
<tr class="Refine">
<td>
<select class="Filter1">
<option th:each="i : ${fieldList}" th:value="${i}"
th:with="prettyField=${i.replaceAll('_', ' ')}" th:text="${#strings.capitalize(prettyField)}"
th:selected='${i=="medium"}'>
</option>
</select>
</td>
<td>
<input type="radio" id="refineBy" name="option1" value="refineBy" onclick="toRefine(1)">
<label for="refine">Refine</label><br>
<input type="radio" id="excludeBy" name="option1" value="excludeBy" onclick="toExclude(1)">
<label for="exclude">Exclude</label><br>
</td>
<td>
<input class="form-control Filter1" type="text" placeholder="Input">
</td>
</tr>
<tr class="Exclude">
<td>
<select class="Filter2">
<option th:each="i : ${fieldList}" th:value="${i}"
th:with="prettyField=${i.replaceAll('_', ' ')}" th:text="${#strings.capitalize(prettyField)}"
th:selected='${i=="medium"}'>
</option>
</select>
</td>
<td>
<input type="radio" id="refine" name="option2" value="refineBy" onclick="toRefine(2)">
<label for="refine">Refine</label><br>
<input type="radio" id="exclude" name="option2" value="excludeBy" onclick="toExclude(2)">
<label for="exclude">Exclude</label><br>
</td>
<td>
<input class="form-control Filter2" type="text" placeholder="Input">
</td>
</tr>
</table>
</form>
</div>

<table class="table" id="filters">
<tr>
<th scope="col">Filter</th>
<th scope="col">Input</th>
</tr>
<tr>
<td>
<select id="field1" name="field1">
<option th:each="i : ${fieldList}" th:value="${i}" th:text="${i}" th:selected='${i=="medium"}'>
</option>
</select>
</td>
<td>
<input id="Input1" name="Input1" class="form-control" type="text" placeholder="Input">
</td>
</tr>
<tr>
<td>
<select id="field2" name="field2">
<option th:each="i : ${fieldList}" th:value="${i}" th:text="${i}" th:selected='${i=="medium"}'>
</option>
</select>
</td>
<td>
<input id="Input2" name="Input2" class="form-control" type="text" placeholder="Input">
</td>
</tr>
<tr>
<td>
<select id="field3" name="field3">
<option selected disabled hidden style='display: none' value=''></option>
<option th:each="i : ${fieldList}" th:value="${i}" th:text="${i}"></option>
</select>
</td>
<td>
<input id="Input3" name="Input3" class="form-control" type="text" placeholder="Input">
</td>
</tr>
</table>

<a href="/infographics" >infographics</a>
</main>

</body>
<script>
function cleanURL() {
let inputs = document.getElementsByClassName("Filter1");
console.log(inputs)
if (inputs[1].value.length === 0 && inputs[1].type !== 'submit') {
inputs[0].disabled = true;
inputs[1].disabled = true;
}
let inputs2 = document.getElementsByClassName("Filter2");
console.log(inputs2)
if (inputs2[1].value.length === 0 && inputs2[1].type !== 'submit') {
inputs2[0].disabled = true;
inputs2[1].disabled = true;
}
}
function toRefine(i) {
let className = "Filter" + i.toString();
console.log(className);
let inputs = document.getElementsByClassName(className);
inputs[0].id = "refineField";
inputs[0].name = "refineField";
inputs[1].id = "refineQ";
inputs[1].name = "refineQ";
}
function toExclude(i) {
let className = "Filter" + i.toString();
console.log(className);
let inputs = document.getElementsByClassName(className);
inputs[0].id = "excludeField";
inputs[0].name = "excludeField";
inputs[1].id = "excludeQ";
inputs[1].name = "excludeQ";
}
</script>

</html>
17 changes: 15 additions & 2 deletions src/main/resources/templates/infographics.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,25 @@
<meta charset="UTF-8">
<title>Infographics</title>
<script src="https://use.fontawesome.com/639e5b5645.js"></script>

<link href="//db.onlinewebfonts.com/c/97294bc26984beb9185137b039854f9b?family=D-DIN" rel="stylesheet" type="text/css"/>
<link href="//db.onlinewebfonts.com/c/8e59fdbc7a7fdb1bab1b12af14615047?family=ITCAvantGardeGothicW05-Book"
rel="stylesheet" type="text/css"/>
<link rel="stylesheet" href="/styles.css">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
</head>

<body>
<div class="BristolMuseum stay">
<a href="/">
<img src="https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Ftse1.mm.bing.net%2Fth%3Fid%3DOIP.OCdb4ZnlSV7vmUEh3SXcjwHaFl%26pid%3DApi&f=1"
alt="Bristol museum logo" height="100">
</a>
<button class="dropdown-btn navBut"><a href="/search"> Back to search</a></button>
</div>
<br>
<br>
<br>
<br>
<div>
<canvas id="myChart"></canvas>
</div>
Expand Down Expand Up @@ -43,7 +56,7 @@
const data = {
labels: datesToInclude,
datasets: [{
label: 'Artworks by time',
label: 'Number of Artworks per year',
backgroundColor: 'rgb(255, 99, 132)',
borderColor: 'rgb(255, 99, 132)',
data: numOfDates,
Expand Down
Loading

0 comments on commit e881866

Please sign in to comment.