diff options
author | Martin Hanzel <mhanzel@gitlab.com> | 2019-06-07 16:23:10 +0300 |
---|---|---|
committer | Kushal Pandya <kushalspandya@gmail.com> | 2019-06-07 16:23:10 +0300 |
commit | 25269f66ba60e211ad64ff08beb9799be1103c52 (patch) | |
tree | 6777cbeeeff46df5aaa1382e8dc3510b24d470ac | |
parent | 25ef3a9687494bea8927d7109f6e684beba2eb95 (diff) |
Move Vue models from vue_shared to boards
Some classes in vue_shared were used only by boards, so they were
moved to the boards directory.
-rw-r--r-- | app/assets/javascripts/boards/index.js | 4 | ||||
-rw-r--r-- | app/assets/javascripts/boards/models/assignee.js (renamed from app/assets/javascripts/vue_shared/models/assignee.js) | 0 | ||||
-rw-r--r-- | app/assets/javascripts/boards/models/issue.js | 2 | ||||
-rw-r--r-- | app/assets/javascripts/boards/models/label.js | 11 | ||||
-rw-r--r-- | app/assets/javascripts/boards/models/list.js | 4 | ||||
-rw-r--r-- | app/assets/javascripts/vue_shared/models/label.js | 13 | ||||
-rw-r--r-- | spec/frontend/boards/modal_store_spec.js | 4 | ||||
-rw-r--r-- | spec/javascripts/boards/board_card_spec.js | 4 | ||||
-rw-r--r-- | spec/javascripts/boards/boards_store_spec.js | 4 | ||||
-rw-r--r-- | spec/javascripts/boards/issue_card_spec.js | 4 | ||||
-rw-r--r-- | spec/javascripts/boards/issue_spec.js | 4 | ||||
-rw-r--r-- | spec/javascripts/boards/list_spec.js | 4 |
12 files changed, 28 insertions, 30 deletions
diff --git a/app/assets/javascripts/boards/index.js b/app/assets/javascripts/boards/index.js index e9cab3e3bba..f2f37d22b97 100644 --- a/app/assets/javascripts/boards/index.js +++ b/app/assets/javascripts/boards/index.js @@ -3,8 +3,8 @@ import Vue from 'vue'; import Flash from '~/flash'; import { __ } from '~/locale'; -import '~/vue_shared/models/label'; -import '~/vue_shared/models/assignee'; +import './models/label'; +import './models/assignee'; import FilteredSearchBoards from './filtered_search_boards'; import eventHub from './eventhub'; diff --git a/app/assets/javascripts/vue_shared/models/assignee.js b/app/assets/javascripts/boards/models/assignee.js index 4a29b0d0581..4a29b0d0581 100644 --- a/app/assets/javascripts/vue_shared/models/assignee.js +++ b/app/assets/javascripts/boards/models/assignee.js diff --git a/app/assets/javascripts/boards/models/issue.js b/app/assets/javascripts/boards/models/issue.js index f8ff20cb0cd..f858b162c6b 100644 --- a/app/assets/javascripts/boards/models/issue.js +++ b/app/assets/javascripts/boards/models/issue.js @@ -4,7 +4,7 @@ /* global ListAssignee */ import Vue from 'vue'; -import '~/vue_shared/models/label'; +import './label'; import { isEE, convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; import IssueProject from './project'; import boardsStore from '../stores/boards_store'; diff --git a/app/assets/javascripts/boards/models/label.js b/app/assets/javascripts/boards/models/label.js new file mode 100644 index 00000000000..cd2a2c0137f --- /dev/null +++ b/app/assets/javascripts/boards/models/label.js @@ -0,0 +1,11 @@ +import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; + +export default class ListLabel { + constructor(obj) { + Object.assign(this, convertObjectPropsToCamelCase(obj, { dropKeys: ['priority'] }), { + priority: obj.priority !== null ? obj.priority : Infinity, + }); + } +} + +window.ListLabel = ListLabel; diff --git a/app/assets/javascripts/boards/models/list.js b/app/assets/javascripts/boards/models/list.js index 08aecfab8a4..a9d88f19146 100644 --- a/app/assets/javascripts/boards/models/list.js +++ b/app/assets/javascripts/boards/models/list.js @@ -2,8 +2,8 @@ /* global ListIssue */ import { __ } from '~/locale'; -import ListLabel from '~/vue_shared/models/label'; -import ListAssignee from '~/vue_shared/models/assignee'; +import ListLabel from './label'; +import ListAssignee from './assignee'; import { isEE, urlParamsToObject } from '~/lib/utils/common_utils'; import boardsStore from '../stores/boards_store'; import ListMilestone from './milestone'; diff --git a/app/assets/javascripts/vue_shared/models/label.js b/app/assets/javascripts/vue_shared/models/label.js deleted file mode 100644 index 2d2732d0661..00000000000 --- a/app/assets/javascripts/vue_shared/models/label.js +++ /dev/null @@ -1,13 +0,0 @@ -export default class ListLabel { - constructor(obj) { - this.id = obj.id; - this.title = obj.title; - this.type = obj.type; - this.color = obj.color; - this.textColor = obj.text_color; - this.description = obj.description; - this.priority = obj.priority !== null ? obj.priority : Infinity; - } -} - -window.ListLabel = ListLabel; diff --git a/spec/frontend/boards/modal_store_spec.js b/spec/frontend/boards/modal_store_spec.js index 3257a3fb8a3..4dd27e94d97 100644 --- a/spec/frontend/boards/modal_store_spec.js +++ b/spec/frontend/boards/modal_store_spec.js @@ -1,7 +1,7 @@ /* global ListIssue */ -import '~/vue_shared/models/label'; -import '~/vue_shared/models/assignee'; +import '~/boards/models/label'; +import '~/boards/models/assignee'; import '~/boards/models/issue'; import '~/boards/models/list'; import Store from '~/boards/stores/modal_store'; diff --git a/spec/javascripts/boards/board_card_spec.js b/spec/javascripts/boards/board_card_spec.js index e1017130bed..13b708a03d5 100644 --- a/spec/javascripts/boards/board_card_spec.js +++ b/spec/javascripts/boards/board_card_spec.js @@ -7,8 +7,8 @@ import MockAdapter from 'axios-mock-adapter'; import axios from '~/lib/utils/axios_utils'; import eventHub from '~/boards/eventhub'; -import '~/vue_shared/models/label'; -import '~/vue_shared/models/assignee'; +import '~/boards/models/label'; +import '~/boards/models/assignee'; import '~/boards/models/list'; import boardsStore from '~/boards/stores/boards_store'; import boardCard from '~/boards/components/board_card.vue'; diff --git a/spec/javascripts/boards/boards_store_spec.js b/spec/javascripts/boards/boards_store_spec.js index b5559db8784..e81115e10c9 100644 --- a/spec/javascripts/boards/boards_store_spec.js +++ b/spec/javascripts/boards/boards_store_spec.js @@ -6,8 +6,8 @@ import MockAdapter from 'axios-mock-adapter'; import axios from '~/lib/utils/axios_utils'; import Cookies from 'js-cookie'; -import '~/vue_shared/models/label'; -import '~/vue_shared/models/assignee'; +import '~/boards/models/label'; +import '~/boards/models/assignee'; import '~/boards/models/issue'; import '~/boards/models/list'; import '~/boards/services/board_service'; diff --git a/spec/javascripts/boards/issue_card_spec.js b/spec/javascripts/boards/issue_card_spec.js index a5bf97bdcc2..8a20911cc66 100644 --- a/spec/javascripts/boards/issue_card_spec.js +++ b/spec/javascripts/boards/issue_card_spec.js @@ -4,8 +4,8 @@ import Vue from 'vue'; -import '~/vue_shared/models/label'; -import '~/vue_shared/models/assignee'; +import '~/boards/models/label'; +import '~/boards/models/assignee'; import '~/boards/models/issue'; import '~/boards/models/list'; import IssueCardInner from '~/boards/components/issue_card_inner.vue'; diff --git a/spec/javascripts/boards/issue_spec.js b/spec/javascripts/boards/issue_spec.js index e4ff3eb381f..bb7abe52eae 100644 --- a/spec/javascripts/boards/issue_spec.js +++ b/spec/javascripts/boards/issue_spec.js @@ -1,8 +1,8 @@ /* global ListIssue */ import Vue from 'vue'; -import '~/vue_shared/models/label'; -import '~/vue_shared/models/assignee'; +import '~/boards/models/label'; +import '~/boards/models/assignee'; import '~/boards/models/issue'; import '~/boards/models/list'; import '~/boards/services/board_service'; diff --git a/spec/javascripts/boards/list_spec.js b/spec/javascripts/boards/list_spec.js index bb6fc6c693d..15c9ff6dfb4 100644 --- a/spec/javascripts/boards/list_spec.js +++ b/spec/javascripts/boards/list_spec.js @@ -4,8 +4,8 @@ import MockAdapter from 'axios-mock-adapter'; import axios from '~/lib/utils/axios_utils'; import _ from 'underscore'; -import '~/vue_shared/models/label'; -import '~/vue_shared/models/assignee'; +import '~/boards/models/label'; +import '~/boards/models/assignee'; import '~/boards/models/issue'; import '~/boards/models/list'; import '~/boards/services/board_service'; |