ソースを参照

Merge pull request #2794 from weseek/change-name-models-config.js

Change name models config.js
Yuki Takei 5 年 前
コミット
f73e73278d

+ 0 - 2
src/client/js/app.jsx

@@ -24,7 +24,6 @@ import PageAttachment from './components/PageAttachment';
 import PageStatusAlert from './components/PageStatusAlert';
 import RecentCreated from './components/RecentCreated/RecentCreated';
 import MyBookmarkList from './components/MyBookmarkList/MyBookmarkList';
-import MyDraftList from './components/MyDraftList/MyDraftList';
 import SeenUserList from './components/User/SeenUserList';
 import LikerList from './components/User/LikerList';
 import TableOfContents from './components/TableOfContents';
@@ -95,7 +94,6 @@ if (pageContainer.state.pageId != null) {
 
     'user-bookmark-list': <MyBookmarkList />,
     'user-created-list': <RecentCreated />,
-    'user-draft-list': <MyDraftList />,
   });
 }
 if (pageContainer.state.path != null) {

+ 6 - 4
src/client/js/components/Admin/Customize/CustomizeFunctionSetting.jsx

@@ -114,16 +114,16 @@ class CustomizeFunctionSetting extends React.Component {
                 </div>
                 <Dropdown isOpen={this.state.isDropdownOpen} toggle={this.onToggleDropdown}>
                   <DropdownToggle className="text-right col-6" caret>
-                    <span className="float-left">{adminCustomizeContainer.state.currentRecentCreatedLimit}</span>
+                    <span className="float-left">{adminCustomizeContainer.state.pageListLimitForUserPage}</span>
                   </DropdownToggle>
                   <DropdownMenu className="dropdown-menu" role="menu">
-                    <DropdownItem key={10} role="presentation" onClick={() => { adminCustomizeContainer.switchRecentCreatedLimit(10) }}>
+                    <DropdownItem key={10} role="presentation" onClick={() => { adminCustomizeContainer.switchPageListLimitForUserPage(10) }}>
                       <a role="menuitem">10</a>
                     </DropdownItem>
-                    <DropdownItem key={30} role="presentation" onClick={() => { adminCustomizeContainer.switchRecentCreatedLimit(30) }}>
+                    <DropdownItem key={30} role="presentation" onClick={() => { adminCustomizeContainer.switchPageListLimitForUserPage(30) }}>
                       <a role="menuitem">30</a>
                     </DropdownItem>
-                    <DropdownItem key={50} role="presentation" onClick={() => { adminCustomizeContainer.switchRecentCreatedLimit(50) }}>
+                    <DropdownItem key={50} role="presentation" onClick={() => { adminCustomizeContainer.switchPageListLimitForUserPage(50) }}>
                       <a role="menuitem">50</a>
                     </DropdownItem>
                   </DropdownMenu>
@@ -134,6 +134,8 @@ class CustomizeFunctionSetting extends React.Component {
               </div>
             </div>
 
+            {/* TODO Implemetn dropdown toggle for pageListLimitForModal (pageList pageTimelin pageHistory, pageAttachment, shareLink) */}
+
             <div className="form-group row">
               <div className="offset-md-3 col-md-6 text-left">
                 <CustomizeFunctionOption

+ 1 - 2
src/client/js/components/MyBookmarkList/MyBookmarkList.jsx

@@ -41,10 +41,9 @@ class MyBookmarkList extends React.Component {
     const { appContainer } = this.props;
 
     const userId = appContainer.currentUserId;
-    /* TODO #1 change variable name in models/config.js */
     /* TODO #2 change variable name in database keys */
     /* TODO #3 write migration */
-    const limit = appContainer.getConfig().recentCreatedLimit;
+    const limit = appContainer.getConfig().pageListLimitForUserPage;
     const page = selectPageNumber;
     const params = { page, limit };
 

+ 1 - 1
src/client/js/components/MyDraftList/MyDraftList.jsx

@@ -69,7 +69,7 @@ class MyDraftList extends React.Component {
   getCurrentDrafts(selectPageNumber) {
     const { appContainer } = this.props;
 
-    const limit = appContainer.getConfig().recentCreatedLimit;
+    const limit = appContainer.getConfig().pageListLimitForUserPage;
 
     const totalDrafts = this.state.drafts.length;
     const activePage = selectPageNumber;

+ 1 - 1
src/client/js/components/PageAttachment.jsx

@@ -12,7 +12,7 @@ class PageAttachment extends React.Component {
 
   constructor(props) {
     super(props);
-
+    // TODO add paging size (limit) for modal
     this.state = {
       attachments: [],
       inUse: {},

+ 1 - 1
src/client/js/components/PageHistory.jsx

@@ -11,7 +11,7 @@ class PageHistory extends React.Component {
 
   constructor(props) {
     super(props);
-
+    // TODO add paging size (limit) for modal
     this.state = {
       isLoaded: false,
       isLoading: false,

+ 1 - 1
src/client/js/components/PageTimeline.jsx

@@ -15,7 +15,7 @@ class PageTimeline extends React.Component {
     super(props);
 
     const { appContainer } = this.props;
-
+    // TODO add paging size (limit) for modal
     this.state = {
       isEnabled: appContainer.getConfig().isEnabledTimeline,
       isInitialized: false,

+ 1 - 1
src/client/js/components/RecentCreated/RecentCreated.jsx

@@ -38,7 +38,7 @@ class RecentCreated extends React.Component {
     const { pageId } = pageContainer.state;
 
     const userId = appContainer.currentUserId;
-    const limit = appContainer.getConfig().recentCreatedLimit;
+    const limit = appContainer.getConfig().pageListLimitForUserPage;
     const offset = (selectPageNumber - 1) * limit;
 
     // pagesList get and pagination calculate

+ 15 - 7
src/client/js/services/AdminCustomizeContainer.js

@@ -25,7 +25,8 @@ export default class AdminCustomizeContainer extends Container {
       isEnabledTimeline: false,
       isSavedStatesOfTabChanges: false,
       isEnabledAttachTitleHeader: false,
-      currentRecentCreatedLimit: 10,
+      pageListLimitForUserPage: 10,
+      // TODO implement for pageListLimitForModal
       isEnabledStaleNotification: false,
       isAllReplyShown: false,
       currentHighlightJsStyleId: '',
@@ -73,7 +74,8 @@ export default class AdminCustomizeContainer extends Container {
         isEnabledTimeline: customizeParams.isEnabledTimeline,
         isSavedStatesOfTabChanges: customizeParams.isSavedStatesOfTabChanges,
         isEnabledAttachTitleHeader: customizeParams.isEnabledAttachTitleHeader,
-        currentRecentCreatedLimit: customizeParams.recentCreatedLimit,
+        pageListLimitForUserPage: customizeParams.pageListLimitForUserPage,
+        // TODO implement for pageListLimitForModal
         isEnabledStaleNotification: customizeParams.isEnabledStaleNotification,
         isAllReplyShown: customizeParams.isAllReplyShown,
         currentHighlightJsStyleId: customizeParams.styleName,
@@ -139,12 +141,16 @@ export default class AdminCustomizeContainer extends Container {
   }
 
   /**
-   * Switch recentCreatedLimit
+   * Switch pageListdLimitForUserPage
    */
-  switchRecentCreatedLimit(value) {
-    this.setState({ currentRecentCreatedLimit: value });
+  switchPageListLimitForUserPage(value) {
+    this.setState({ pageListLimitForUserPage: value });
   }
 
+  /**
+   * Switch pageListdLimitForModal
+   */
+
   /**
    * Switch enabledStaleNotification
    */
@@ -267,7 +273,8 @@ export default class AdminCustomizeContainer extends Container {
         isEnabledTimeline: this.state.isEnabledTimeline,
         isSavedStatesOfTabChanges: this.state.isSavedStatesOfTabChanges,
         isEnabledAttachTitleHeader: this.state.isEnabledAttachTitleHeader,
-        recentCreatedLimit: this.state.currentRecentCreatedLimit,
+        pageListLimitForUserPage: this.state.pageListLimitForUserPage,
+        // TODO implement for pageListLimitForModal
         isEnabledStaleNotification: this.state.isEnabledStaleNotification,
         isAllReplyShown: this.state.isAllReplyShown,
       });
@@ -276,7 +283,8 @@ export default class AdminCustomizeContainer extends Container {
         isEnabledTimeline: customizedParams.isEnabledTimeline,
         isSavedStatesOfTabChanges: customizedParams.isSavedStatesOfTabChanges,
         isEnabledAttachTitleHeader: customizedParams.isEnabledAttachTitleHeader,
-        recentCreatedLimit: customizedParams.currentRecentCreatedLimit,
+        pageListLimitForUserPage: customizedParams.pageListLimitForUserPage,
+        // TODO implement for pageListLimitForModal
         isEnabledStaleNotification: customizedParams.isEnabledStaleNotification,
         isAllReplyShown: customizedParams.isAllReplyShown,
       });

+ 3 - 2
src/server/models/config.js

@@ -111,7 +111,7 @@ module.exports = function(crowi) {
       'customize:isEnabledTimeline' : true,
       'customize:isSavedStatesOfTabChanges' : true,
       'customize:isEnabledAttachTitleHeader' : false,
-      'customize:showRecentCreatedNumber' : 10,
+      'customize:showPageListLimitNumberForUserPage' : 10,
       'customize:isEnabledStaleNotification': false,
       'customize:isAllReplyShown': false,
 
@@ -218,7 +218,8 @@ module.exports = function(crowi) {
         MATHJAX: env.MATHJAX || null,
         NO_CDN: env.NO_CDN || null,
       },
-      recentCreatedLimit: crowi.configManager.getConfig('crowi', 'customize:showRecentCreatedNumber'),
+      pageListLimitForUserPage: crowi.configManager.getConfig('crowi', 'customize:showPageListLimitNumberForUserPage'),
+      // TODO implement for pageListLimitForModal
       isEnabledStaleNotification: crowi.configManager.getConfig('crowi', 'customize:isEnabledStaleNotification'),
       isAclEnabled: crowi.aclService.isAclEnabled(),
       isSearchServiceConfigured: crowi.searchService.isConfigured,

+ 9 - 5
src/server/routes/apiv3/customize-setting.js

@@ -39,7 +39,7 @@ const ErrorV3 = require('../../models/vo/error-apiv3');
  *            type: boolean
  *          isEnabledAttachTitleHeader:
  *            type: boolean
- *          recentCreatedLimit:
+ *          pageListLimitForUserPage:
  *            type: number
  *          isEnabledStaleNotification:
  *            type: boolean
@@ -102,7 +102,8 @@ module.exports = (crowi) => {
       body('isEnabledTimeline').isBoolean(),
       body('isSavedStatesOfTabChanges').isBoolean(),
       body('isEnabledAttachTitleHeader').isBoolean(),
-      body('recentCreatedLimit').isInt().isInt({ min: 1, max: 1000 }),
+      // TODO implement for pageListLimitForModal
+      body('pageListLimitForUserPage').isInt().isInt({ min: 1, max: 1000 }),
       body('isEnabledStaleNotification').isBoolean(),
       body('isAllReplyShown').isBoolean(),
     ],
@@ -154,7 +155,8 @@ module.exports = (crowi) => {
       isEnabledTimeline: await crowi.configManager.getConfig('crowi', 'customize:isEnabledTimeline'),
       isSavedStatesOfTabChanges: await crowi.configManager.getConfig('crowi', 'customize:isSavedStatesOfTabChanges'),
       isEnabledAttachTitleHeader: await crowi.configManager.getConfig('crowi', 'customize:isEnabledAttachTitleHeader'),
-      recentCreatedLimit: await crowi.configManager.getConfig('crowi', 'customize:showRecentCreatedNumber'),
+      pageListLimitForUserPage: await crowi.configManager.getConfig('crowi', 'customize:showPageListLimitNumberForUserPage'),
+      // TODO implement for pageListLimitForModal
       isEnabledStaleNotification: await crowi.configManager.getConfig('crowi', 'customize:isEnabledStaleNotification'),
       isAllReplyShown: await crowi.configManager.getConfig('crowi', 'customize:isAllReplyShown'),
       styleName: await crowi.configManager.getConfig('crowi', 'customize:highlightJsStyle'),
@@ -278,7 +280,8 @@ module.exports = (crowi) => {
       'customize:isEnabledTimeline': req.body.isEnabledTimeline,
       'customize:isSavedStatesOfTabChanges': req.body.isSavedStatesOfTabChanges,
       'customize:isEnabledAttachTitleHeader': req.body.isEnabledAttachTitleHeader,
-      'customize:showRecentCreatedNumber': req.body.recentCreatedLimit,
+      // TODO implement for pageListLimitForModal
+      'customize:showPageListLimitForUserPage': req.body.pageListLimitForUserPage,
       'customize:isEnabledStaleNotification': req.body.isEnabledStaleNotification,
       'customize:isAllReplyShown': req.body.isAllReplyShown,
     };
@@ -289,7 +292,8 @@ module.exports = (crowi) => {
         isEnabledTimeline: await crowi.configManager.getConfig('crowi', 'customize:isEnabledTimeline'),
         isSavedStatesOfTabChanges: await crowi.configManager.getConfig('crowi', 'customize:isSavedStatesOfTabChanges'),
         isEnabledAttachTitleHeader: await crowi.configManager.getConfig('crowi', 'customize:isEnabledAttachTitleHeader'),
-        recentCreatedLimit: await crowi.configManager.getConfig('crowi', 'customize:showRecentCreatedNumber'),
+        // TODO implement for pageListLimitForModal
+        pageListLimitForUserPage: await crowi.configManager.getConfig('crowi', 'customize:showPageListLimitNumberForUserPage'),
         isEnabledStaleNotification: await crowi.configManager.getConfig('crowi', 'customize:isEnabledStaleNotification'),
         isAllReplyShown: await crowi.configManager.getConfig('crowi', 'customize:isAllReplyShown'),
       };

+ 1 - 6
src/server/views/widget/user_page_content.html

@@ -12,13 +12,8 @@
         <span class="d-none d-sm-inline">Recently Created</span>
       </a>
     </li>
+
     {% if user._id.toString() == pageUser._id.toString() %}
-    <li class="nav-item">
-      <a class="nav-link" href="#user-draft-list" role="tab" data-toggle="tab">
-        <i class="icon-docs"></i>
-        <span class="d-none d-sm-inline">My Drafts</span>
-      </a>
-    </li>
     <li class="nav-item">
       <a class="nav-link" href="/me" role="tab">
         <i class="icon-wrench"></i>