Commit 6ebc26f2 authored by Felipe Artur's avatar Felipe Artur

Merge branch 'issue_928_group_boards' of gitlab.com:gitlab-org/gitlab-ee into...

Merge branch 'issue_928_group_boards' of gitlab.com:gitlab-org/gitlab-ee into issue_928_group_boards
parents 2a33b0c4 c8a4ec36
/* global ListIssue */ /* global ListIssue */
import eventHub from '../eventhub'; import eventHub from '../eventhub';
import ProjectSelect from './project_select'; import ProjectSelect from './project_select.vue';
const Store = gl.issueBoards.BoardsStore; const Store = gl.issueBoards.BoardsStore;
......
<template>
<div>
<label class="label-light prepend-top-10">
Project
</label>
<div ref="projectsDropdown" class="dropdown">
<button
class="dropdown-menu-toggle wide"
type="button"
data-toggle="dropdown"
aria-expanded="false">
{{ selectedProjectName }}
<i class="fa fa-chevron-down" aria-hidden="true"></i>
</button>
<div class="dropdown-menu dropdown-menu-selectable dropdown-menu-full-width">
<div class="dropdown-title">
<span>Projects</span>
<button aria-label="Close" type="button" class="dropdown-title-button dropdown-menu-close">
<i aria-hidden="true" data-hidden="true" class="fa fa-times dropdown-menu-close-icon"></i>
</button>
</div>
<div class="dropdown-input">
<input
class="dropdown-input-field"
type="search"
placeholder="Search projects">
<i aria-hidden="true" data-hidden="true" class="fa fa-search dropdown-input-search"></i>
</div>
<div class="dropdown-content"></div>
<div class="dropdown-loading">
<loading-icon />
</div>
</div>
</div>
</div>
</template>
<script>
/* global ListIssue */ /* global ListIssue */
import eventHub from '../eventhub'; import eventHub from '../eventhub';
import loadingIcon from '../../vue_shared/components/loading_icon.vue'; import loadingIcon from '../../vue_shared/components/loading_icon.vue';
...@@ -65,37 +103,6 @@ export default { ...@@ -65,37 +103,6 @@ export default {
}, },
text: project => project.name, text: project => project.name,
}); });
}, }
template: `
<div>
<label class="label-light prepend-top-10">
Project
</label>
<div ref="projectsDropdown" class="dropdown">
<button
class="dropdown-menu-toggle wide"
type="button"
data-toggle="dropdown"
aria-expanded="false">
{{ selectedProjectName }}
<i class="fa fa-chevron-down" aria-hidden="true"></i>
</button>
<div class="dropdown-menu dropdown-menu-selectable dropdown-menu-full-width">
<div class="dropdown-title">
<span>Projects</span>
<button aria-label="Close" type="button" class="dropdown-title-button dropdown-menu-close">
<i aria-hidden="true" data-hidden="true" class="fa fa-times dropdown-menu-close-icon"></i>
</button>
</div>
<div class="dropdown-input">
<input class="dropdown-input-field">
</div>
<div class="dropdown-content"></div>
<div class="dropdown-loading">
<loading-icon />
</div>
</div>
</div>
</div>
`,
}; };
</script>
...@@ -33,9 +33,12 @@ gl.issueBoards.RemoveIssueBtn = Vue.extend({ ...@@ -33,9 +33,12 @@ gl.issueBoards.RemoveIssueBtn = Vue.extend({
const issue = this.issue; const issue = this.issue;
const lists = issue.getLists(); const lists = issue.getLists();
const listLabelIds = lists.map(list => list.label.id); const listLabelIds = lists.map(list => list.label.id);
const labelIds = this.issue.labels let labelIds = this.issue.labels
.map(label => label.id) .map(label => label.id)
.filter(id => !listLabelIds.includes(id)); .filter(id => !listLabelIds.includes(id));
if (labelIds.length === 0) {
labelIds = [''];
}
const data = { const data = {
issue: { issue: {
label_ids: labelIds, label_ids: labelIds,
......
...@@ -2,13 +2,14 @@ import DropLab from '~/droplab/drop_lab'; ...@@ -2,13 +2,14 @@ import DropLab from '~/droplab/drop_lab';
import FilteredSearchContainer from './container'; import FilteredSearchContainer from './container';
class FilteredSearchDropdownManager { class FilteredSearchDropdownManager {
constructor(baseEndpoint = '', tokenizer, page) { constructor(baseEndpoint = '', tokenizer, page, isGroup) {
this.container = FilteredSearchContainer.container; this.container = FilteredSearchContainer.container;
this.baseEndpoint = baseEndpoint.replace(/\/$/, ''); this.baseEndpoint = baseEndpoint.replace(/\/$/, '');
this.tokenizer = tokenizer; this.tokenizer = tokenizer;
this.filteredSearchTokenKeys = gl.FilteredSearchTokenKeys; this.filteredSearchTokenKeys = gl.FilteredSearchTokenKeys;
this.filteredSearchInput = this.container.querySelector('.filtered-search'); this.filteredSearchInput = this.container.querySelector('.filtered-search');
this.page = page; this.page = page;
this.groupsOnly = page === 'boards' && isGroup;
if (this.page === 'issues' || this.page === 'boards') { if (this.page === 'issues' || this.page === 'boards') {
this.filteredSearchTokenKeys = gl.FilteredSearchTokenKeysIssuesEE; this.filteredSearchTokenKeys = gl.FilteredSearchTokenKeysIssuesEE;
...@@ -47,7 +48,7 @@ class FilteredSearchDropdownManager { ...@@ -47,7 +48,7 @@ class FilteredSearchDropdownManager {
reference: null, reference: null,
gl: 'DropdownNonUser', gl: 'DropdownNonUser',
extraArguments: { extraArguments: {
endpoint: `${this.baseEndpoint}/milestones.json?only_group_milestones=true`, endpoint: `${this.baseEndpoint}/milestones.json${this.groupsOnly ? '?only_group_milestones=true' : ''}`,
symbol: '%', symbol: '%',
}, },
element: this.container.querySelector('#js-dropdown-milestone'), element: this.container.querySelector('#js-dropdown-milestone'),
...@@ -56,7 +57,7 @@ class FilteredSearchDropdownManager { ...@@ -56,7 +57,7 @@ class FilteredSearchDropdownManager {
reference: null, reference: null,
gl: 'DropdownNonUser', gl: 'DropdownNonUser',
extraArguments: { extraArguments: {
endpoint: `${this.baseEndpoint}/labels.json?only_group_labels=true`, endpoint: `${this.baseEndpoint}/labels.json${this.groupsOnly ? '?only_group_labels=true' : ''}`,
symbol: '~', symbol: '~',
preprocessing: gl.DropdownUtils.duplicateLabelPreprocessing, preprocessing: gl.DropdownUtils.duplicateLabelPreprocessing,
}, },
......
...@@ -63,7 +63,12 @@ class FilteredSearchManager { ...@@ -63,7 +63,12 @@ class FilteredSearchManager {
if (this.filteredSearchInput) { if (this.filteredSearchInput) {
this.tokenizer = gl.FilteredSearchTokenizer; this.tokenizer = gl.FilteredSearchTokenizer;
this.dropdownManager = new gl.FilteredSearchDropdownManager(this.filteredSearchInput.getAttribute('data-base-endpoint') || '', this.tokenizer, this.page); this.dropdownManager = new gl.FilteredSearchDropdownManager(
this.filteredSearchInput.getAttribute('data-base-endpoint') || '',
this.tokenizer,
this.page,
Boolean(this.filteredSearchInput.getAttribute('data-group-id')),
);
this.recentSearchesRoot = new RecentSearchesRoot( this.recentSearchesRoot = new RecentSearchesRoot(
this.recentSearchesStore, this.recentSearchesStore,
......
- issues_sub_menu_items = ['groups#issues', 'labels#index', 'milestones#index']
- if @group.feature_available?(:group_issue_boards)
- issues_sub_menu_items.push('boards#index')
.nav-sidebar{ class: ("sidebar-icons-only" if collapsed_sidebar?) } .nav-sidebar{ class: ("sidebar-icons-only" if collapsed_sidebar?) }
.nav-sidebar-inner-scroll .nav-sidebar-inner-scroll
.context-header .context-header
...@@ -31,7 +34,7 @@ ...@@ -31,7 +34,7 @@
%span %span
Contribution Analytics Contribution Analytics
= nav_link(path: ['groups#issues', 'boards#index', 'labels#index', 'milestones#index']) do = nav_link(path: issues_sub_menu_items) do
= link_to issues_group_path(@group), title: 'Issues' do = link_to issues_group_path(@group), title: 'Issues' do
.nav-icon-container .nav-icon-container
= custom_icon('issues') = custom_icon('issues')
...@@ -46,10 +49,11 @@ ...@@ -46,10 +49,11 @@
%span %span
List List
= nav_link(path: 'boards#index') do - if @group.feature_available?(:group_issue_boards)
= link_to group_boards_path(@group), title: 'Boards' do = nav_link(path: 'boards#index') do
%span = link_to group_boards_path(@group), title: 'Boards' do
Boards %span
Boards
= nav_link(path: 'labels#index') do = nav_link(path: 'labels#index') do
= link_to group_labels_path(@group), title: 'Labels' do = link_to group_labels_path(@group), title: 'Labels' do
......
require 'spec_helper'
describe 'layouts/nav/_new_group_sidebar' do
before do
assign(:group, create(:group))
end
describe 'group issue boards link' do
it 'is not visible when there is no valid license' do
stub_licensed_features(group_issue_boards: false)
render
expect(rendered).not_to have_text 'Boards'
end
it 'is not visible when there is no valid license' do
stub_licensed_features(group_issue_boards: true)
render
expect(rendered).to have_text 'Boards'
end
end
end
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