tazbug rev 21

Improve search function and login page, use placeholder and THANKS Paul for the corrections
author Christophe Lincoln <pankso@slitaz.org>
date Wed Apr 04 22:40:54 2012 +0200 (2012-04-04)
parents 8d5eadf9ca7a
children 4530f3ccd644
files web/bugs.cgi web/style.css
line diff
     1.1 --- a/web/bugs.cgi	Wed Apr 04 20:03:49 2012 +0100
     1.2 +++ b/web/bugs.cgi	Wed Apr 04 22:40:54 2012 +0200
     1.3 @@ -117,22 +117,12 @@
     1.4  
     1.5  <div id="login">
     1.6  	<form method="post" action="$SCRIPT_NAME">
     1.7 -		<table>
     1.8 -			<tbody>
     1.9 -				<tr>
    1.10 -					<td>$(gettext "User name")</td>
    1.11 -					<td><input type="text" name="auth" /></td>
    1.12 -				</tr>
    1.13 -				<tr>
    1.14 -					<td>$(gettext "Password")</td>
    1.15 -					<td><input type="password" name="pass" /></td>
    1.16 -				</tr>
    1.17 -				<tr>
    1.18 -					<td><input type="submit" value="$(gettext "Login")" /></td>
    1.19 -					<td>$error </td>
    1.20 -				</tr>
    1.21 -			</tbody>
    1.22 -		</table>
    1.23 +		<input type="text" name="auth" placeholder="$(gettext "User name")" />
    1.24 +		<input type="password" name="pass" placeholder="$(gettext "Password")" />
    1.25 +		<div>
    1.26 +			<input type="submit" value="Login" />
    1.27 +			$error
    1.28 +		</div>
    1.29  	</form>
    1.30  </div>
    1.31  
    1.32 @@ -172,10 +162,9 @@
    1.33  			if [ "$PRIORITY" == "$pr" ]; then
    1.34  				cat << EOT
    1.35  <pre>
    1.36 -Bug title  : <strong>$BUG</strong>
    1.37 +Bug title  : <strong>$BUG</strong> <a href="?id=$id">Show</a>
    1.38  ID - Date  : $id - $DATE
    1.39 -Creator    : <a href="?user=$CREATOR">$CREATOR</a> - \
    1.40 -<a href="?id=$id">Show Bug</a>
    1.41 +Creator    : <a href="?user=$CREATOR">$CREATOR</a>
    1.42  </pre>
    1.43  EOT
    1.44  			fi
    1.45 @@ -392,7 +381,7 @@
    1.46  	echo "<img src='$url/$md5?d=identicon&s=$size' alt='' />"
    1.47  }
    1.48  
    1.49 -# Create a new user
    1.50 +# Create a new user in AUTH_FILE and PEOPLE
    1.51  new_user_config() {
    1.52  	mail="$(GET mail)"
    1.53  	pass="$(GET pass)"
    1.54 @@ -466,6 +455,7 @@
    1.55  			error="<span class="error">$(gettext "Bad login or pass")</span>"
    1.56  		header 
    1.57  		html_header
    1.58 +		user_box
    1.59  		login_page 
    1.60  		html_footer ;;
    1.61  	*\ logout\ *)
    1.62 @@ -581,17 +571,26 @@
    1.63  	<input type="text" name="search" />
    1.64  	<input type="submit" value="$(gettext "Search")" />
    1.65  </form>
    1.66 -<pre>
    1.67 +<div>
    1.68  EOT
    1.69 -		IFS="/"
    1.70 -		grep -i -H $(GET search) $bugdir/*/* | while read bug id file
    1.71 +	
    1.72 +		#found=0 JS to notify or write results nb under the search box.
    1.73 +		for bug in $bugdir/*
    1.74  		do
    1.75 -			echo -n "<a href='?id=$id'>Bug</a> $id : " 
    1.76 -			echo $file | cut -d : -f 2 | \
    1.77 -				sed s"/$(GET search)/<span class='ok'>$(GET search)<\/span>/"g
    1.78 +			result=$(fgrep -i "$(GET search)" $bug/*)
    1.79 +			if [ "$result" ]; then
    1.80 +				#found=$(($found + 1))
    1.81 +				id=${bug#bug/}
    1.82 +				echo "<p><strong>Bug $id</strong> <a href='?id=$id'>$(gettext "Show")</a></p>"
    1.83 +				echo '<pre>'
    1.84 +				fgrep -i "$(GET search)" $bugdir/$id/* | \
    1.85 +					sed s"/$(GET search)/<span class='ok'>$(GET search)<\/span>/"g
    1.86 +				echo '</pre>'
    1.87 +			else
    1.88 +				gettext "<p>No result found for:"; echo " $(GET search)</p>"
    1.89 +			fi
    1.90  		done
    1.91 -		unset IFS
    1.92 -		echo '</pre>' 
    1.93 +		echo '</div>'
    1.94  		html_footer ;;
    1.95  	*)
    1.96  		# Default page.
    1.97 @@ -629,8 +628,8 @@
    1.98  		fi
    1.99  		cat << EOT
   1.100  <form method="get" action="./">
   1.101 -	<input type="text" name="search" />
   1.102 -	<input type="submit" value="$(gettext "Search")" />
   1.103 +	<input type="text" name="search" placeholder="$(gettext "Search")" />
   1.104 +	<!-- <input type="submit" value="$(gettext "Search")" /> -->
   1.105  </form>
   1.106  </div>
   1.107  EOT
     2.1 --- a/web/style.css	Wed Apr 04 20:03:49 2012 +0100
     2.2 +++ b/web/style.css	Wed Apr 04 22:40:54 2012 +0200
     2.3 @@ -71,18 +71,18 @@
     2.4  #content {
     2.5  	margin: 40px auto;
     2.6  	text-align: justify;
     2.7 -	width: 720px;
     2.8 +	max-width: 720px;
     2.9  }
    2.10  
    2.11  #login {
    2.12 -	width: 280px;
    2.13 +	width: 240px;
    2.14  	float: left;
    2.15  	height: 120px;
    2.16  }
    2.17  
    2.18  #login input[type="text"], #login input[type="password"],
    2.19  #tools input[type="text"] { 
    2.20 -	width: 180px; padding: 3px; }
    2.21 +	width: 220px; padding: 3px; }
    2.22  #tools input[type="submit"] { padding: 3px; }
    2.23  #login input[type="submit"] { float: none; }
    2.24  
    2.25 @@ -96,7 +96,7 @@
    2.26  }
    2.27  #user a { padding: 0 4px; }
    2.28  
    2.29 -#account-info { width: 380px; height: 120px; float: right; }
    2.30 +#account-info { width: 420px; height: 120px; float: right; }
    2.31  
    2.32  #newbug textarea { width: 460px; }
    2.33