diff --git a/static/js/pandora/annotationDialog.js b/static/js/pandora/annotationDialog.js index cf1efbf7d..0ceac691a 100644 --- a/static/js/pandora/annotationDialog.js +++ b/static/js/pandora/annotationDialog.js @@ -2,43 +2,60 @@ 'use strict'; pandora.ui.annotationDialog = function(layer) { - var $dialog = Ox.Dialog({ - buttons: [ - Ox.Button({title: 'Sign Up...'}).bindEvent({ - click: function() { - $dialog.close(); - pandora.$ui.accountDialog = pandora.ui.accountDialog('signup').open(); - } - }), - Ox.Button({title: 'Sign In...'}).bindEvent({ - click: function() { - $dialog.close(); - pandora.$ui.accountDialog = pandora.ui.accountDialog('signin').open(); - } - }), - {}, - Ox.Button({title: 'Not Now'}).bindEvent({ - click: function() { - $dialog.close(); - } - }) - ], - content: Ox.Element() - .append( - $('') - .attr({src: '/static/png/icon.png'}) - .css({position: 'absolute', left: '16px', top: '16px', width: '64px', height: '64px'}) - ) - .append( - $('
') - .css({position: 'absolute', left: '96px', top: '16px', width: '192px'}) - .html('To add or edit ' + layer + ', please sign up or sign in.') + var isEditor = pandora.user.ui.itemView == 'editor', + $dialog = Ox.Dialog({ + buttons: Ox.merge( + isEditor ? [ + Ox.Button({title: 'Sign Up...'}).bindEvent({ + click: function() { + $dialog.close(); + pandora.$ui.accountDialog = pandora.ui.accountDialog('signup').open(); + } + }), + Ox.Button({title: 'Sign In...'}).bindEvent({ + click: function() { + $dialog.close(); + pandora.$ui.accountDialog = pandora.ui.accountDialog('signin').open(); + } + }) + ] : [ + Ox.Button({title: 'Switch to Editor'}).bindEvent({ + click: function() { + $dialog.close(); + pandora.UI.set({itemView: 'editor'}); + } + }) + ], + [ + {}, + Ox.Button({title: 'Not Now'}).bindEvent({ + click: function() { + $dialog.close(); + } + }) + ] ), - fixedSize: true, - height: 128, - removeOnClose: true, - width: 304, - title: Ox.toTitleCase(layer) - }); + content: Ox.Element() + .append( + $('') + .attr({src: '/static/png/icon.png'}) + .css({position: 'absolute', left: '16px', top: '16px', width: '64px', height: '64px'}) + ) + .append( + $('
') + .css({position: 'absolute', left: '96px', top: '16px', width: '192px'}) + .html( + 'To add or edit ' + layer + ', ' + ( + isEditor ? 'please sign up or sign in.' + : 'just switch to the editor.' + ) + ) + ), + fixedSize: true, + height: 128, + removeOnClose: true, + width: 304, + title: Ox.toTitleCase(layer) + }); return $dialog; }; diff --git a/static/js/pandora/editor.js b/static/js/pandora/editor.js index fba77bed6..f70a355e2 100644 --- a/static/js/pandora/editor.js +++ b/static/js/pandora/editor.js @@ -171,7 +171,9 @@ pandora.ui.editor = function(data) { pandora.ui.importAnnotations().open(); }, info: function(data) { - pandora.ui.annotationDialog(Ox.getObjectById(pandora.site.layers, data.layer).title).open(); + pandora.ui.annotationDialog( + Ox.getObjectById(pandora.site.layers, data.layer).title + ).open(); }, muted: function(data) { pandora.UI.set('videoMuted', data.muted); diff --git a/static/js/pandora/player.js b/static/js/pandora/player.js index 0a9b019c1..745fb4d01 100644 --- a/static/js/pandora/player.js +++ b/static/js/pandora/player.js @@ -75,6 +75,11 @@ pandora.ui.player = function(data) { find: function(data) { pandora.UI.set('itemFind', data.find); }, + info: function(data) { + pandora.ui.annotationDialog( + Ox.getObjectById(pandora.site.layers, data.layer).title + ).open(); + }, muted: function(data) { pandora.UI.set('videoMuted', data.muted); }, diff --git a/static/js/pandora/timeline.js b/static/js/pandora/timeline.js index 383fba8d5..b711d5b67 100644 --- a/static/js/pandora/timeline.js +++ b/static/js/pandora/timeline.js @@ -67,6 +67,11 @@ pandora.ui.timeline = function(data) { follow: function(data) { pandora.UI.set('followPlayer', data.follow); }, + info: function(data) { + pandora.ui.annotationDialog( + Ox.getObjectById(pandora.site.layers, data.layer).title + ).open(); + }, muted: function(data) { pandora.UI.set('videoMuted', data.muted); },