Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
228b0b12
Commit
228b0b12
authored
Mar 20, 2019
by
Hannah Stepanek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add group section
parent
b2088898
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
131 additions
and
0 deletions
+131
-0
group-list-section.js
src/sidebar/components/group-list-section.js
+23
-0
group-list-section-test.js
src/sidebar/components/test/group-list-section-test.js
+71
-0
group-list-section.html
src/sidebar/templates/group-list-section.html
+23
-0
group-list-section.scss
src/styles/sidebar/components/group-list-section.scss
+14
-0
No files found.
src/sidebar/components/group-list-section.js
0 → 100644
View file @
228b0b12
'use strict'
;
// @ngInject
function
GroupListSectionController
()
{
this
.
isSelectable
=
function
(
groupId
)
{
const
group
=
this
.
sectionGroups
.
find
(
g
=>
g
.
id
===
groupId
);
return
!
this
.
disableOosGroupSelection
||
group
.
isScopedToUri
;
};
}
module
.
exports
=
{
controller
:
GroupListSectionController
,
controllerAs
:
'vm'
,
bindings
:
{
/* The list of groups to be displayed in the group list section. */
sectionGroups
:
'<'
,
/* The string name of the group list section. */
heading
:
'<'
,
/* A boolean indicating whether out of scope group selection should be disabled. */
disableOosGroupSelection
:
'<'
,
},
template
:
require
(
'../templates/group-list-section.html'
),
};
src/sidebar/components/test/group-list-section-test.js
0 → 100644
View file @
228b0b12
'use strict'
;
const
angular
=
require
(
'angular'
);
const
groupListSection
=
require
(
'../group-list-section'
);
const
util
=
require
(
'../../directive/test/util'
);
describe
(
'groupListSection'
,
()
=>
{
before
(()
=>
{
angular
.
module
(
'app'
,
[]).
component
(
'groupListSection'
,
groupListSection
);
});
beforeEach
(()
=>
{
angular
.
mock
.
module
(
'app'
,
{});
});
const
createGroupListSection
=
(
fakeSectionGroups
,
fakeDisableOosGroupSelection
)
=>
{
const
config
=
{
sectionGroups
:
fakeSectionGroups
,
};
if
(
fakeDisableOosGroupSelection
!==
undefined
)
{
config
.
disableOosGroupSelection
=
fakeDisableOosGroupSelection
;
}
return
util
.
createDirective
(
document
,
'groupListSection'
,
config
);
};
describe
(
'isSelectable'
,
()
=>
{
[
{
description
:
'always returns true if disableOosGroupSelection is false'
,
fakeDisableOosGroupSelection
:
false
,
expectedIsSelectable
:
[
true
,
true
],
},
{
description
:
'always returns true if disableOosGroupSelection is undefined'
,
fakeDisableOosGroupSelection
:
undefined
,
expectedIsSelectable
:
[
true
,
true
],
},
{
description
:
'returns false if disableOosGroupSelection is true and group is out of scope'
,
fakeDisableOosGroupSelection
:
true
,
expectedIsSelectable
:
[
true
,
false
],
},
].
forEach
(
({
description
,
fakeDisableOosGroupSelection
,
expectedIsSelectable
})
=>
{
it
(
description
,
()
=>
{
const
fakeSectionGroups
=
[
{
isScopedToUri
:
true
,
id
:
0
},
{
isScopedToUri
:
false
,
id
:
1
},
];
const
element
=
createGroupListSection
(
fakeSectionGroups
,
fakeDisableOosGroupSelection
);
fakeSectionGroups
.
forEach
(
g
=>
assert
.
equal
(
element
.
ctrl
.
isSelectable
(
g
.
id
),
expectedIsSelectable
[
g
.
id
]
)
);
});
}
);
});
});
src/sidebar/templates/group-list-section.html
0 → 100644
View file @
228b0b12
<h2
class=
"group-list-section__heading"
>
{{ vm.heading }}
</h2>
<ul
class=
"group-list-section__content"
>
<li
class=
"dropdown-menu__row dropdown-menu__row--no-border dropdown-menu__row--unpadded"
ng-repeat=
"group in vm.sectionGroups track by group.id"
>
<group-list-item
class=
"group-list-item"
group=
"group"
ng-if=
"vm.isSelectable(group.id)"
>
</group-list-item>
<group-list-item-out-of-scope
class=
"group-list-item-out-of-scope"
group=
"group"
ng-if=
"!vm.isSelectable(group.id)"
>
</group-list-item-out-of-scope>
</li>
</ul>
src/styles/sidebar/components/group-list-section.scss
0 → 100644
View file @
228b0b12
/* The groups section. */
.group-list-section__content
{
border-bottom
:
solid
1px
rgba
(
0
,
0
,
0
,
0
.15
);
}
.group-list-section__heading
{
color
:
$gray-light
;
font-size
:
$body1-font-size
;
line-height
:
1
;
margin
:
1px
1px
0
;
padding
:
12px
10px
0
;
text-transform
:
uppercase
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment