Răsfoiți Sursa

Merge pull request #76 from weseek/master

release v1.1.8
Yuki Takei 9 ani în urmă
părinte
comite
8cced22e70

+ 6 - 0
CHANGES.md

@@ -1,6 +1,12 @@
 CHANGES
 ========
 
+## 1.1.8
+
+* Fix: Depth of dropdown-menu when '.on-edit'
+* Fix: Error occured on saveing with Ctrl+S
+* Fix: Guest users browsing
+
 ## 1.1.7
 
 * Feature: Add option to allow guest users to browse

+ 1 - 0
README.md

@@ -25,6 +25,7 @@ This is **crowi-plus** that is the fork of [Crowi][crowi], is [perfectly compati
 * [Docker Ready][dockerhub]
 * [Docker Compose Ready][docker-compose]
   * [Multiple sites example](https://github.com/weseek/crowi-plus-docker-compose/tree/master/examples/multi-app)
+  * [HTTPS(with Let's Encrypt) proxy integration example](https://github.com/weseek/crowi-plus-docker-compose/tree/master/examples/https-portal)
 * [Added miscellaneous features](https://github.com/weseek/crowi-plus/wiki/Additional-Features)
 * Developer-friendly
   * Less compile time

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "crowi-plus",
-  "version": "1.1.7-RC",
+  "version": "1.1.8-RC",
   "description": "Enhanced Crowi",
   "tags": [
     "wiki",

+ 4 - 0
resource/css/_form.scss

@@ -12,6 +12,10 @@
   .nav {
     margin-top: 8px;
     height: 40px;
+
+    .dropdown-menu {
+      z-index: 1060;
+    }
   }
 
   .tab-content {

+ 6 - 2
resource/js/components/BookmarkButton.js

@@ -17,7 +17,7 @@ export default class BookmarkButton extends React.Component {
 
   componentDidMount() {
     // if guest user
-    if (this.props.crowi.me === "") {
+    if (!this.isUserLoggedIn()) {
       // do nothing
       return;
     }
@@ -56,9 +56,13 @@ export default class BookmarkButton extends React.Component {
     this.setState({bookmarked: false});
   }
 
+  isUserLoggedIn() {
+    return this.props.crowi.me !== '';
+  }
+
   render() {
     // if guest user
-    if (this.props.crowi.me === "") {
+    if (!this.isUserLoggedIn()) {
       return <div></div>;
     }
 

+ 30 - 16
resource/js/components/PageAttachment.js

@@ -79,24 +79,23 @@ export default class PageAttachment extends React.Component {
     });
   }
 
-  render() {
-    const attachmentToDelete = this.state.attachmentToDelete;
-    let deleteModalClose = () => this.setState({ attachmentToDelete: null });
-    let showModal = attachmentToDelete !== null;
+  isUserLoggedIn() {
+    return this.props.crowi.me !== '';
+  }
 
-    let deleteInUse = null;
-    if (attachmentToDelete !== null) {
-      deleteInUse = this.state.inUse[attachmentToDelete._id] || false;
-    }
+  render() {
+    let deleteAttachmentModal = '';
+    if (this.isUserLoggedIn()) {
+      const attachmentToDelete = this.state.attachmentToDelete;
+      let deleteModalClose = () => this.setState({ attachmentToDelete: null });
+      let showModal = attachmentToDelete !== null;
+
+      let deleteInUse = null;
+      if (attachmentToDelete !== null) {
+        deleteInUse = this.state.inUse[attachmentToDelete._id] || false;
+      }
 
-    return (
-      <div>
-        <p>Attachments</p>
-        <PageAttachmentList
-          attachments={this.state.attachments}
-          inUse={this.state.inUse}
-          onAttachmentDeleteClicked={this.onAttachmentDeleteClicked}
-        />
+      deleteAttachmentModal = (
         <DeleteAttachmentModal
           show={showModal}
           animation={false}
@@ -108,6 +107,21 @@ export default class PageAttachment extends React.Component {
           deleteError={this.state.deleteError}
           onAttachmentDeleteClickedConfirm={this.onAttachmentDeleteClickedConfirm}
         />
+      );
+    }
+
+
+    return (
+      <div>
+        <p>Attachments</p>
+        <PageAttachmentList
+          attachments={this.state.attachments}
+          inUse={this.state.inUse}
+          onAttachmentDeleteClicked={this.onAttachmentDeleteClicked}
+          isUserLoggedIn={this.isUserLoggedIn()}
+        />
+
+        {deleteAttachmentModal}
       </div>
     );
   }

+ 6 - 1
resource/js/components/PageAttachment/Attachment.js

@@ -35,6 +35,10 @@ export default class Attachment extends React.Component {
 
     const fileType = <span className="attachment-filetype label label-default">{attachment.fileFormat}</span>;
 
+    const btnTrash = (this.props.isUserLoggedIn)
+        ? <a className="text-danger attachment-delete" onClick={this._onAttachmentDeleteClicked}><Icon name="trash-o" /></a>
+        : '';
+
     return (
       <li>
           <User user={attachment.creator} />
@@ -46,7 +50,7 @@ export default class Attachment extends React.Component {
 
           {fileInUse}
 
-          <a className="text-danger attachment-delete" onClick={this._onAttachmentDeleteClicked}><Icon name="trash-o" /></a>
+          {btnTrash}
       </li>
     );
   }
@@ -56,6 +60,7 @@ Attachment.propTypes = {
   attachment: PropTypes.object.isRequired,
   inUse: PropTypes.bool.isRequired,
   onAttachmentDeleteClicked: PropTypes.func.isRequired,
+  isUserLoggedIn: PropTypes.bool.isRequired,
 };
 
 Attachment.defaultProps = {

+ 1 - 0
resource/js/components/PageAttachment/PageAttachmentList.js

@@ -16,6 +16,7 @@ export default class PageAttachmentList extends React.Component {
           attachment={attachment}
           inUse={this.props.inUse[attachment._id] || false}
           onAttachmentDeleteClicked={this.props.onAttachmentDeleteClicked}
+          isUserLoggedIn={this.props.isUserLoggedIn}
          />
       );
     });

+ 23 - 6
resource/js/legacy/crowi-form.js

@@ -377,15 +377,33 @@ $(function() {
     const revisionInput = $('#page-form [name="pageForm[currentRevision]"]');
 
     // generate data to post
-    let data = {
-      page_id: pageId,
-      revision_id: revisionInput.val(),
-      body: $('#form-body').val(),
+    const body = $('#form-body').val();
+    let endpoint;
+    let data;
+
+    // update
+    if (pageId) {
+      endpoint = '/pages.update';
+      data = {
+        page_id: pageId,
+        revision_id: revisionInput.val(),
+        body: body,
+      };
+    }
+    // create
+    else {
+      endpoint = '/pages.create';
+      data = {
+        path: pagePath,
+        body: body,
+      };
     }
 
-    crowi.apiPost('/pages.update', data)
+    crowi.apiPost(endpoint, data)
       .then((res) => {
         let page = res.page;
+        pageId = page._id
+
         toastr.success(undefined, 'Saved successful', {
           closeButton: true,
           progressBar: true,
@@ -412,7 +430,6 @@ $(function() {
           timeOut: "3000",
         });
       });
-
   }
 
   // markdown helper inspired by 'esarea'.