Commit 9159cd54 authored by Winnie Hellmann's avatar Winnie Hellmann Committed by Phil Hughes

Move new list dropdown logic to new list dropdown

parent 9a4c07c7
......@@ -18,7 +18,7 @@ import modalMixin from './mixins/modal_mixins';
import './filters/due_date_filters';
import Board from 'ee/boards/components/board';
import BoardSidebar from 'ee/boards/components/board_sidebar';
import initNewListDropdown from './components/new_list_dropdown';
import initNewListDropdown from 'ee_else_ce/boards/components/new_list_dropdown';
import BoardAddIssuesModal from 'ee/boards/components/modal/index';
import '~/vue_shared/vue_resource_interceptor';
import {
......
<script>
import $ from 'jquery';
import { throttle } from 'underscore';
import {
GlLoadingIcon,
......@@ -13,8 +12,6 @@ import {
import Icon from '~/vue_shared/components/icon.vue';
import boardsStore from '~/boards/stores/boards_store';
import BoardForm from './board_form.vue';
import AssigneeList from './assignees_list_slector';
import MilestoneList from './milestone_list_selector';
import httpStatusCodes from '~/lib/utils/http_status';
const MIN_BOARDS_TO_VIEW_RECENT = 10;
......@@ -95,8 +92,6 @@ export default {
return {
loading: true,
hasScrollFade: false,
hasAssigneesListMounted: false,
hasMilestoneListMounted: false,
scrollFadeInitialized: false,
boards: [],
recentBoards: [],
......@@ -162,8 +157,6 @@ export default {
},
created() {
boardsStore.setCurrentBoard(this.currentBoard);
$('#js-add-list').on('hide.bs.dropdown', this.handleDropdownHide);
$('.js-new-board-list-tabs').on('click', this.handleDropdownTabClick);
},
methods: {
showPage(page) {
......@@ -225,26 +218,6 @@ export default {
this.hasScrollFade = this.isScrolledUp();
},
handleDropdownHide(e) {
const $currTarget = $(e.currentTarget);
if ($currTarget.data('preventClose')) {
e.preventDefault();
}
$currTarget.removeData('preventClose');
},
handleDropdownTabClick(e) {
const $addListEl = $('#js-add-list');
$addListEl.data('preventClose', true);
if (e.target.dataset.action === 'tab-assignees' && !this.hasAssigneesListMounted) {
this.assigneeList = AssigneeList();
this.hasAssigneesListMounted = true;
}
if (e.target.dataset.action === 'tab-milestones' && !this.hasMilestoneListMounted) {
this.milstoneList = MilestoneList();
this.hasMilestoneListMounted = true;
}
},
},
};
</script>
......
import $ from 'jquery';
import initNewListDropdown from '~/boards/components/new_list_dropdown';
import AssigneeList from './assignees_list_slector';
import MilestoneList from './milestone_list_selector';
const handleDropdownHide = e => {
const $currTarget = $(e.currentTarget);
if ($currTarget.data('preventClose')) {
e.preventDefault();
}
$currTarget.removeData('preventClose');
};
let assigneeList;
let milstoneList;
const handleDropdownTabClick = e => {
const $addListEl = $('#js-add-list');
$addListEl.data('preventClose', true);
if (e.target.dataset.action === 'tab-assignees' && !assigneeList) {
assigneeList = AssigneeList();
}
if (e.target.dataset.action === 'tab-milestones' && !milstoneList) {
milstoneList = MilestoneList();
}
};
export default () => {
initNewListDropdown();
$('#js-add-list').on('hide.bs.dropdown', handleDropdownHide);
$('.js-new-board-list-tabs').on('click', handleDropdownTabClick);
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment