浏览代码

Merge pull request #2406 from bentiss/fixes

card count placement and export API functionality back
Lauri Ojansivu 6 年之前
父节点
当前提交
da083c2e20
共有 4 个文件被更改,包括 21 次插入10 次删除
  1. 4 0
      client/components/lists/list.styl
  2. 1 1
      client/components/lists/listHeader.jade
  3. 15 8
      models/export.js
  4. 1 1
      openapi/generate_openapi.py

+ 4 - 0
client/components/lists/list.styl

@@ -99,6 +99,10 @@
   .highlight
   .highlight
     color: #ce1414
     color: #ce1414
 
 
+  .cardCount
+    color: #8c8c8c
+    font-size: 0.8em
+
 .list-body
 .list-body
   flex: 1 1 auto
   flex: 1 1 auto
   flex-direction: column
   flex-direction: column

+ 1 - 1
client/components/lists/listHeader.jade

@@ -19,7 +19,7 @@ template(name="listHeader")
 
 
         if showCardsCountForList cards.count
         if showCardsCountForList cards.count
           | 
           | 
-          p.quiet.small {{cardsCount}} {{_ 'cards-count'}}
+          span(class="cardCount") {{cardsCount}} {{_ 'cards-count'}}
       if isMiniScreen
       if isMiniScreen
         if currentList
         if currentList
           if isWatching
           if isWatching

+ 15 - 8
models/export.js

@@ -6,27 +6,34 @@ if (Meteor.isServer) {
   // `ApiRoutes.path('boards/export', boardId)``
   // `ApiRoutes.path('boards/export', boardId)``
   // on the client instead of copy/pasting the route path manually between the
   // on the client instead of copy/pasting the route path manually between the
   // client and the server.
   // client and the server.
-  /*
-   * This route is used to export the board FROM THE APPLICATION.
-   * If user is already logged-in, pass loginToken as param "authToken":
-   * '/api/boards/:boardId/export?authToken=:token'
+  /**
+   * @operation export
+   * @tag Boards
+   *
+   * @summary This route is used to export the board.
+   *
+   * @description If user is already logged-in, pass loginToken as param
+   * "authToken": '/api/boards/:boardId/export?authToken=:token'
    *
    *
    * See https://blog.kayla.com.au/server-side-route-authentication-in-meteor/
    * See https://blog.kayla.com.au/server-side-route-authentication-in-meteor/
    * for detailed explanations
    * for detailed explanations
+   *
+   * @param {string} boardId the ID of the board we are exporting
+   * @param {string} authToken the loginToken
    */
    */
-
-
   JsonRoutes.add('get', '/api/boards/:boardId/export', function(req, res) {
   JsonRoutes.add('get', '/api/boards/:boardId/export', function(req, res) {
     const boardId = req.params.boardId;
     const boardId = req.params.boardId;
     let user = null;
     let user = null;
-    // todo XXX for real API, first look for token in Authentication: header
-    // then fallback to parameter
+
     const loginToken = req.query.authToken;
     const loginToken = req.query.authToken;
     if (loginToken) {
     if (loginToken) {
       const hashToken = Accounts._hashLoginToken(loginToken);
       const hashToken = Accounts._hashLoginToken(loginToken);
       user = Meteor.users.findOne({
       user = Meteor.users.findOne({
         'services.resume.loginTokens.hashedToken': hashToken,
         'services.resume.loginTokens.hashedToken': hashToken,
       });
       });
+    } else if (!Meteor.settings.public.sandstorm) {
+      Authentication.checkUserId(req.userId);
+      user = Users.findOne({ _id: req.userId, isAdmin: true });
     }
     }
 
 
     const exporter = new Exporter(boardId);
     const exporter = new Exporter(boardId);

+ 1 - 1
openapi/generate_openapi.py

@@ -678,7 +678,7 @@ def parse_schemas(schemas_dir):
                 data = ''.join(f.readlines())
                 data = ''.join(f.readlines())
                 try:
                 try:
                     # if the file failed, it's likely it doesn't contain a schema
                     # if the file failed, it's likely it doesn't contain a schema
-                    program = esprima.parseScript(data, options={'comment': True, 'loc': True})
+                    program = esprima.parseModule(data, options={'comment': True, 'loc': True})
                 except:
                 except:
                     continue
                     continue