Browse Source

Fixed editable state in public mode

Tobias Reich 9 years ago
parent
commit
dd2a57e5f8
3 changed files with 26 additions and 9 deletions
  1. 21 0
      src/scripts/header.js
  2. 2 7
      src/scripts/lychee.js
  3. 3 2
      src/styles/_contextmenu.scss

+ 21 - 0
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');
+
 }

+ 2 - 7
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')

+ 3 - 2
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;
 			}