Yuki Takei 7 лет назад
Родитель
Сommit
9b81f3dc0a

+ 7 - 3
resource/js/app.js

@@ -199,12 +199,15 @@ const errorHandler = function(error) {
 };
 };
 
 
 const saveWithShortcut = function(markdown) {
 const saveWithShortcut = function(markdown) {
+  // get options
+  const options = componentInstances.savePageControls.getCurrentOptionsToSave();
+
   let promise = undefined;
   let promise = undefined;
   if (pageId == null) {
   if (pageId == null) {
-    promise = crowi.createPage(pagePath, markdown, {});
+    promise = crowi.createPage(pagePath, markdown, options);
   }
   }
   else {
   else {
-    promise = crowi.updatePage(pageId, pageRevisionId, markdown, {});
+    promise = crowi.updatePage(pageId, pageRevisionId, markdown, options);
   }
   }
 
 
   promise
   promise
@@ -212,7 +215,8 @@ const saveWithShortcut = function(markdown) {
     .catch(errorHandler);
     .catch(errorHandler);
 };
 };
 
 
-const saveWithSubmitButton = function(options) {
+const saveWithSubmitButton = function() {
+  const options = componentInstances.savePageControls.getCurrentOptionsToSave();
   console.log(options);
   console.log(options);
 };
 };
 
 

+ 8 - 4
resource/js/components/SavePageControls.jsx

@@ -14,12 +14,19 @@ class SavePageControls extends React.PureComponent {
       pageId: this.props.pageId,
       pageId: this.props.pageId,
     };
     };
 
 
+    this.getCurrentOptionsToSave = this.getCurrentOptionsToSave.bind(this);
     this.submit = this.submit.bind(this);
     this.submit = this.submit.bind(this);
   }
   }
 
 
   componentWillMount() {
   componentWillMount() {
   }
   }
 
 
+  getCurrentOptionsToSave() {
+    const slackNotificationOptions = this.refs.slackNotification.getCurrentOptionsToSave();
+    const grantSelectorOptions = this.refs.grantSelector.getCurrentOptionsToSave();
+    return Object.assign(slackNotificationOptions, grantSelectorOptions);
+  }
+
   /**
   /**
    * update pageId of state
    * update pageId of state
    * @param {string} pageId
    * @param {string} pageId
@@ -29,10 +36,7 @@ class SavePageControls extends React.PureComponent {
   }
   }
 
 
   submit() {
   submit() {
-    const slackNotificationOptions = this.refs.slackNotification.getCurrentOptionsToSave();
-    const grantSelectorOptions = this.refs.grantSelector.getCurrentOptionsToSave();
-    const options = Object.assign(slackNotificationOptions, grantSelectorOptions);
-    this.props.onSubmit(options);
+    this.props.onSubmit();
   }
   }
 
 
   render() {
   render() {

+ 1 - 1
resource/js/components/SavePageControls/GrantSelector.jsx

@@ -80,7 +80,7 @@ class GrantSelector extends React.Component {
       grant: this.state.grant
       grant: this.state.grant
     };
     };
     if (this.state.grantGroup != null) {
     if (this.state.grantGroup != null) {
-      options.grantGroup = this.state.grantGroup._id;
+      options.grantUserGroupId = this.state.grantGroup._id;
     }
     }
     return options;
     return options;
   }
   }