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

Refactor imported -> linked in components

Andrés Manelli 7 лет назад
Родитель
Сommit
f76d8e47a8

+ 3 - 3
client/components/activities/comments.js

@@ -24,9 +24,9 @@ BlazeComponent.extendComponent({
         const card = this.currentData();
         let boardId = card.boardId;
         let cardId = card._id;
-        if (card.isImportedCard()) {
-          boardId = Cards.findOne(card.importedId).boardId;
-          cardId = card.importedId;
+        if (card.isLinkedCard()) {
+          boardId = Cards.findOne(card.linkedId).boardId;
+          cardId = card.linkedId;
         }
         if (text) {
           CardComments.insert({

+ 3 - 3
client/components/cards/attachments.js

@@ -57,9 +57,9 @@ Template.cardAttachmentsPopup.events({
     const card = this;
     FS.Utility.eachFile(evt, (f) => {
       const file = new FS.File(f);
-      if (card.isImportedCard()) {
-        file.boardId = Cards.findOne(card.importedId).boardId;
-        file.cardId = card.importedId;
+      if (card.isLinkedCard()) {
+        file.boardId = Cards.findOne(card.linkedId).boardId;
+        file.cardId = card.linkedId;
       } else {
         file.boardId = card.boardId;
         file.cardId = card._id;

+ 3 - 3
client/components/cards/cardDetails.jade

@@ -19,13 +19,13 @@ template(name="cardDetails")
             a.js-parent-card(href=linkForCard) {{title}}
           // else
             {{_ 'top-level-card'}}
-        if isImportedCard
-          h3.imported-card-location
+        if isLinkedCard
+          h3.linked-card-location
             +viewer
               | {{getBoardTitle}} > {{getTitle}}
 
     if getArchived
-      if isImportedBoard
+      if isLinkedBoard
         p.warning {{_ 'board-archived'}}
       else
         p.warning {{_ 'card-archived'}}

+ 1 - 1
client/components/cards/cardDetails.styl

@@ -47,7 +47,7 @@
       margin: 7px 0 0
       padding: 0
 
-    .imported-card-location
+    .linked-card-location
       font-style: italic
       font-size: 1em
       margin-bottom: 0

+ 2 - 2
client/components/cards/checklists.js

@@ -76,8 +76,8 @@ BlazeComponent.extendComponent({
     const title = textarea.value.trim();
     let cardId = this.currentData().cardId;
     const card = Cards.findOne(cardId);
-    if (card.isImported())
-      cardId = card.importedId;
+    if (card.isLinked())
+      cardId = card.linkedId;
 
     if (title) {
       Checklists.insert({

+ 9 - 10
client/components/cards/minicard.jade

@@ -1,7 +1,7 @@
 template(name="minicard")
   .minicard(
-    class="{{#if isImportedCard}}imported-card{{/if}}"
-    class="{{#if isImportedBoard}}imported-board{{/if}}")
+    class="{{#if isLinkedCard}}linked-card{{/if}}"
+    class="{{#if isLinkedBoard}}linked-board{{/if}}")
     if cover
       .minicard-cover(style="background-image: url('{{cover.url}}');")
     if labels
@@ -15,15 +15,14 @@ template(name="minicard")
       if $eq 'prefix-with-parent' currentBoard.presentParentTask
         .parent-prefix
           | {{ parentCardName }}
-      if isImportedBoard
-        a.js-imported-link
-          span.imported-icon.fa.fa-folder
-      else if isImportedCard
-        a.js-imported-link
-          span.imported-icon.fa.fa-id-card
+      if isLinkedBoard
+        a.js-linked-link
+          span.linked-icon.fa.fa-folder
+      else if isLinkedCard
+        a.js-linked-link
+          span.linked-icon.fa.fa-id-card
       if getArchived
-        span.imported-icon.imported-archived.fa.fa-archive
-
+        span.linked-icon.linked-archived.fa.fa-archive
       +viewer
         = getTitle
       if $eq 'subtext-with-full-path' currentBoard.presentParentTask

+ 5 - 5
client/components/cards/minicard.js

@@ -9,11 +9,11 @@ BlazeComponent.extendComponent({
 
   events() {
     return [{
-      'click .js-imported-link' (evt) {
-        if (this.data().isImportedCard())
-          Utils.goCardId(this.data().importedId);
-        else if (this.data().isImportedBoard())
-          Utils.goBoardId(this.data().importedId);
+      'click .js-linked-link' (evt) {
+        if (this.data().isLinkedCard())
+          Utils.goCardId(this.data().linkedId);
+        else if (this.data().isLinkedBoard())
+          Utils.goBoardId(this.data().linkedId);
       },
     }];
   },

+ 4 - 4
client/components/cards/minicard.styl

@@ -44,14 +44,14 @@
   transition: transform 0.2s,
               border-radius 0.2s
 
-  &.imported-board
-  &.imported-card
-    .imported-icon
+  &.linked-board
+  &.linked-card
+    .linked-icon
       display: inline-block
       margin-right: 11px
       vertical-align: baseline
       font-size: 0.9em
-    .imported-archived
+    .linked-archived
       color: #937760
 
   .is-selected &

+ 2 - 2
client/components/lists/list.styl

@@ -188,11 +188,11 @@
       top: -@padding
       right: 17px
 
-.import-board-wrapper
+.link-board-wrapper
   display: flex
   align-items: baseline
 
-  .js-import-board
+  .js-link-board
     margin-left: 15px
 
 .search-card-results

+ 6 - 6
client/components/lists/listBody.jade

@@ -36,7 +36,7 @@ template(name="addCardForm")
     button.primary.confirm(type="submit") {{_ 'add'}}
     span.quiet
       | {{_ 'or'}}
-      a.js-import {{_ 'import'}}
+      a.js-link {{_ 'link'}}
     span.quiet
       |  
       | /
@@ -46,16 +46,16 @@ template(name="autocompleteLabelLine")
   .minicard-label(class="card-label-{{colorName}}" title=labelName)
   span(class="{{#if hasNoName}}quiet{{/if}}")= labelName
 
-template(name="importCardPopup")
+template(name="linkCardPopup")
   label {{_ 'boards'}}:
-  .import-board-wrapper
+  .link-board-wrapper
     select.js-select-boards
       each boards
         if $eq _id currentBoard._id
           option(value="{{_id}}" selected) {{_ 'current'}}
         else
           option(value="{{_id}}") {{title}}
-    input.primary.confirm.js-import-board(type="button" value="{{_ 'import'}}")
+    input.primary.confirm.js-link-board(type="button" value="{{_ 'link'}}")
 
   label {{_ 'swimlanes'}}:
   select.js-select-swimlanes
@@ -73,11 +73,11 @@ template(name="importCardPopup")
       option(value="{{_id}}") {{title}}
 
   .edit-controls.clearfix
-    input.primary.confirm.js-done(type="button" value="{{_ 'import'}}")
+    input.primary.confirm.js-done(type="button" value="{{_ 'link'}}")
 
 template(name="searchCardPopup")
   label {{_ 'boards'}}:
-  .import-board-wrapper
+  .link-board-wrapper
     select.js-select-boards
       each boards
         if $eq _id currentBoard._id

+ 14 - 14
client/components/lists/listBody.js

@@ -200,7 +200,7 @@ BlazeComponent.extendComponent({
   events() {
     return [{
       keydown: this.pressKey,
-      'click .js-import': Popup.open('importCard'),
+      'click .js-link': Popup.open('linkCard'),
       'click .js-search': Popup.open('searchCard'),
     }];
   },
@@ -338,8 +338,8 @@ BlazeComponent.extendComponent({
       swimlaneId: this.selectedSwimlaneId.get(),
       listId: this.selectedListId.get(),
       archived: false,
-      importedId: null,
-      _id: {$nin: this.board.cards().map((card) => { return card.importedId || card._id; })},
+      linkedId: null,
+      _id: {$nin: this.board.cards().map((card) => { return card.linkedId || card._id; })},
     });
   },
 
@@ -356,7 +356,7 @@ BlazeComponent.extendComponent({
         this.selectedListId.set($(evt.currentTarget).val());
       },
       'click .js-done' (evt) {
-        // IMPORT CARD
+        // LINK CARD
         evt.stopPropagation();
         evt.preventDefault();
         const _id = Cards.insert({
@@ -365,14 +365,14 @@ BlazeComponent.extendComponent({
           swimlaneId: this.swimlaneId,
           boardId: this.boardId,
           sort: Lists.findOne(this.listId).cards().count(),
-          type: 'cardType-importedCard',
-          importedId: $('.js-select-cards option:selected').val(),
+          type: 'cardType-linkedCard',
+          linkedId: $('.js-select-cards option:selected').val(),
         });
         Filter.addException(_id);
         Popup.close();
       },
-      'click .js-import-board' (evt) {
-        //IMPORT BOARD
+      'click .js-link-board' (evt) {
+        //LINK BOARD
         evt.stopPropagation();
         evt.preventDefault();
         const impBoardId = $('.js-select-boards option:selected').val();
@@ -382,15 +382,15 @@ BlazeComponent.extendComponent({
           swimlaneId: this.swimlaneId,
           boardId: this.boardId,
           sort: Lists.findOne(this.listId).cards().count(),
-          type: 'cardType-importedBoard',
-          importedId: impBoardId,
+          type: 'cardType-linkedBoard',
+          linkedId: impBoardId,
         });
         Filter.addException(_id);
         Popup.close();
       },
     }];
   },
-}).register('importCardPopup');
+}).register('linkCardPopup');
 
 BlazeComponent.extendComponent({
   mixins() {
@@ -452,7 +452,7 @@ BlazeComponent.extendComponent({
         this.term.set(evt.target.searchTerm.value);
       },
       'click .js-minicard'(evt) {
-        // IMPORT CARD
+        // LINK CARD
         const card = Blaze.getData(evt.currentTarget);
         const _id = Cards.insert({
           title: card.title, //dummy
@@ -460,8 +460,8 @@ BlazeComponent.extendComponent({
           swimlaneId: this.swimlaneId,
           boardId: this.boardId,
           sort: Lists.findOne(this.listId).cards().count(),
-          type: 'cardType-importedCard',
-          importedId: card._id,
+          type: 'cardType-linkedCard',
+          linkedId: card._id,
         });
         Filter.addException(_id);
         Popup.close();