Просмотр исходного кода

imprv/115673-128224-create-presentationfile10

Meiri Kikuta 2 лет назад
Родитель
Сommit
3ff51d6253

+ 39 - 1
apps/app/src/client/services/AdminCustomizeContainer.js

@@ -1,3 +1,4 @@
+/* eslint-disable lines-between-class-members */
 import { isServer } from '@growi/core/dist/utils';
 import { isServer } from '@growi/core/dist/utils';
 import { Container } from 'unstated';
 import { Container } from 'unstated';
 
 
@@ -154,7 +155,7 @@ export default class AdminCustomizeContainer extends Container {
   /**
   /**
    * Switch isEnabledMarp
    * Switch isEnabledMarp
    */
    */
-  switchIsEnabledMarp() {
+  switchIsEnabledMarp(inputValue) {
     this.setState({ isEnabledMarp: !this.state.isEnabledMarp });
     this.setState({ isEnabledMarp: !this.state.isEnabledMarp });
   }
   }
 
 
@@ -224,6 +225,43 @@ export default class AdminCustomizeContainer extends Container {
       throw new Error('Failed to update data');
       throw new Error('Failed to update data');
     }
     }
   }
   }
+  /**
+   * Update function
+   * @memberOf AdminCustomizeContainer
+   */
+  async updateCustomizePresentation() {
+    try {
+      const response = await apiv3Put('/customize-setting/presentation', {
+        isEnabledTimeline: this.state.isEnabledTimeline,
+        isEnabledAttachTitleHeader: this.state.isEnabledAttachTitleHeader,
+        pageLimitationS: this.state.pageLimitationS,
+        pageLimitationM: this.state.pageLimitationM,
+        pageLimitationL: this.state.pageLimitationL,
+        pageLimitationXL: this.state.pageLimitationXL,
+        isEnabledStaleNotification: this.state.isEnabledStaleNotification,
+        isAllReplyShown: this.state.isAllReplyShown,
+        isSearchScopeChildrenAsDefault: this.state.isSearchScopeChildrenAsDefault,
+        isEnabledMarp: this.state.isEnabledMarp,
+      });
+      const { customizedParams } = response.data;
+      this.setState({
+        isEnabledTimeline: customizedParams.isEnabledTimeline,
+        isEnabledAttachTitleHeader: customizedParams.isEnabledAttachTitleHeader,
+        pageLimitationS: customizedParams.pageLimitationS,
+        pageLimitationM: customizedParams.pageLimitationM,
+        pageLimitationL: customizedParams.pageLimitationL,
+        pageLimitationXL: customizedParams.pageLimitationXL,
+        isEnabledStaleNotification: customizedParams.isEnabledStaleNotification,
+        isAllReplyShown: customizedParams.isAllReplyShown,
+        isSearchScopeChildrenAsDefault: customizedParams.isSearchScopeChildrenAsDefault,
+        isEnabledMarp: customizedParams.state.isEnabledMarp,
+      });
+    }
+    catch (err) {
+      logger.error(err);
+      throw new Error('Failed to update data');
+    }
+  }
 
 
   /**
   /**
    * Update customTitle
    * Update customTitle

+ 6 - 6
apps/app/src/components/Admin/Customize/CustomizePresentationSetting.tsx

@@ -37,24 +37,24 @@ const CustomizeFunctionSettingPresentation = (props: Props): JSX.Element => {
       <div className="form-group row">
       <div className="form-group row">
         <div className="offset-md-3 col-md-6 text-left">
         <div className="offset-md-3 col-md-6 text-left">
             optionId="isEnabledMarp"
             optionId="isEnabledMarp"
-            label={t('admin:customize_settings.function_options.enable_marp')}
+            label={t('admin:customize_settings.presentation_options.enable_marp')}
             isChecked={adminCustomizeContainer.state.isEnabledMarp || false}
             isChecked={adminCustomizeContainer.state.isEnabledMarp || false}
             onChecked={() => { adminCustomizeContainer.switchIsEnabledMarp() }}
             onChecked={() => { adminCustomizeContainer.switchIsEnabledMarp() }}
           <p className="form-text text-muted">
           <p className="form-text text-muted">
-            {t('admin:customize_settings.function_options.enable_marp_desc')}
+            {t('admin:customize_settings.presentation_options.enable_marp_desc')}
             <br></br>
             <br></br>
             <a
             <a
-              href={`${t('admin:customize_settings.function_options.marp_official_site_link')}`}
+              href={`${t('admin:customize_settings.presentation_options.marp_official_site_link')}`}
               target="_blank"
               target="_blank"
               rel="noopener noreferrer"
               rel="noopener noreferrer"
-            >{`${t('admin:customize_settings.function_options.marp_official_site')}`}
+            >{`${t('admin:customize_settings.presentation_options.marp_official_site')}`}
             </a>
             </a>
             <br></br>
             <br></br>
             <a
             <a
               href={`${t('admin:customize_settings.function_options.marp_in_gorwi_link')}`}
               href={`${t('admin:customize_settings.function_options.marp_in_gorwi_link')}`}
               target="_blank"
               target="_blank"
               rel="noopener noreferrer"
               rel="noopener noreferrer"
-            >{`${t('admin:customize_settings.function_options.marp_in_growi')}`}
+            >{`${t('admin:customize_settings.presentation_options.marp_in_growi')}`}
             </a>
             </a>
           </p>
           </p>
 
 
@@ -66,6 +66,6 @@ const CustomizeFunctionSettingPresentation = (props: Props): JSX.Element => {
     </React.Fragment>
     </React.Fragment>
   );
   );
 };
 };
-const CustomizePresentationSettingWrapper = withUnstatedContainers(CustomizeFunctionSettingPresentation, [AdminCustomizeContainer]);
+const CustomizePresentationSettingWrapper = withUnstatedContainers(CustomizeSettingPresentation, [AdminCustomizeContainer]);
 
 
 export default CustomizePresentationSettingWrapper;
 export default CustomizePresentationSettingWrapper;