Browse Source

Allow an album and photo title length of 50 chars #332

Tobias Reich 9 years ago
parent
commit
7e885425dc

File diff suppressed because it is too large
+ 0 - 0
dist/main.css


File diff suppressed because it is too large
+ 0 - 0
dist/main.js


File diff suppressed because it is too large
+ 0 - 0
dist/view.js


+ 29 - 0
php/database/update_030001.php

@@ -0,0 +1,29 @@
+<?php
+
+###
+# @name			Update to version 3.0.1
+# @copyright	2015 by Tobias Reich
+###
+
+if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
+
+# Change length of photo title
+$query	= Database::prepare($database, "ALTER TABLE `?` CHANGE `title` `title` VARCHAR( 100 ) NOT NULL DEFAULT ''", array(LYCHEE_TABLE_PHOTOS));
+$result	= $database->query($query);
+if (!$result) {
+	Log::error($database, 'update_030001', __LINE__, 'Could not update database (' . $database->error . ')');
+	return false;
+}
+
+# Change length of album title
+$query	= Database::prepare($database, "ALTER TABLE `?` CHANGE `title` `title` VARCHAR( 100 ) NOT NULL DEFAULT ''", array(LYCHEE_TABLE_ALBUMS));
+$result	= $database->query($query);
+if (!$result) {
+	Log::error($database, 'update_030001', __LINE__, 'Could not update database (' . $database->error . ')');
+	return false;
+}
+
+# Set version
+if (Database::setVersion($database, '030001')===false) return false;
+
+?>

+ 1 - 1
php/modules/Album.php

