diff --git a/app/assets/javascripts/digital_objects_app/models/digital_object/asset.js b/app/assets/javascripts/digital_objects_app/models/digital_object/asset.js index 52734540e..286280491 100644 --- a/app/assets/javascripts/digital_objects_app/models/digital_object/asset.js +++ b/app/assets/javascripts/digital_objects_app/models/digital_object/asset.js @@ -87,7 +87,7 @@ Hyacinth.DigitalObjectsApp.DigitalObject.Asset.prototype.getOriginalFilePath = f }; Hyacinth.DigitalObjectsApp.DigitalObject.Asset.prototype.hasImage = function () { - return Hyacinth.imageServerUrl && this.getDcType() == 'StillImage'; + return Hyacinth.imageServerUrl && this.isStillImage(); }; Hyacinth.DigitalObjectsApp.DigitalObject.Asset.prototype.isRestrictedSizeImage = function () { diff --git a/app/assets/javascripts/digital_objects_app/models/digital_object/base.js b/app/assets/javascripts/digital_objects_app/models/digital_object/base.js index 5aea1a173..bda88ae6c 100644 --- a/app/assets/javascripts/digital_objects_app/models/digital_object/base.js +++ b/app/assets/javascripts/digital_objects_app/models/digital_object/base.js @@ -76,6 +76,14 @@ Hyacinth.DigitalObjectsApp.DigitalObject.Base.prototype.getStateAsDisplayLabel = return statesToDisplayLabels[this.getState()]; }; +Hyacinth.DigitalObjectsApp.DigitalObject.Base.prototype.isAudioMovingImage = function () { + return ['Audio','MovingImage', 'Sound', 'Video'].includes(this.dc_type); +}; + +Hyacinth.DigitalObjectsApp.DigitalObject.Base.prototype.isStillImage = function () { + return ['Image','StillImage'].includes(this.dc_type); +}; + Hyacinth.DigitalObjectsApp.DigitalObject.Base.prototype.isNewRecord = function () { return (this.getPid() == null); }; diff --git a/app/assets/javascripts/digital_objects_app/models/digital_object_search_result.js b/app/assets/javascripts/digital_objects_app/models/digital_object_search_result.js index 534029fa2..895ee4aa9 100644 --- a/app/assets/javascripts/digital_objects_app/models/digital_object_search_result.js +++ b/app/assets/javascripts/digital_objects_app/models/digital_object_search_result.js @@ -18,6 +18,14 @@ Hyacinth.DigitalObjectsApp.DigitalObjectSearchResult.prototype.getDcType = funct return this.dcType; }; +Hyacinth.DigitalObjectsApp.DigitalObjectSearchResult.prototype.isAudioMovingImage = function(){ + return ['Audio','MovingImage', 'Sound', 'Video'].includes(this.dcType); +}; + +Hyacinth.DigitalObjectsApp.DigitalObjectSearchResult.prototype.isStillImage = function(){ + return ['Image', 'StillImage'].includes(this.dcType); +}; + Hyacinth.DigitalObjectsApp.DigitalObjectSearchResult.prototype.getPid = function(){ return this.pid; }; diff --git a/app/assets/javascripts/digital_objects_app/widgets/digital_object_annotation_editor.js b/app/assets/javascripts/digital_objects_app/widgets/digital_object_annotation_editor.js index 07238c8f4..9dceddc06 100644 --- a/app/assets/javascripts/digital_objects_app/widgets/digital_object_annotation_editor.js +++ b/app/assets/javascripts/digital_objects_app/widgets/digital_object_annotation_editor.js @@ -36,7 +36,7 @@ Hyacinth.DigitalObjectsApp.DigitalObjectAnnotationEditor.prototype.init = functi this.$containerElement.addClass(Hyacinth.DigitalObjectsApp.DigitalObjectAnnotationEditor.ANNOTATION_EDITOR_ELEMENT_CLASS); //Add class to container element this.$containerElement.data(Hyacinth.DigitalObjectsApp.DigitalObjectAnnotationEditor.ANNOTATION_EDITOR_DATA_KEY, this); //Assign this editor object as data to the container element so that we can access it later - if(['MovingImage', 'Sound'].indexOf(this.digitalObject.getDcType()) > -1) { + if(this.digitalObject.isAudioMovingImage()) { this.$containerElement.html( Hyacinth.DigitalObjectsApp.renderTemplate('digital_objects_app/widgets/digital_object_annotation_editor/oh_synchronizer_index_mode.ejs', { digitalObject: this.digitalObject, diff --git a/app/assets/javascripts/digital_objects_app/widgets/digital_object_synchronized_transcript_editor.js b/app/assets/javascripts/digital_objects_app/widgets/digital_object_synchronized_transcript_editor.js index 523f4c249..8f6c6a9f5 100644 --- a/app/assets/javascripts/digital_objects_app/widgets/digital_object_synchronized_transcript_editor.js +++ b/app/assets/javascripts/digital_objects_app/widgets/digital_object_synchronized_transcript_editor.js @@ -36,7 +36,7 @@ Hyacinth.DigitalObjectsApp.DigitalObjectSynchronizedTranscriptEditor.prototype.i this.$containerElement.addClass(Hyacinth.DigitalObjectsApp.DigitalObjectSynchronizedTranscriptEditor.SYNCHRONIZED_TRANSCRIPT_EDITOR_ELEMENT_CLASS); //Add class to container element this.$containerElement.data(Hyacinth.DigitalObjectsApp.DigitalObjectSynchronizedTranscriptEditor.SYNCHRONIZED_TRANSCRIPT_EDITOR_DATA_KEY, this); //Assign this editor object as data to the container element so that we can access it later - if (['MovingImage', 'Sound'].indexOf(this.digitalObject.getDcType()) > -1) { + if(this.digitalObject.isAudioMovingImage()) { this.$containerElement.html( Hyacinth.DigitalObjectsApp.renderTemplate('digital_objects_app/widgets/digital_object_synchronized_transcript_editor/oh_synchronizer_transcript_mode.ejs', { digitalObject: this.digitalObject, diff --git a/app/assets/templates/digital_objects_app/digital_objects/show.ejs b/app/assets/templates/digital_objects_app/digital_objects/show.ejs index 9cff5f970..22da8c797 100644 --- a/app/assets/templates/digital_objects_app/digital_objects/show.ejs +++ b/app/assets/templates/digital_objects_app/digital_objects/show.ejs @@ -23,22 +23,21 @@ if (digitalObject.digital_object_type.string_key == 'asset') { Hyacinth.DigitalObjectsApp.paramsToHashValue({controller: 'digital_objects', action: 'manage_transcript', pid: Hyacinth.DigitalObjectsApp.params['pid']})}); -} - -if (digitalObject.digital_object_type.string_key == 'asset' && (digitalObject.getDcType() == 'MovingImage' || digitalObject.getDcType() == 'Sound')) { - navItems.push({label: ' Annotation', url: '#' + - Hyacinth.DigitalObjectsApp.paramsToHashValue({controller: 'digital_objects', - action: 'manage_annotation', - pid: Hyacinth.DigitalObjectsApp.params['pid']})}); + if (digitalObject.isAudioMovingImage()) { + navItems.push({label: ' Annotation', url: '#' + + Hyacinth.DigitalObjectsApp.paramsToHashValue({controller: 'digital_objects', + action: 'manage_annotation', + pid: Hyacinth.DigitalObjectsApp.params['pid']})}); - navItems.push({label: ' Synchronized Transcript', url: '#' + - Hyacinth.DigitalObjectsApp.paramsToHashValue({controller: 'digital_objects', - action: 'manage_synchronized_transcript', - pid: Hyacinth.DigitalObjectsApp.params['pid']})}); - navItems.push({label: ' Captions', url: '#' + - Hyacinth.DigitalObjectsApp.paramsToHashValue({controller: 'digital_objects', - action: 'manage_captions', - pid: Hyacinth.DigitalObjectsApp.params['pid']})}); + navItems.push({label: ' Synchronized Transcript', url: '#' + + Hyacinth.DigitalObjectsApp.paramsToHashValue({controller: 'digital_objects', + action: 'manage_synchronized_transcript', + pid: Hyacinth.DigitalObjectsApp.params['pid']})}); + navItems.push({label: ' Captions', url: '#' + + Hyacinth.DigitalObjectsApp.paramsToHashValue({controller: 'digital_objects', + action: 'manage_captions', + pid: Hyacinth.DigitalObjectsApp.params['pid']})}); + } } if (hasUpdatePermission) { diff --git a/app/assets/templates/digital_objects_app/widgets/digital_object_editor/_header.ejs b/app/assets/templates/digital_objects_app/widgets/digital_object_editor/_header.ejs index 0b548e9f7..09a7b48b6 100644 --- a/app/assets/templates/digital_objects_app/widgets/digital_object_editor/_header.ejs +++ b/app/assets/templates/digital_objects_app/widgets/digital_object_editor/_header.ejs @@ -299,7 +299,7 @@