From b50fc23a7550a310b4ade5b1c57c31b3735505e5 Mon Sep 17 00:00:00 2001 From: j Date: Wed, 25 Jan 2017 21:49:10 +0100 Subject: [PATCH] icma infoview cleanup --- static/js/infoView.indiancinema.js | 97 +++++++++++++++++------------- 1 file changed, 55 insertions(+), 42 deletions(-) diff --git a/static/js/infoView.indiancinema.js b/static/js/infoView.indiancinema.js index 28a17d07..c09f2221 100644 --- a/static/js/infoView.indiancinema.js +++ b/static/js/infoView.indiancinema.js @@ -385,7 +385,7 @@ pandora.ui.infoView = function(data) { 'screenplay', 'dialogue', 'adaptation' - ]); + ]).css({marginTop: '12px'}); renderGroup([ 'musicdirector', 'backgroundmusic', @@ -417,8 +417,6 @@ pandora.ui.infoView = function(data) { ]); renderGroup([ 'courtesy', - ]); - renderGroup([ 'subtitledby', 'annotatedby', ]); @@ -462,8 +460,41 @@ pandora.ui.infoView = function(data) { $('
').css({height: '16px'}).appendTo($text); + // Documents --------------------------------------------------------------- + + var $div = $('
') + .css({marginBottom: '4px'}) + .append(formatKey( + 'Documents', 'link', '/' + data['id'] + '/documents' + )) + .append( + Ox.Theme.formatColor(null, 'gradient') + .css({textAlign: 'right'}) + .html(Ox.formatNumber(data.numberofdocuments || 0)) + ) + .appendTo($statistics); + + pandora.createLinks($div); + if (data.parts && data.rendered) { - // Duration, Aspect Ratio -------------------------------------------------- + + // Annotations --------------------------------------------------------- + + $div = $('
') + .css({marginBottom: '4px'}) + .append(formatKey( + 'Annotations', 'link', '/' + data['id'] + '/' + ui.videoView + )) + .append( + Ox.Theme.formatColor(null, 'gradient') + .css({textAlign: 'right'}) + .html(Ox.formatNumber(data.numberofannotations || 0)) + ) + .appendTo($statistics); + + pandora.createLinks($div); + + // Duration, Aspect Ratio ---------------------------------------------- ['duration', 'aspectratio'].forEach(function(key) { var itemKey = Ox.getObjectById(pandora.site.itemKeys, key), @@ -482,7 +513,7 @@ pandora.ui.infoView = function(data) { .appendTo($statistics); }); - // Hue, Saturation, Lightness, Volume -------------------------------------- + // Hue, Saturation, Lightness, Volume ---------------------------------- ['hue', 'saturation', 'lightness', 'volume'].forEach(function(key) { var value = data[key] || 0; @@ -496,7 +527,7 @@ pandora.ui.infoView = function(data) { .appendTo($statistics); }); - // Cuts per Minute, Words per Minute --------------------------------------- + // Cuts per Minute, Words per Minute ----------------------------------- ['cutsperminute', 'wordsperminute'].forEach(function(key) { var value = data[key] || 0; @@ -513,47 +544,19 @@ pandora.ui.infoView = function(data) { .appendTo($statistics); }); - $('
') - .css({marginBottom: '4px'}) - .append(formatKey('Annotations', 'statistics')) - .append( - Ox.Theme.formatColor(null, 'gradient') - .css({textAlign: 'right'}) - .html(Ox.formatNumber(data.numberofannotations || 0)) - ) - .appendTo($statistics); } else { // no video placeholder } - $('
') - .css({marginBottom: '4px'}) - .append(formatKey('Documents', 'statistics')) - .append( - Ox.Theme.formatColor(null, 'gradient') - .css({textAlign: 'right'}) - .html(Ox.formatNumber(data.numberofdocuments || 0)) - ) - .on({ - click: function() { - if (data.numberofdocuments) { - pandora.UI.set({ - itemView: 'documents' - }); - } - } - }) - .appendTo($statistics); - - // Rights Level ------------------------------------------------------------ var $rightsLevel = $('
'); - $('
') + var $div = $('
') .css({marginBottom: '4px'}) - .append(formatKey('Rights Level', 'statistics')) + .append(formatKey('Rights Level', 'link', '/copyrights')) .append($rightsLevel) .appendTo($statistics); + pandora.createLinks($div); renderRightsLevel(); // Comments ---------------------------------------------------------------- @@ -653,7 +656,7 @@ pandora.ui.infoView = function(data) { } } - function formatKey(key, mode) { + function formatKey(key, mode, link) { var item = Ox.getObjectById(pandora.site.itemKeys, key); key = Ox._(item ? item.title : key); mode = mode || 'text'; @@ -664,13 +667,20 @@ pandora.ui.infoView = function(data) { } else if (key == 'keyword') { key = 'keywords' } + var value = Ox.toTitleCase(key) + .replace(' Of ', ' of ') + .replace(' Per ', ' per ') return mode == 'text' - ? '' + Ox.toTitleCase(key) + ': ' + ? '' + value + ': ' : mode == 'description' - ? Ox.toTitleCase(key) + ? value + : mode == 'link' + ? Ox.Element() + .css({marginBottom: '4px', fontWeight: 'bold'}) + .html('' + value + '') : Ox.Element() .css({marginBottom: '4px', fontWeight: 'bold'}) - .html(Ox.toTitleCase(key).replace(' Per ', ' per ')); + .html(value); } function formatLight(str) { @@ -1077,6 +1087,7 @@ pandora.ui.infoView = function(data) { }); $element.appendTo($text); } + return $element; } function renderRightsLevel() { @@ -1109,7 +1120,7 @@ pandora.ui.infoView = function(data) { $rightsLevelSelect .css({background: $rightsLevelElement.css('background')}) .data({OxColor: $rightsLevelElement.data('OxColor')}) - renderCapabilities(rightsLevel); + // renderCapabilities(rightsLevel); pandora.api.edit({id: data.id, rightslevel: rightsLevel}, function(result) { // ... }); @@ -1123,10 +1134,12 @@ pandora.ui.infoView = function(data) { }) .appendTo($rightsLevel); } + /* if (data.parts) { $capabilities = $('
').appendTo($rightsLevel); renderCapabilities(data.rightslevel); } + */ } function toggleIconSize() {