tazpanel rev 534

index.cgi: add back button in edit & diff
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Aug 30 18:07:27 2015 +0200 (2015-08-30)
parents bf55c6eae402
children 7bf0e359133e
files index.cgi lib/libtazpanel
line diff
     1.1 --- a/index.cgi	Sat Aug 29 12:16:13 2015 +0200
     1.2 +++ b/index.cgi	Sun Aug 30 18:07:27 2015 +0200
     1.3 @@ -119,6 +119,7 @@
     1.4  			<button data-icon="save">$(_ 'Save')</button>
     1.5  			<button name="action" value="diff" data-icon="diff">$(_ 'Differences')</button>
     1.6  		</form>
     1.7 +		$(back_button)
     1.8  	</header>
     1.9  	<textarea form="editform" name="content" class="wide" rows="30" autofocus>$(htmlize < $file)</textarea>
    1.10  </section>
    1.11 @@ -144,6 +145,7 @@
    1.12  		diff)
    1.13  			cat <<EOT
    1.14  <section>
    1.15 +	$(back_button)
    1.16  	<pre id="diff">$(file_is_modified $file diff | syntax_highlighter diff)</pre>
    1.17  </section>
    1.18  EOT
     2.1 --- a/lib/libtazpanel	Sat Aug 29 12:16:13 2015 +0200
     2.2 +++ b/lib/libtazpanel	Sun Aug 30 18:07:27 2015 +0200
     2.3 @@ -358,14 +358,9 @@
     2.4  # Show "Back" button
     2.5  
     2.6  back_button() {
     2.7 -	local URL="$1" default_caption="$(_ 'Back')"
     2.8  	#FIXME: can't encode data-icon
     2.9 -	local caption="${2:-$default_caption}" icon="${3:-back}"
    2.10 -
    2.11 -	if [ -n "$1" ]; then
    2.12 -		printf '<form action="%s" method="post"><button data-icon="%s">%s</button></form>' \
    2.13 -			"$URL" "$icon" "$caption"
    2.14 -	fi
    2.15 +	printf '<form action="%s" method="post"><button data-icon="%s">%s</button></form>' \
    2.16 +		"${1:-javascript:history.go(-1)}" "${3:-back}" "${2:-$(_ 'Back')}"
    2.17  }
    2.18  
    2.19