Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<div id="searchHowTo"></div>
<p>This is a test, this is ONLY a test....</p>
<fieldset>
<form id="dropDowns">
<form id="dropdowns">
<div id= "rovers">
<label>Rovers</label>
<select id="rover">
Expand All @@ -59,7 +59,7 @@

<div id= "dates">
<label>Date(yyyy-mm-dd)</label>
<input type="text" name ="dateInput" required>
<input id="date" type="text" name ="dateInput" required>
</div>

<button id ="searchButton" type="submit">SEARCH</button>
Expand Down
18 changes: 14 additions & 4 deletions models/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,20 @@ const API_URL = 'http://localhost:3000/api/v1';
Image.all = [];

Image.fetchImages = (cb) => {
let camShort = '';
if($('#camera option:selected').text() == 'Navigation') {
camShort = "navcam";
}else if($('#camera option:selected').text() == 'Front Hazard') {
camShort = "fhaz";
}else{
camShort = "rhaz";
}


const options = {
rover: 'curiosity',
camera: 'fhaz',
date: '2015-12-13'
rover: $('#rover option:selected').text(),
camera: camShort,
date: $('#date').val()
}
$.get(`${API_URL}/nasa`, options)
.then(Image.loadAll)
Expand All @@ -28,7 +38,7 @@ const API_URL = 'http://localhost:3000/api/v1';
Image.loadAll = (data) => {
Image.all = data.map(obj => new Image(obj));
console.log(Image.all);
//app.imageView.initDiscoverPage();
app.imageView.initDiscoverPage();
}

Image.prototype.toHtml = function () {
Expand Down
11 changes: 3 additions & 8 deletions views/imageView.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,11 @@ var app = app || {};
$('main section').hide();
$('#photos').show();

$('#dropDowns').on('submit', (e) => {
$('#dropdowns').on('submit', (e) => {
e.preventDefault();
const object = {
rover: $('#dropDowns select[value="rover"]').value(),
// camera: $('#dropDowns select[name="camera"]').value(),
// date: $('#dropDowns input[name = "dateInput"]').val()
};
console.log(object);
app.Image.fetchImages();
})
// app.Image.all.map(image => $('#photos').append(image.toHtml()));
app.Image.all.map(image => $('#photos').append(image.toHtml()));
};

imageView.initHomePage = () => {
Expand Down