From dd2a57e5f82ee305c9ba70ddcf545e746628764e Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sat, 7 Feb 2015 00:01:54 +0100 Subject: [PATCH] Fixed editable state in public mode --- src/scripts/header.js | 21 +++++++++++++++++++++ src/scripts/lychee.js | 9 ++------- src/styles/_contextmenu.scss | 5 +++-- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/src/scripts/header.js b/src/scripts/header.js index deaba99..9d4aa90 100644 --- a/src/scripts/header.js +++ b/src/scripts/header.js @@ -58,6 +58,15 @@ header.hide = function(e, delay) { } +header.setTitle = function(title) { + + var $title = header.dom('#title'), + title = title || 'Untitled'; + + $title.html(title + build.iconic('caret-bottom')); + +} + header.setMode = function(mode) { var albumID = album.getID(); @@ -105,4 +114,16 @@ header.setMode = function(mode) { } +} + +header.setEditable = function(editable) { + + var $title = header.dom('#title'); + + // Hide editable icon when not logged in + if (lychee.publicMode===true) editable = false; + + if (editable) $title.addClass('editable'); + else $title.removeClass('editable'); + } \ No newline at end of file diff --git a/src/scripts/lychee.js b/src/scripts/lychee.js index e665b7e..d3b3f26 100644 --- a/src/scripts/lychee.js +++ b/src/scripts/lychee.js @@ -230,14 +230,10 @@ lychee.getUpdate = function() { lychee.setTitle = function(title, editable) { - var $title = header.dom('#title'); - document.title = lychee.title + ' - ' + title; - if (editable) $title.addClass('editable'); - else $title.removeClass('editable'); - - $title.html(title + build.iconic('caret-bottom')); + header.setEditable(editable); + header.setTitle(title); } @@ -247,7 +243,6 @@ lychee.setMode = function(mode) { $('#button_trash, #button_move, #button_share, #button_star').remove(); $(document) - .on('mouseenter', '#title.editable', function() { $(this).removeClass('editable') }) .off('click', '#title.editable') .off('touchend', '#title.editable') .off('contextmenu', '.photo') diff --git a/src/styles/_contextmenu.scss b/src/styles/_contextmenu.scss index bad7373..fbf5d3f 100644 --- a/src/styles/_contextmenu.scss +++ b/src/styles/_contextmenu.scss @@ -35,13 +35,14 @@ &:hover { background: linear-gradient(to bottom, $colorBlue, darken($colorBlue, 5%)); } } - tr td .albumCover { + tr td .cover { + background-color: #222; border-radius: 2px; box-shadow: 0 0 0 1px black(.5); position: absolute; } - tr td .albumTitle { + tr td .title { display: inline-block; margin: 0 0 3px 26px; }