Commit 94673392 authored by Phil Hughes's avatar Phil Hughes

Hides label for current list

Added confidential icon
Fixed assignee tooltip
Updates some tests
parent 1faf67f0
(function () { (function () {
const BoardCard = Vue.extend({ const BoardCard = Vue.extend({
props: { props: {
list: Object,
issue: Object, issue: Object,
issueLinkBase: String, issueLinkBase: String,
disabled: Boolean disabled: Boolean
......
...@@ -2,6 +2,7 @@ class Issue { ...@@ -2,6 +2,7 @@ class Issue {
constructor (obj) { constructor (obj) {
this.id = obj.iid; this.id = obj.iid;
this.title = obj.title; this.title = obj.title;
this.confidential = obj.confidential;
if (obj.assignee) { if (obj.assignee) {
this.assignee = new User(obj.assignee); this.assignee = new User(obj.assignee);
......
...@@ -277,6 +277,10 @@ ...@@ -277,6 +277,10 @@
border: 0; border: 0;
outline: 0; outline: 0;
} }
.confidential-icon {
margin-right: 5px;
}
} }
.board-mobile-handle { .board-mobile-handle {
......
%board-card{ "inline-template" => true, %board-card{ "inline-template" => true,
"v-for" => "issue in issues | orderBy 'priority'", "v-for" => "issue in issues | orderBy 'priority'",
":list" => "list",
":issue" => "issue", ":issue" => "issue",
":issue-link-base" => "issueLinkBase", ":issue-link-base" => "issueLinkBase",
":disabled" => "disabled", ":disabled" => "disabled",
...@@ -8,6 +9,7 @@ ...@@ -8,6 +9,7 @@
":class" => "{ 'user-can-drag': !disabled }" } ":class" => "{ 'user-can-drag': !disabled }" }
= icon("align-justify", class: "board-mobile-handle js-card-drag-handle", "v-if" => "!disabled") = icon("align-justify", class: "board-mobile-handle js-card-drag-handle", "v-if" => "!disabled")
%h4.card-title %h4.card-title
= icon("eye-slash", class: "confidential-icon", "v-if" => "issue.confidential")
%a{ ":href" => "issueLinkBase + '/' + issue.id", %a{ ":href" => "issueLinkBase + '/' + issue.id",
":title" => "issue.title" } ":title" => "issue.title" }
{{ issue.title }} {{ issue.title }}
...@@ -17,6 +19,7 @@ ...@@ -17,6 +19,7 @@
{{ issue.id }} {{ issue.id }}
%button.label.color-label.has-tooltip{ "v-for" => "label in issue.labels", %button.label.color-label.has-tooltip{ "v-for" => "label in issue.labels",
type: "button", type: "button",
"v-if" => "(!list.label || label.id !== list.label.id)",
"@click" => "filterByLabel(label, $event)", "@click" => "filterByLabel(label, $event)",
":style" => "{ backgroundColor: label.color, color: label.textColor }", ":style" => "{ backgroundColor: label.color, color: label.textColor }",
":title" => "label.description", ":title" => "label.description",
...@@ -24,5 +27,6 @@ ...@@ -24,5 +27,6 @@
{{ label.title }} {{ label.title }}
%a.has-tooltip{ ":href" => "'/u/' + issue.assignee.username", %a.has-tooltip{ ":href" => "'/u/' + issue.assignee.username",
":title" => "'Assigned to ' + issue.assignee.name", ":title" => "'Assigned to ' + issue.assignee.name",
"v-if" => "issue.assignee" } "v-if" => "issue.assignee",
data: { container: 'body' } }
%img.avatar.avatar-inline.s20{ ":src" => "issue.assignee.avatar", width: 20, height: 20 } %img.avatar.avatar-inline.s20{ ":src" => "issue.assignee.avatar", width: 20, height: 20 }
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
- content_for :page_specific_javascripts do - content_for :page_specific_javascripts do
= page_specific_javascript_tag('boards/boards_bundle.js') = page_specific_javascript_tag('boards/boards_bundle.js')
= page_specific_javascript_tag('boards/test_utils/simulate_drag.js') = page_specific_javascript_tag('boards/test_utils/simulate_drag.js') if Rails.env.test?
= render "projects/issues/head" = render "projects/issues/head"
......
...@@ -54,6 +54,7 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -54,6 +54,7 @@ describe 'Issue Boards', feature: true, js: true do
let!(:list1) { create(:list, board: project.board, label: planning, position: 0) } let!(:list1) { create(:list, board: project.board, label: planning, position: 0) }
let!(:list2) { create(:list, board: project.board, label: development, position: 1) } let!(:list2) { create(:list, board: project.board, label: development, position: 1) }
let!(:confidential_issue) { create(:issue, :confidential, project: project, author: user) }
let!(:issue1) { create(:issue, project: project, assignee: user) } let!(:issue1) { create(:issue, project: project, assignee: user) }
let!(:issue2) { create(:issue, project: project, author: user2) } let!(:issue2) { create(:issue, project: project, author: user2) }
let!(:issue3) { create(:issue, project: project) } let!(:issue3) { create(:issue, project: project) }
...@@ -86,6 +87,12 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -86,6 +87,12 @@ describe 'Issue Boards', feature: true, js: true do
end end
end end
it 'shows confidential issues with icon' do
page.within(first('.board')) do
expect(page).to have_selector('.confidential-icon', count: 1)
end
end
it 'allows user to delete board' do it 'allows user to delete board' do
page.within(all('.board')[1]) do page.within(all('.board')[1]) do
find('.board-delete').click find('.board-delete').click
...@@ -115,8 +122,8 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -115,8 +122,8 @@ describe 'Issue Boards', feature: true, js: true do
context 'backlog' do context 'backlog' do
it 'shows issues in backlog with no labels' do it 'shows issues in backlog with no labels' do
page.within(first('.board')) do page.within(first('.board')) do
expect(page.find('.board-header')).to have_content('5') expect(page.find('.board-header')).to have_content('6')
expect(page).to have_selector('.card', count: 5) expect(page).to have_selector('.card', count: 6)
end end
end end
...@@ -136,7 +143,7 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -136,7 +143,7 @@ describe 'Issue Boards', feature: true, js: true do
find('.board-search-clear-btn').click find('.board-search-clear-btn').click
expect(page).to have_selector('.card', count: 2) expect(page).to have_selector('.card', count: 6)
end end
end end
...@@ -144,8 +151,8 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -144,8 +151,8 @@ describe 'Issue Boards', feature: true, js: true do
drag_to(list_to_index: 1) drag_to(list_to_index: 1)
page.within(first('.board')) do page.within(first('.board')) do
expect(page.find('.board-header')).to have_content('3') expect(page.find('.board-header')).to have_content('5')
expect(page).to have_selector('.card', count: 3) expect(page).to have_selector('.card', count: 5)
end end
page.within(all('.board')[1]) do page.within(all('.board')[1]) do
...@@ -168,7 +175,7 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -168,7 +175,7 @@ describe 'Issue Boards', feature: true, js: true do
drag_to(list_from_index: 0, list_to_index: 3) drag_to(list_from_index: 0, list_to_index: 3)
expect(all('.board').last).to have_selector('.card', count: 2) expect(all('.board').last).to have_selector('.card', count: 2)
expect(all('.board').last).to have_content(issue4.title) expect(all('.board').last).to have_content(issue9.title)
expect(all('.board').last).not_to have_content(planning.title) expect(all('.board').last).not_to have_content(planning.title)
end end
...@@ -195,8 +202,8 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -195,8 +202,8 @@ describe 'Issue Boards', feature: true, js: true do
expect(all('.board')[1]).to have_selector('.card', count: 1) expect(all('.board')[1]).to have_selector('.card', count: 1)
expect(all('.board')[2]).to have_selector('.card', count: 3) expect(all('.board')[2]).to have_selector('.card', count: 3)
expect(all('.board')[2]).to have_content(issue5.title) expect(all('.board')[2]).to have_content(issue6.title)
expect(all('.board')[2].all('.card').last).to have_content(development.title) expect(all('.board')[2].all('.card').last).not_to have_content(development.title)
end end
it 'moves between lists' do it 'moves between lists' do
...@@ -205,7 +212,7 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -205,7 +212,7 @@ describe 'Issue Boards', feature: true, js: true do
expect(all('.board')[1]).to have_selector('.card', count: 3) expect(all('.board')[1]).to have_selector('.card', count: 3)
expect(all('.board')[2]).to have_selector('.card', count: 1) expect(all('.board')[2]).to have_selector('.card', count: 1)
expect(all('.board')[1]).to have_content(issue7.title) expect(all('.board')[1]).to have_content(issue7.title)
expect(all('.board')[1].all('.card').first).to have_content(planning.title) expect(all('.board')[1].all('.card').first).not_to have_content(planning.title)
end end
it 'moves from done' do it 'moves from done' do
...@@ -219,7 +226,7 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -219,7 +226,7 @@ describe 'Issue Boards', feature: true, js: true do
context 'issue card' do context 'issue card' do
it 'shows assignee' do it 'shows assignee' do
page.within(first('.board')) do page.within(first('.board')) do
expect(all('.card').last).to have_selector('.avatar') expect(page).to have_selector('.avatar', count: 1)
end end
end end
end end
...@@ -247,8 +254,8 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -247,8 +254,8 @@ describe 'Issue Boards', feature: true, js: true do
it 'moves issues from backlog into new list' do it 'moves issues from backlog into new list' do
page.within(first('.board')) do page.within(first('.board')) do
expect(page.find('.board-header')).to have_content('5') expect(page.find('.board-header')).to have_content('6')
expect(page).to have_selector('.card', count: 5) expect(page).to have_selector('.card', count: 6)
end end
click_button 'Create new list' click_button 'Create new list'
...@@ -258,8 +265,8 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -258,8 +265,8 @@ describe 'Issue Boards', feature: true, js: true do
end end
page.within(first('.board')) do page.within(first('.board')) do
expect(page.find('.board-header')).to have_content('4') expect(page.find('.board-header')).to have_content('5')
expect(page).to have_selector('.card', count: 4) expect(page).to have_selector('.card', count: 5)
end end
end end
end end
...@@ -390,8 +397,8 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -390,8 +397,8 @@ describe 'Issue Boards', feature: true, js: true do
end end
page.within(first('.board')) do page.within(first('.board')) do
expect(page.find('.board-header')).to have_content('2') expect(page.find('.board-header')).to have_content('1')
expect(page).to have_selector('.card', count: 2) expect(page).to have_selector('.card', count: 1)
end end
page.within(all('.board')[1]) do page.within(all('.board')[1]) do
...@@ -411,8 +418,8 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -411,8 +418,8 @@ describe 'Issue Boards', feature: true, js: true do
end end
page.within(first('.board')) do page.within(first('.board')) do
expect(page.find('.board-header')).to have_content('4') expect(page.find('.board-header')).to have_content('5')
expect(page).to have_selector('.card', count: 4) expect(page).to have_selector('.card', count: 5)
end end
page.within(all('.board')[1]) do page.within(all('.board')[1]) do
...@@ -442,11 +449,9 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -442,11 +449,9 @@ describe 'Issue Boards', feature: true, js: true do
end end
page.within(first('.board')) do page.within(first('.board')) do
page.within(first('.card')) do click_button(bug.title)
click_button(bug.title)
end
expect(page).to have_selector('.card', count: 5) expect(page).to have_selector('.card', count: 6)
end end
page.within('.labels-filter') do page.within('.labels-filter') do
......
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