@@ -484,7 +484,7 @@ class Album extends Module {
 		$this->plugins(__METHOD__, 0, func_get_args());
 
 		# Parse
-		if (strlen($title)>50) $title = substr($title, 0, 50);
+		if (strlen($title)>100) $title = substr($title, 0, 100);
 
 		# Execute query
 		$query	= Database::prepare($this->database, "UPDATE ? SET title = '?' WHERE id IN (?)", array(LYCHEE_TABLE_ALBUMS, $title, $this->albumIDs));

+ 2 - 1
php/modules/Database.php

@@ -55,7 +55,8 @@ class Database extends Module {
 			'020601', #2.6.1
 			'020602', #2.6.2
 			'020700', #2.7.0
-			'030000' #3.0.0
+			'030000', #3.0.0
+			'030001' #3.0.1
 		);
 
 		# For each update

+ 1 - 1
php/modules/Photo.php

@@ -842,7 +842,7 @@ class Photo extends Module {
 		$this->plugins(__METHOD__, 0, func_get_args());
 
 		# Parse
-		if (strlen($title)>50) $title = substr($title, 0, 50);
+		if (strlen($title)>100) $title = substr($title, 0, 100);
 
 		# Set title
 		$query	= Database::prepare($this->database, "UPDATE ? SET title = '?' WHERE id IN (?)", array(LYCHEE_TABLE_PHOTOS, $title, $this->photoIDs));

+ 1 - 1
src/package.json

@@ -1,6 +1,6 @@
 {
   "name": "Lychee",
-  "version": "3.0.0",
+  "version": "3.0.1",
   "description": "Self-hosted photo-management done right.",
   "authors": "Tobias Reich <tobias@electerious.com>",
   "license": "MIT",

+ 2 - 2
src/scripts/album.js

@@ -138,7 +138,7 @@ album.add = function() {
 	}
 
 	basicModal.show({
-		body: "<p>Enter a title for the new album: <input class='text' data-name='title' type='text' maxlength='30' placeholder='Title' value='Untitled'></p>",
+		body: "<p>Enter a title for the new album: <input class='text' data-name='title' type='text' maxlength='50' placeholder='Title' value='Untitled'></p>",
 		buttons: {
 			action: {
 				title: 'Create Album',
@@ -306,7 +306,7 @@ album.setTitle = function(albumIDs) {
 
 	}
 
-	input = "<input class='text' data-name='title' type='text' maxlength='30' placeholder='Title' value='" + oldTitle + "'>";
+	input = "<input class='text' data-name='title' type='text' maxlength='50' placeholder='Title' value='" + oldTitle + "'>";
 
 	if (albumIDs.length===1)	msg = "<p>Enter a new title for this album: " + input + "</p>";
 	else						msg = "<p>Enter a title for all " + albumIDs.length + " selected albums: " + input +"</p>";

+ 4 - 22
src/scripts/build.js

@@ -59,16 +59,7 @@ build.album = function(data) {
 
 	if (data===null||data===undefined) return '';
 
-	var html		= '',
-		title		= data.title,
-		longTitle	= '';
-
-	if (title!==null&&title.length>18) {
-
-		title		= data.title.substr(0, 18) + '...';
-		longTitle	= data.title;
-
-	}
+	var html = '';
 
 	var {path: thumbPath, hasRetina: thumbRetina} = lychee.retinize(data.thumbs[0]);
 
@@ -78,7 +69,7 @@ build.album = function(data) {
 				<img src='${ data.thumbs[1] }' width='200' height='200' alt='thumb' data-retina='false'>
 				<img src='${ thumbPath }' width='200' height='200' alt='thumb' data-retina='${ thumbRetina }'>
 				<div class='overlay'>
-					<h1 title='${ longTitle }'>${ title }</h1>
+					<h1 title='${ data.title }'>${ data.title }</h1>
 					<a>${ data.sysdate }</a>
 				</div>
 			`
@@ -103,16 +94,7 @@ build.photo = function(data) {
 
 	if (data===null||data===undefined) return '';
 
-	var html		= '',
-		title		= data.title,
-		longTitle	= '';
-
-	if (title!==null&&title.length>18) {
-
-		title		= data.title.substr(0, 18) + '...';
-		longTitle	= data.title;
-
-	}
+	var html = '';
 
 	var {path: thumbPath, hasRetina: thumbRetina} = lychee.retinize(data.thumbUrl);
 
@@ -120,7 +102,7 @@ build.photo = function(data) {
 			<div class='photo' data-album-id='${ data.album }' data-id='${ data.id }'>
 				<img src='${ thumbPath }' width='200' height='200' alt='thumb'>
 				<div class='overlay'>
-					<h1 title='${ longTitle }'>${ title }</h1>
+					<h1 title='${ data.title }'>${ data.title }</h1>
 			`
 
 	if (data.cameraDate==='1')	html += `<a><span title='Camera Date'>${ build.iconic('camera-slr') }</span>${ data.sysdate }</a>`;

+ 2 - 2
src/scripts/lychee.js

@@ -6,8 +6,8 @@
 lychee = {
 
 	title:			document.title,
-	version:		'3.0.0',
-	version_code:	'030000',
+	version:		'3.0.1',
+	version_code:	'030001',
 
 	update_path:	'http://lychee.electerious.com/version/index.php',
 	updateURL:		'https://github.com/electerious/Lychee',

+ 1 - 1
src/scripts/photo.js

@@ -330,7 +330,7 @@ photo.setTitle = function(photoIDs) {
 
 	}
 
-	input = "<input class='text' data-name='title' type='text' maxlength='30' placeholder='Title' value='" + oldTitle + "'>";
+	input = "<input class='text' data-name='title' type='text' maxlength='50' placeholder='Title' value='" + oldTitle + "'>";
 
 	if (photoIDs.length===1)	msg = "<p>Enter a new title for this photo: " + input + "</p>";
 	else						msg = "<p>Enter a title for all " + photoIDs.length + " selected photos: " + input + "</p>";

+ 3 - 1
src/styles/_content.scss

@@ -125,13 +125,15 @@
 	.album .overlay h1,
 	.photo .overlay h1 {
 		min-height: 19px;
-		width: 185px;
+		width: 180px;
 		margin: 12px 0 5px 15px;
 		color: #fff;
 		text-shadow: 0 1px 3px black(.4);
 		font-size: 16px;
 		font-weight: bold;
 		overflow: hidden;
+		white-space: nowrap;
+		text-overflow: ellipsis;
 	}
 
 	.album .overlay a,

+ 3 - 0
src/styles/_header.scss

@@ -38,6 +38,9 @@ header {
 		text-align: center;
 		z-index: 1;
 		cursor: default;
+		overflow: hidden;
+		white-space: nowrap;
+		text-overflow: ellipsis;
 
 		.iconic {
 			display: none;

Some files were not shown because too many files changed in this diff