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 a405a25..06e04f6 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 2ec7205..5d33446 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 07cbd6a..a7bb804 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}">}