Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Mirador Video
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
IIIF
Mirador
Mirador Video
Commits
21e53d9f
Commit
21e53d9f
authored
5 years ago
by
Chris Beer
Browse files
Options
Downloads
Patches
Plain Diff
Support manifest-level behaviors when selecting a default window view type
Fixes #3028
parent
b56d147d
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
__tests__/src/selectors/manifests.test.js
+8
-0
8 additions, 0 deletions
__tests__/src/selectors/manifests.test.js
src/state/selectors/manifests.js
+20
-0
20 additions, 0 deletions
src/state/selectors/manifests.js
src/state/selectors/windows.js
+11
-3
11 additions, 3 deletions
src/state/selectors/windows.js
with
39 additions
and
3 deletions
__tests__/src/selectors/manifests.test.js
+
8
−
0
View file @
21e53d9f
...
...
@@ -27,6 +27,7 @@ import {
getManifestUrl
,
getManifestViewingDirection
,
getManifestViewingHint
,
getManifestBehaviors
,
getManifestTreeStructure
,
getMetadataLocales
,
getRequiredStatement
,
...
...
@@ -505,6 +506,13 @@ describe('getManifestViewingHint', () => {
});
});
describe
(
'
getManifestBehaviors
'
,
()
=>
{
it
(
'
gets from the manifest
'
,
()
=>
{
const
state
=
{
manifests
:
{
x
:
{
json
:
manifestFixturev3001
}
}
};
expect
(
getManifestBehaviors
(
state
,
{
manifestId
:
'
x
'
})).
toEqual
([
'
individuals
'
]);
});
});
describe
(
'
getManifestViewingDirection
'
,
()
=>
{
it
(
'
gets from the manifest
'
,
()
=>
{
const
state
=
{
manifests
:
{
x
:
{
json
:
manifestFixture001
}
}
};
...
...
This diff is collapsed.
Click to expand it.
src/state/selectors/manifests.js
+
20
−
0
View file @
21e53d9f
...
...
@@ -418,6 +418,26 @@ export const getManifestViewingHint = createSelector(
},
);
/**
* Returns the behaviors viewing hint for the manifest
* @param {object} state
* @param {object} props
* @param {string} props.manifestId
* @param {string} props.windowId
* @return {Number}
*/
export
const
getManifestBehaviors
=
createSelector
(
[
getManifestoInstance
],
(
manifest
)
=>
{
if
(
!
manifest
)
return
[];
const
behaviors
=
manifest
.
getProperty
(
'
behavior
'
);
if
(
!
behaviors
)
return
[];
if
(
Array
.
isArray
(
behaviors
))
return
behaviors
;
return
[
behaviors
];
},
);
export
const
getManifestViewingDirection
=
createSelector
(
[
getManifestoInstance
],
(
manifest
)
=>
{
...
...
This diff is collapsed.
Click to expand it.
src/state/selectors/windows.js
+
11
−
3
View file @
21e53d9f
import
{
createSelector
}
from
'
reselect
'
;
import
{
getManifestTitle
,
getManifestViewingHint
,
getManifestoInstance
}
from
'
./manifests
'
;
import
{
getManifestTitle
,
getManifestBehaviors
,
getManifestViewingHint
,
getManifestoInstance
,
}
from
'
./manifests
'
;
import
{
getDefaultView
}
from
'
./config
'
;
import
{
getWorkspaceType
}
from
'
./workspace
'
;
...
...
@@ -78,14 +83,17 @@ export const getWindowViewType = createSelector(
[
getWindow
,
getManifestViewingHint
,
getManifestBehaviors
,
getDefaultView
,
],
(
window
,
manifestViewingHint
,
defaultView
)
=>
{
(
window
,
manifestViewingHint
,
manifestBehaviors
,
defaultView
)
=>
{
const
lookup
=
{
individuals
:
'
single
'
,
paged
:
'
book
'
,
};
return
(
window
&&
window
.
view
)
||
lookup
[
manifestViewingHint
]
||
defaultView
;
return
(
window
&&
window
.
view
)
||
lookup
[
manifestBehaviors
.
find
(
b
=>
lookup
[
b
])
||
manifestViewingHint
]
||
defaultView
;
},
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment