-
Notifications
You must be signed in to change notification settings - Fork 16
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 #77 from MarkLark86/SDESK-3692
[SDESK-3692] Featuremedia Update Report
- Loading branch information
Showing
38 changed files
with
2,278 additions
and
225 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
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
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 |
---|---|---|
@@ -0,0 +1,63 @@ | ||
ArchivePreviewProxy.$inject = ['$compile', 'lodash']; | ||
|
||
/** | ||
* @ngdoc directive | ||
* @module superdesk.apps.analytics | ||
* @name sdaArchivePreviewProxy | ||
* @requires $compile | ||
* @requires lodash | ||
* @description A directive that compiles and renders a preview directive based on | ||
* the scope.preview.type | ||
*/ | ||
export function ArchivePreviewProxy($compile, _) { | ||
return { | ||
scope: { | ||
preview: '=', | ||
close: '=' | ||
}, | ||
link: function(scope, element) { | ||
/** | ||
* @ngdoc method | ||
* @name sdaArchivePreviewProxy#changePreviewDirective | ||
* @description Creates and compiles the angular preview directive | ||
* for the provided preview item/type | ||
*/ | ||
const changePreviewDirective = () => { | ||
const previewType = _.get(scope.preview, 'type'); | ||
let template; | ||
|
||
if (previewType === 'archive') { | ||
// Directive is the same one used in monitoring/search preview | ||
template = ` | ||
<div class="sd-item-preview" | ||
sd-item-preview | ||
data-item="preview.item" | ||
data-close="close()" | ||
data-show-history-tab="true" | ||
data-hide-actions-menu="true" | ||
></div> | ||
`; | ||
} else if (previewType) { | ||
// Custom preview directive | ||
template = `<div sda-${previewType}></div>`; | ||
} | ||
|
||
// Make sure to destroy the existing directive | ||
if (element[0].children.length > 0) { | ||
angular.element(element[0]).empty(); | ||
} | ||
|
||
if (template) { | ||
angular.element(element[0]).append($compile(template)(scope)[0]); | ||
} | ||
}; | ||
|
||
scope.$watch('preview', (newPreview, oldPreview) => { | ||
// Only change the directive if the type has changed | ||
if (_.get(newPreview, 'type') !== _.get(oldPreview, 'type')) { | ||
changePreviewDirective(); | ||
} | ||
}); | ||
}, | ||
}; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import '../styles/renditions-preview.scss'; | ||
|
||
RenditionsPreview.$inject = []; | ||
|
||
/** | ||
* @ngdoc directive | ||
* @module superdesk.apps.analytics | ||
* @name sdaRenditionsPreview | ||
* @description A directive that renders renditions (in a similar way to authoring/editor) | ||
*/ | ||
export function RenditionsPreview() { | ||
return { | ||
template: require('../views/renditions-preview.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
Oops, something went wrong.