Yuki Takei 7 лет назад
Родитель
Сommit
1464065653
2 измененных файлов с 21 добавлено и 21 удалено
  1. 21 20
      resource/js/app.js
  2. 0 1
      resource/js/components/PageEditor/GrantSelector.js

+ 21 - 20
resource/js/app.js

@@ -187,32 +187,33 @@ if (pageEditorOptionsSelectorElem) {
   );
 }
 // render GrantSelector
-const userRelatedGroupsElem = document.getElementById('user-related-group-data');
 const pageEditorGrantSelectorElem = document.getElementById('page-grant-selector');
-const pageGrantElem = document.getElementById('page-grant');
-const pageGrantGroupElem = document.getElementById('grant-group');
-function updatePageGrantElem(pageGrant) {
-  pageGrantElem.value = pageGrant;
-}
-function updatePageGrantGroupElem(pageGrantGroupId) {
-  pageGrantGroupElem.value = pageGrantGroupId;
-}
 if (pageEditorGrantSelectorElem) {
-  let userRelatedGroups;
-  if (userRelatedGroupsElem != null) {
-    let userRelatedGroupsJSONString = userRelatedGroupsElem.textContent;
-    if (userRelatedGroupsJSONString != null && userRelatedGroupsJSONString.length > 0) {
-      userRelatedGroups = JSON.parse(userRelatedGroupsJSONString || '{}', (value) => {
-        return new UserGroup(value);
-      });
-    }
+  // let userRelatedGroups;
+  // if (userRelatedGroupsElem != null) {
+  //   let userRelatedGroupsJSONString = userRelatedGroupsElem.textContent;
+  //   if (userRelatedGroupsJSONString != null && userRelatedGroupsJSONString.length > 0) {
+  //     userRelatedGroups = JSON.parse(userRelatedGroupsJSONString || '{}', (value) => {
+  //       return new UserGroup(value);
+  //     });
+  //   }
+  // }
+  const pageGrantElem = document.getElementById('page-grant');
+  const pageGrantGroupElem = document.getElementById('grant-group');
+  /* eslint-disable no-inner-declarations */
+  function updatePageGrantElem(pageGrant) {
+    pageGrantElem.value = pageGrant;
+  }
+  function updatePageGrantGroupElem(pageGrantGroupId) {
+    pageGrantGroupElem.value = pageGrantGroupId;
   }
-  pageGrant = +(document.getElementById('page-grant').value);
-  const pageGrantGroup = JSON.parse(document.getElementById('grant-group').textContent || '{}');
+  /* eslint-enable */
+  pageGrant = +(pageGrantElem.value);
+  const pageGrantGroup = JSON.parse(pageGrantGroupElem.textContent || '{}');
   ReactDOM.render(
     <I18nextProvider i18n={i18n}>
       <GrantSelector crowi={crowi}
-        userRelatedGroups={userRelatedGroups} pageGrant={pageGrant} pageGrantGroup={pageGrantGroup}
+        pageGrant={pageGrant} pageGrantGroup={pageGrantGroup}
         onChangePageGrant={updatePageGrantElem}
         onDeterminePageGrantGroupId={updatePageGrantGroupElem} />
     </I18nextProvider>,

+ 0 - 1
resource/js/components/PageEditor/GrantSelector.js

@@ -168,7 +168,6 @@ GrantSelector.propTypes = {
   t: PropTypes.func.isRequired,               // i18next
   crowi: PropTypes.object.isRequired,
   isGroupModalShown: PropTypes.bool,
-  userRelatedGroups: PropTypes.object,
   pageGrant: PropTypes.number,
   pageGrantGroup: PropTypes.object,
   onChangePageGrant: PropTypes.func,