forked from guardian/grid
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request guardian#4285 from bbc/t1535-special-instructions
t1535 - Adds functionality that allows some restrictions text and special instructions text to be defined in config against the rights category and then displayed accordingly in metadata panel
- Loading branch information
Showing
24 changed files
with
433 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
kahuna/public/js/components/gr-image-cost-message/gr-image-cost-message.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<div ng-switch="messageState"> | ||
<div ng-switch="ctrl.messageState"> | ||
<div ng-switch-when="conditional" | ||
class="image-notice image-info__group cost cost--conditional" | ||
title="This image can be used but only within certain restrictions"> | ||
<b>Restricted use:</b> {{image.data.usageRights.restrictions}} | ||
<b>Restricted use:</b> {{ctrl.restrictionsText()}} | ||
</div> | ||
</div> |
32 changes: 25 additions & 7 deletions
32
kahuna/public/js/components/gr-image-cost-message/gr-image-cost-message.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,39 @@ | ||
import angular from 'angular'; | ||
import {imageService} from '../../image/service'; | ||
import {restrictionsText} from '../../util/rights-categories'; | ||
|
||
import template from './gr-image-cost-message.html'; | ||
import './gr-image-cost-message.css'; | ||
|
||
export const module = angular.module('gr.imageCostMessage', []); | ||
export const module = angular.module('gr.imageCostMessage', [imageService.name]); | ||
|
||
module.directive('grImageCostMessage', ['imageService', function (imageService) { | ||
module.controller('grImageCostMessage', [ | ||
'imageService', | ||
|
||
function (imageService) { | ||
let ctrl = this; | ||
|
||
ctrl.$onInit = () => { | ||
const states = imageService(ctrl.image).states; | ||
ctrl.messageState = (states.hasRestrictions) ? "conditional" : states.costState; | ||
ctrl.restrictionsText = () => { | ||
return restrictionsText(this.image); | ||
}; | ||
|
||
}; | ||
} | ||
]); | ||
|
||
module.directive('grImageCostMessage', [function () { | ||
return { | ||
restrict: 'E', | ||
template: template, | ||
transclude: true, | ||
link: scope => { | ||
const { states } = imageService(scope.image); | ||
scope.messageState = states.costState; | ||
}, | ||
scope: { | ||
image: '=grImage' | ||
} | ||
}, | ||
controller: 'grImageCostMessage', | ||
controllerAs: 'ctrl', | ||
bindToController: true | ||
}; | ||
}]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.