Ver código fonte

rename switch dropdown methods not to be too long

kaoritokashiki 5 anos atrás
pai
commit
6513ebb455

+ 26 - 27
src/client/js/components/Admin/Customize/CustomizeFunctionSetting.jsx

@@ -124,64 +124,63 @@ class CustomizeFunctionSetting extends React.Component {
               </div>
               </div>
             </div>
             </div>
 
 
-            {/* User Page */}
+            {/* S: Modal */}
             <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">
                 <div className="my-0 w-100">
                 <div className="my-0 w-100">
-                  <label>{t('admin:customize_setting.function_options.list_num_desc_in_user_page')}</label>
+                  <label>{t('admin:customize_setting.function_options.list_num_desc_in_page_contents_modal')}</label>
                 </div>
                 </div>
-                <Dropdown isOpen={this.state.isDropdownOpen} toggle={this.onToggleDropdown}>
+                <Dropdown isOpen={this.state.isDropdownOpen4} toggle={this.onToggleDropdown4}>
                   <DropdownToggle className="text-right col-6" caret>
                   <DropdownToggle className="text-right col-6" caret>
                     <span className="float-left">{adminCustomizeContainer.state.pageListLimitForUserPage}</span>
                     <span className="float-left">{adminCustomizeContainer.state.pageListLimitForUserPage}</span>
                   </DropdownToggle>
                   </DropdownToggle>
                   <DropdownMenu className="dropdown-menu" role="menu">
                   <DropdownMenu className="dropdown-menu" role="menu">
-                    <DropdownItem key={10} role="presentation" onClick={() => { adminCustomizeContainer.switchPageListLimitForUserPage(10) }}>
+                    <DropdownItem key={10} role="presentation" onClick={() => { adminCustomizeContainer.switchGroupSPageListLimitation(10) }}>
                       <a role="menuitem">10</a>
                       <a role="menuitem">10</a>
                     </DropdownItem>
                     </DropdownItem>
-                    <DropdownItem key={30} role="presentation" onClick={() => { adminCustomizeContainer.switchPageListLimitForUserPage(30) }}>
+                    <DropdownItem key={30} role="presentation" onClick={() => { adminCustomizeContainer.switchGroupSPageListLimitation(30) }}>
                       <a role="menuitem">30</a>
                       <a role="menuitem">30</a>
                     </DropdownItem>
                     </DropdownItem>
-                    <DropdownItem key={50} role="presentation" onClick={() => { adminCustomizeContainer.switchPageListLimitForUserPage(50) }}>
+                    <DropdownItem key={50} role="presentation" onClick={() => { adminCustomizeContainer.switchGroupSPageListLimitation(50) }}>
                       <a role="menuitem">50</a>
                       <a role="menuitem">50</a>
                     </DropdownItem>
                     </DropdownItem>
                   </DropdownMenu>
                   </DropdownMenu>
                 </Dropdown>
                 </Dropdown>
                 <p className="form-text text-muted">
                 <p className="form-text text-muted">
-                  {t('admin:customize_setting.function_options.all_list_num_desc_in_user_page')}
+                  {t('admin:customize_setting.function_options.all_list_num_desc_in_page_contents_modal')}
                 </p>
                 </p>
               </div>
               </div>
             </div>
             </div>
 
 
-            {/* TODO Implemetn dropdown toggle for pageListLimitForModal (pageList pageTimelin pageHistory, pageAttachment, shareLink) */}
-            {/* NotFound / Trash Page */}
+            {/* M: User Page */}
             <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">
                 <div className="my-0 w-100">
                 <div className="my-0 w-100">
-                  <label>{t('admin:customize_setting.function_options.list_num_desc_in_notfound_and_trash_pages')}</label>
+                  <label>{t('admin:customize_setting.function_options.list_num_desc_in_user_page')}</label>
                 </div>
                 </div>
-                <Dropdown isOpen={this.state.isDropdownOpen2} toggle={this.onToggleDropdown2}>
+                <Dropdown isOpen={this.state.isDropdownOpen} toggle={this.onToggleDropdown}>
                   <DropdownToggle className="text-right col-6" caret>
                   <DropdownToggle className="text-right col-6" caret>
                     <span className="float-left">{adminCustomizeContainer.state.pageListLimitForUserPage}</span>
                     <span className="float-left">{adminCustomizeContainer.state.pageListLimitForUserPage}</span>
                   </DropdownToggle>
                   </DropdownToggle>
                   <DropdownMenu className="dropdown-menu" role="menu">
                   <DropdownMenu className="dropdown-menu" role="menu">
-                    <DropdownItem key={10} role="presentation" onClick={() => { adminCustomizeContainer.switchPageListLimitForUserPage(10) }}>
+                    <DropdownItem key={10} role="presentation" onClick={() => { adminCustomizeContainer.switchGroupMPageListLimitation(10) }}>
                       <a role="menuitem">10</a>
                       <a role="menuitem">10</a>
                     </DropdownItem>
                     </DropdownItem>
-                    <DropdownItem key={30} role="presentation" onClick={() => { adminCustomizeContainer.switchPageListLimitForUserPage(30) }}>
+                    <DropdownItem key={30} role="presentation" onClick={() => { adminCustomizeContainer.switchGroupMPageListLimitation(30) }}>
                       <a role="menuitem">30</a>
                       <a role="menuitem">30</a>
                     </DropdownItem>
                     </DropdownItem>
-                    <DropdownItem key={50} role="presentation" onClick={() => { adminCustomizeContainer.switchPageListLimitForUserPage(50) }}>
+                    <DropdownItem key={50} role="presentation" onClick={() => { adminCustomizeContainer.switchGroupMPageListLimitation(50) }}>
                       <a role="menuitem">50</a>
                       <a role="menuitem">50</a>
                     </DropdownItem>
                     </DropdownItem>
                   </DropdownMenu>
                   </DropdownMenu>
                 </Dropdown>
                 </Dropdown>
                 <p className="form-text text-muted">
                 <p className="form-text text-muted">
-                  {t('admin:customize_setting.function_options.all_list_num_desc_in_notfound_and_trash_pages')}
+                  {t('admin:customize_setting.function_options.all_list_num_desc_in_user_page')}
                 </p>
                 </p>
               </div>
               </div>
             </div>
             </div>
 
 
-            {/* Search / Draft Page */}
+            {/* L: Search / Draft Pages */}
             <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">
                 <div className="my-0 w-100">
                 <div className="my-0 w-100">
@@ -192,13 +191,13 @@ class CustomizeFunctionSetting extends React.Component {
                     <span className="float-left">{adminCustomizeContainer.state.pageListLimitForUserPage}</span>
                     <span className="float-left">{adminCustomizeContainer.state.pageListLimitForUserPage}</span>
                   </DropdownToggle>
                   </DropdownToggle>
                   <DropdownMenu className="dropdown-menu" role="menu">
                   <DropdownMenu className="dropdown-menu" role="menu">
-                    <DropdownItem key={10} role="presentation" onClick={() => { adminCustomizeContainer.switchPageListLimitForUserPage(10) }}>
+                    <DropdownItem key={10} role="presentation" onClick={() => { adminCustomizeContainer.switchGroupLPageListLimitation(10) }}>
                       <a role="menuitem">10</a>
                       <a role="menuitem">10</a>
                     </DropdownItem>
                     </DropdownItem>
-                    <DropdownItem key={30} role="presentation" onClick={() => { adminCustomizeContainer.switchPageListLimitForUserPage(30) }}>
+                    <DropdownItem key={30} role="presentation" onClick={() => { adminCustomizeContainer.switchGroupLPageListLimitation(30) }}>
                       <a role="menuitem">30</a>
                       <a role="menuitem">30</a>
                     </DropdownItem>
                     </DropdownItem>
-                    <DropdownItem key={50} role="presentation" onClick={() => { adminCustomizeContainer.switchPageListLimitForUserPage(50) }}>
+                    <DropdownItem key={50} role="presentation" onClick={() => { adminCustomizeContainer.switchGroupLPageListLimitation(50) }}>
                       <a role="menuitem">50</a>
                       <a role="menuitem">50</a>
                     </DropdownItem>
                     </DropdownItem>
                   </DropdownMenu>
                   </DropdownMenu>
@@ -209,30 +208,30 @@ class CustomizeFunctionSetting extends React.Component {
               </div>
               </div>
             </div>
             </div>
 
 
-            {/* Modal */}
+            {/* XL: NotFound / Trash Pages */}
             <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">
                 <div className="my-0 w-100">
                 <div className="my-0 w-100">
-                  <label>{t('admin:customize_setting.function_options.list_num_desc_in_page_contents_modal')}</label>
+                  <label>{t('admin:customize_setting.function_options.list_num_desc_in_notfound_and_trash_pages')}</label>
                 </div>
                 </div>
-                <Dropdown isOpen={this.state.isDropdownOpen4} toggle={this.onToggleDropdown4}>
+                <Dropdown isOpen={this.state.isDropdownOpen2} toggle={this.onToggleDropdown2}>
                   <DropdownToggle className="text-right col-6" caret>
                   <DropdownToggle className="text-right col-6" caret>
-                    <span className="float-left">{adminCustomizeContainer.state.pageListLimitForUserPage}</span>
+                    <span className="float-left">{adminCustomizeContainer.state.pageListLimitForNotFoundAndTrashPage}</span>
                   </DropdownToggle>
                   </DropdownToggle>
                   <DropdownMenu className="dropdown-menu" role="menu">
                   <DropdownMenu className="dropdown-menu" role="menu">
-                    <DropdownItem key={10} role="presentation" onClick={() => { adminCustomizeContainer.switchPageListLimitForUserPage(10) }}>
+                    <DropdownItem key={10} role="presentation" onClick={() => { adminCustomizeContainer.switchGroupXLPageListLimitation(10) }}>
                       <a role="menuitem">10</a>
                       <a role="menuitem">10</a>
                     </DropdownItem>
                     </DropdownItem>
-                    <DropdownItem key={30} role="presentation" onClick={() => { adminCustomizeContainer.switchPageListLimitForUserPage(30) }}>
+                    <DropdownItem key={30} role="presentation" onClick={() => { adminCustomizeContainer.switchGroupXLPageListLimitation(30) }}>
                       <a role="menuitem">30</a>
                       <a role="menuitem">30</a>
                     </DropdownItem>
                     </DropdownItem>
-                    <DropdownItem key={50} role="presentation" onClick={() => { adminCustomizeContainer.switchPageListLimitForUserPage(50) }}>
+                    <DropdownItem key={50} role="presentation" onClick={() => { adminCustomizeContainer.switchGroupXLPageListLimitation(50) }}>
                       <a role="menuitem">50</a>
                       <a role="menuitem">50</a>
                     </DropdownItem>
                     </DropdownItem>
                   </DropdownMenu>
                   </DropdownMenu>
                 </Dropdown>
                 </Dropdown>
                 <p className="form-text text-muted">
                 <p className="form-text text-muted">
-                  {t('admin:customize_setting.function_options.all_list_num_desc_in_page_contents_modal')}
+                  {t('admin:customize_setting.function_options.all_list_num_desc_in_notfound_and_trash_pages')}
                 </p>
                 </p>
               </div>
               </div>
             </div>
             </div>

+ 21 - 3
src/client/js/services/AdminCustomizeContainer.js

@@ -140,16 +140,34 @@ export default class AdminCustomizeContainer extends Container {
     this.setState({ isEnabledAttachTitleHeader:  !this.state.isEnabledAttachTitleHeader });
     this.setState({ isEnabledAttachTitleHeader:  !this.state.isEnabledAttachTitleHeader });
   }
   }
 
 
+
+  /**
+   * S: Switch pageListdLimitForPageContentsModal
+   */
+  switchGroupSPageListLimitation(value) {
+    this.setState({ pageListLimitForUserPage: value });
+  }
+
   /**
   /**
-   * Switch pageListdLimitForUserPage
+   * M: Switch pageListdLimitForUserPage
    */
    */
-  switchPageListLimitForUserPage(value) {
+  switchGroupMPageListLimitation(value) {
     this.setState({ pageListLimitForUserPage: value });
     this.setState({ pageListLimitForUserPage: value });
   }
   }
 
 
   /**
   /**
-   * Switch pageListdLimitForModal
+   * L: Switch pageListdLimitForSearchAndDraftPages
    */
    */
+  switchGroupLPageListLimitation(value) {
+    this.setState({ pageListLimitForUserPage: value });
+  }
+
+  /**
+   * XL: Switch pageListdLimitForNotFoundAndTrashPages
+   */
+  switchGroupXLPageListLimitation(value) {
+    this.setState({ pageListLimitForNotFoundAndTrashPage: value });
+  }
 
 
   /**
   /**
    * Switch enabledStaleNotification
    * Switch enabledStaleNotification