update the search UI
This commit is contained in:
@@ -387,6 +387,11 @@ ul {
|
|||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.big-text-field {
|
||||||
|
font-size: 30px;
|
||||||
|
height: 57px;
|
||||||
|
}
|
||||||
|
|
||||||
.table {
|
.table {
|
||||||
margin-left: -16px;
|
margin-left: -16px;
|
||||||
}
|
}
|
||||||
|
@@ -1,8 +1,10 @@
|
|||||||
extends ../layout
|
extends ../layout
|
||||||
block content
|
block content
|
||||||
|
script(src='/js/lib/moment/moment.js')
|
||||||
script.
|
script.
|
||||||
var challengeName = 'Camper News';
|
var challengeName = 'Camper News';
|
||||||
var user = !{JSON.stringify(user)};
|
var user = !{JSON.stringify(user)};
|
||||||
|
var page = !{JSON.stringify(page)};
|
||||||
.panel.panel-info
|
.panel.panel-info
|
||||||
.panel-heading.text-center Camper News
|
.panel-heading.text-center Camper News
|
||||||
.panel-body
|
.panel-body
|
||||||
|
@@ -1,10 +1,27 @@
|
|||||||
input#searchArea(type=text)
|
.col-xs-12
|
||||||
button#searchbutton
|
.spacer
|
||||||
|
.input-group
|
||||||
|
input#searchArea.big-text-field.form-control(type='text', placeholder='Search for...', autofocus)
|
||||||
|
span.input-group-btn
|
||||||
|
button#searchbutton.btn.btn-big.btn-primary(type='button') Search
|
||||||
|
.spacer
|
||||||
|
|
||||||
#story-list
|
#story-list
|
||||||
ul#stories
|
ul#stories
|
||||||
script.
|
script.
|
||||||
|
$('#searchArea').keypress(function(event) {
|
||||||
|
if (event.keyCode === 13 || event.which === 13) {
|
||||||
|
executeSearch();
|
||||||
|
$('#searchArea').focus();
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
});
|
||||||
$('#searchbutton').on('click', function() {
|
$('#searchbutton').on('click', function() {
|
||||||
|
executeSearch();
|
||||||
|
});
|
||||||
|
function executeSearch() {
|
||||||
$('#stories').empty();
|
$('#stories').empty();
|
||||||
|
console.log('clicked or enter button');
|
||||||
var searchTerm = $('#searchArea').val();
|
var searchTerm = $('#searchArea').val();
|
||||||
var getLinkedName = function getLinkedName(name) {
|
var getLinkedName = function getLinkedName(name) {
|
||||||
return name.toLowerCase().replace(/\s/g, '-');
|
return name.toLowerCase().replace(/\s/g, '-');
|
||||||
@@ -17,10 +34,8 @@ script.
|
|||||||
})
|
})
|
||||||
.fail(function (xhr, textStatus, errorThrown) {
|
.fail(function (xhr, textStatus, errorThrown) {
|
||||||
console.log('failure');
|
console.log('failure');
|
||||||
//$('#comment-button').bind('click', commentSubmitButtonHandler);
|
|
||||||
})
|
})
|
||||||
.done(function (data, textStatus, xhr) {
|
.done(function (data, textStatus, xhr) {
|
||||||
console.log(data);
|
|
||||||
for (var i = 0; i < data.length; i++) {
|
for (var i = 0; i < data.length; i++) {
|
||||||
var li = document.createElement('li');
|
var li = document.createElement('li');
|
||||||
var linkedName = getLinkedName(data[i].storyLink);
|
var linkedName = getLinkedName(data[i].storyLink);
|
||||||
@@ -55,4 +70,5 @@ script.
|
|||||||
$(li).appendTo($('#stories'));
|
$(li).appendTo($('#stories'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
}
|
Reference in New Issue
Block a user