chiark / gitweb /
Macro-ize (most) <A>-based buttons
authorRichard Kettlewell <rjk@greenend.org.uk>
Thu, 5 Jun 2008 14:15:59 +0000 (15:15 +0100)
committerRichard Kettlewell <rjk@greenend.org.uk>
Thu, 5 Jun 2008 14:15:59 +0000 (15:15 +0100)
templates/choose.tmpl
templates/macros.tmpl
templates/playing.tmpl

index a405a25ec42cc1ce1399686e62864e572081303a..06e04f6b33470a4e2e25ca3a1dcdf8b459320d5c 100644 (file)
@@ -96,10 +96,7 @@ USA
               size=50>
        @submit{@label{search.search}}
        <input name=action type=hidden value=choose>
-       <a class=button
-          href="@url?action=choose">
-         @label{search.clear}
-       </a>
+       @actbutton{@label{search.clear}}{}{choose}
      </p>
    </form>
 
index 2ec720540159b68bbf7b82f2237f3e784a1500e9..5d33446c739945810a6080dc7a99330d37153472 100644 (file)
@@ -282,6 +282,19 @@ and then redefines macros as desired.
 @define {submit} {text}
         {<span class=buttonouter><button class=button name=submit type=submit><span class=buttoninner>@text</span></button></span>}
 
+@# Expand to an action button
+@#  @text is the text to put inside the button
+@#  @long is the text to put in the caption
+@#  @action is the target action
+@define {actbutton} {text long action}
+        {<a class=button
+              href="@url?action=@action@back"
+              title="@long">@text</a>}
+
+@# Expands to &back=manage or to nothing depending on context;
+@# see playing.tmpl.
+@define {back} {} {}
+
 Local variables:
 mode:sgml
 sgml-always-quote-attributes:nil
index 07cbd6a7b99d07194f38c32630895d77c6bb5843..a7bb804cd4900f83c3b012e2c88be8066d265623 100644 (file)
@@ -25,11 +25,9 @@ USA
   @#  @action should be the action to switch to the opposite state
   @#  @state should be the current state
   @define {onoff} {class action state}
-          {<a class=button
-              href="@url?action=@action@back"
-              title="@label{playing.@q{@action}verbose}">
-             @label{playing.@class}
-           </a>
+          {@actbutton{@label{playing.@class}}
+                     {@label{playing.@q{@action}verbose}}
+                     {@action}
            <img width=@width height=@height class=imgbutton
                 src="@image{@state}">}