Merge pull request #7 from felizbear/search-fix

Fix bugs in search front-end
This commit is contained in:
Alexander 2015-12-16 13:09:43 +09:00
commit 29da337871
3 changed files with 30 additions and 5 deletions

View file

@ -71,13 +71,18 @@ angular.module('zeppelinWebApp').controller('NotebookCtrl',
var currentRoute = $route.current;
if (currentRoute) {
var routeParams = currentRoute.params;
var id = '#' + routeParams.paragraph + '_container';
setTimeout(
function() {
// adjust for navbar
var top = $(id).offset().top - 103;
$('html, body').scrollTo({top: top, left: 0});
var routeParams = currentRoute.params;
var $id = $('#' + routeParams.paragraph + '_container');
if ($id.length > 0) {
// adjust for navbar
var top = $id.offset().top - 103;
$('html, body').scrollTo({top: top, left: 0});
}
},
1000
);

View file

@ -22,6 +22,12 @@ angular
results.$promise.then(function(result) {
$scope.notes = result.body.map(function(note) {
// redirect to notebook when search result is a notebook itself,
// not a paragraph
if (!/\/paragraph\//.test(note.id)) {
return note;
}
note.id = note.id.replace('paragraph/', '?paragraph=') +
'&term=' +
$routeParams.searchTerm;

View file

@ -1,3 +1,17 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
.search-results {
list-style-type: none;
margin: 10% auto 0;