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
67c59014
Commit
67c59014
authored
Mar 14, 2017
by
Robert Knight
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert `<sort-dropdown>` to a component
parent
65c354de
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
20 deletions
+18
-20
app.js
src/sidebar/app.js
+1
-1
sort-dropdown.js
src/sidebar/directive/sort-dropdown.js
+12
-14
sort-dropdown-test.js
src/sidebar/directive/test/sort-dropdown-test.js
+1
-1
sort_dropdown.html
src/sidebar/templates/sort_dropdown.html
+4
-4
No files found.
src/sidebar/app.js
View file @
67c59014
...
...
@@ -151,6 +151,7 @@ module.exports = angular.module('h', [
.
component
(
'selectionTabs'
,
require
(
'./directive/selection-tabs'
))
.
component
(
'sidebarTutorial'
,
require
(
'./directive/sidebar-tutorial'
).
component
)
.
component
(
'shareDialog'
,
require
(
'./directive/share-dialog'
))
.
component
(
'sortDropdown'
,
require
(
'./directive/sort-dropdown'
))
.
component
(
'timestamp'
,
require
(
'./directive/timestamp'
))
.
directive
(
'excerpt'
,
require
(
'./directive/excerpt'
).
directive
)
...
...
@@ -161,7 +162,6 @@ module.exports = angular.module('h', [
.
directive
(
'hOnTouch'
,
require
(
'./directive/h-on-touch'
))
.
directive
(
'hTooltip'
,
require
(
'./directive/h-tooltip'
))
.
directive
(
'markdown'
,
require
(
'./directive/markdown'
))
.
directive
(
'sortDropdown'
,
require
(
'./directive/sort-dropdown'
))
.
directive
(
'spinner'
,
require
(
'./directive/spinner'
))
.
directive
(
'statusButton'
,
require
(
'./directive/status-button'
))
.
directive
(
'svgIcon'
,
require
(
'./directive/svg-icon'
))
...
...
src/sidebar/directive/sort-dropdown.js
View file @
67c59014
'use strict'
;
module
.
exports
=
function
()
{
return
{
controller
:
function
()
{},
restrict
:
'E'
,
scope
:
{
/** The name of the currently selected sort key. */
sortKey
:
'<'
,
/** A list of possible keys that the user can opt to sort by. */
sortKeysAvailable
:
'<'
,
/** Called when the user changes the sort key. */
onChangeSortKey
:
'&'
,
},
template
:
require
(
'../templates/sort_dropdown.html'
),
};
module
.
exports
=
{
controllerAs
:
'vm'
,
controller
:
function
()
{},
bindings
:
{
/** The name of the currently selected sort key. */
sortKey
:
'<'
,
/** A list of possible keys that the user can opt to sort by. */
sortKeysAvailable
:
'<'
,
/** Called when the user changes the sort key. */
onChangeSortKey
:
'&'
,
},
template
:
require
(
'../templates/sort_dropdown.html'
),
};
src/sidebar/directive/test/sort-dropdown-test.js
View file @
67c59014
...
...
@@ -7,7 +7,7 @@ var util = require('./util');
describe
(
'sortDropdown'
,
function
()
{
before
(
function
()
{
angular
.
module
(
'app'
,
[])
.
directive
(
'sortDropdown'
,
require
(
'../sort-dropdown'
));
.
component
(
'sortDropdown'
,
require
(
'../sort-dropdown'
));
});
beforeEach
(
function
()
{
...
...
src/sidebar/templates/sort_dropdown.html
View file @
67c59014
...
...
@@ -3,16 +3,16 @@
type=
"button"
class=
"top-bar__btn"
dropdown-toggle
title=
"Sort by {{sortKey}}"
>
title=
"Sort by {{
vm.
sortKey}}"
>
<i
class=
"h-icon-sort"
></i>
</button>
<div
class=
"dropdown-menu__top-arrow"
></div>
<ul
class=
"dropdown-menu pull-right"
role=
"menu"
>
<li
class=
"dropdown-menu__row"
ng-repeat=
"key in sortKeysAvailable"
ng-click=
"onChangeSortKey({sortKey: key})"
ng-repeat=
"key in
vm.
sortKeysAvailable"
ng-click=
"
vm.
onChangeSortKey({sortKey: key})"
><span
class=
"dropdown-menu-radio"
ng-class=
"{'is-selected' : sortKey === key}"
ng-class=
"{'is-selected' :
vm.
sortKey === key}"
></span><a
class=
"dropdown-menu__link"
href=
""
>
{{key}}
</a></li>
</ul>
</span>
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