Sfoglia il codice sorgente

Merge pull request #1116 from weseek/fix/search-result

Fix/search result
Yuki Takei 6 anni fa
parent
commit
c51a22a529

+ 1 - 0
CHANGES.md

@@ -2,6 +2,7 @@
 
 ## 3.5.3-RC
 
+* Fix: Search Result Page doesn't work
 * Fix: Create/Update page API returns data includes author's password hash
 
 ## 3.5.2

+ 0 - 0
src/client/js/components/PageList/ListView.js → src/client/js/components/PageList/ListView.jsx


+ 9 - 1
src/client/js/components/PageList/Page.js → src/client/js/components/PageList/Page.jsx

@@ -18,6 +18,8 @@ export default class Page extends React.Component {
       flex: 1,
     };
 
+    const hasChildren = this.props.children != null;
+
     return (
       <li className="page-list-li d-flex align-items-center">
         <UserPicture user={page.lastUpdateUser} />
@@ -25,7 +27,12 @@ export default class Page extends React.Component {
           <PagePath page={page} excludePathString={this.props.excludePathString} />
         </a>
         <PageListMeta page={page} />
-        <div style={styleFlex}></div>
+        { hasChildren && (
+          <React.Fragment>
+            <a style={styleFlex} href={link}>&nbsp;</a>
+            {this.props.children}
+          </React.Fragment>
+        ) }
       </li>
     );
   }
@@ -36,6 +43,7 @@ Page.propTypes = {
   page: PropTypes.object.isRequired,
   linkTo: PropTypes.string,
   excludePathString: PropTypes.string,
+  children: PropTypes.array,
 };
 
 Page.defaultProps = {

+ 0 - 0
src/client/js/components/PageList/PageListMeta.js → src/client/js/components/PageList/PageListMeta.jsx


+ 0 - 0
src/client/js/components/PageList/PagePath.js → src/client/js/components/PageList/PagePath.jsx


+ 0 - 0
src/client/js/components/SearchPage/DeletePageListModal.js → src/client/js/components/SearchPage/DeletePageListModal.jsx


+ 0 - 0
src/client/js/components/SearchPage/SearchPageForm.js → src/client/js/components/SearchPage/SearchPageForm.jsx


+ 0 - 0
src/client/js/components/SearchPage/SearchResult.js → src/client/js/components/SearchPage/SearchResult.jsx


+ 2 - 2
src/client/js/components/SearchPage/SearchResultList.js → src/client/js/components/SearchPage/SearchResultList.jsx

@@ -16,8 +16,8 @@ class SearchResultList extends React.Component {
   render() {
     const resultList = this.props.pages.map((page) => {
       return (
-        <div id={page._id} key={page._id} className="search-result-page">
-          <h2 className="inline"><a href={page.path}>{page.path}</a></h2>
+        <div id={page._id} key={page._id} className="search-result-page mb-5">
+          <h2><a href={page.path}>{page.path}</a></h2>
           { page.tags.length > 0 && (
             <span><i className="tag-icon icon-tag"></i> {page.tags.join(', ')}</span>
           )}

+ 6 - 4
src/client/styles/scss/_search.scss

@@ -148,7 +148,7 @@
       padding-right: 0;
 
       &.affix {
-        top: 58px;
+        top: 64px;
         width: 33%;
         height: 100%;
         padding-right: 5px;
@@ -188,9 +188,8 @@
       margin-top: -48px;
 
       > h2 {
-        display: inline;
         margin-right: 10px;
-        font-size: 20px;
+        font-size: 22px;
         line-height: 1em;
       }
 
@@ -212,7 +211,10 @@
   position: sticky;
   top: 0;
   z-index: 99;
-  padding: 10px 0;
+
+  // for sticky layout
+  padding-top: 15px;
+  margin-bottom: 15px;
 
   .input-group-btn .btn {
     height: 34px;

+ 1 - 1
src/server/views/search.html

@@ -14,7 +14,7 @@
 <div class="container-fluid">
 
   <div class="row">
-    <div id="main" class="main m-t-15 col-md-12 search-page">
+    <div id="main" class="main col-md-12 search-page">
       <div class="" id="search-page"></div>
     </div>
   </div>