/upstream/templates/books/edit/web.tmpl
Type: /type/template
body: value: $def with (work, prefix="")

<div id="link-errors" class="note hidden">
</div>

<fieldset class="major collapse" id="links">
    <div id="links-form">
        <div class="formElement">
            $:_('Please connect Open Library records to <u>good</u><span class="orange">*</span> online resources.')
        </div>

        <div class="formElement">
            <table>
                <tbody>
                    <tr>
                        <td valign="top">
                            <div class="label">
                                <label for="link-label">$_("Give your link a label")</label> 
                            </div>
                        </td>
                        <td valign="top" colspan="2">
                            <div class="label">
                                <label for="link-url">URL</label> 
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top">
                            <div class="input">
                                <input type="text" name="title" id="link-label" class="addweb" value=""/>
                                <br/><span class="tip">$:_("For example: <em>New York Times review</em>")</span>
                            </div>
                        </td>
                        <td valign="top">
                            <div class="input">
                                <input type="text" name="url" id="link-url" class="addweb" value="http://"/>
                            </div>
                        </td>
                        <td valign="top">
                            <div class="input">
                                <input type="button" id="repeat-add" class="repeat-add" value="Add Link"/>
                            </div>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>

    </div>

    <div class="formElement">
        <div class="label"></div>
        <div class="input">
            <ul class="booklinks" id="links-display">
                <li id="links-template" style="display: none;" class="repeat-item">
                    <div class="linkRemove"><a href="javascript:;" class="repeat-remove red plain" title="$_('Remove this link')">[x]</a></div>
                    <a href="{{url}}">{{title}}</a>
                    <span class="link wrap">{{url}}</span>
                    <input type="hidden" name="{{prefix}}links--{{index}}--title" value="{{title}}"/>
                    <input type="hidden" name="{{prefix}}links--{{index}}--url" value="{{url}}"/>
                </li>
                
                $for index, link in enumerate(work.links):
                    <li class="repeat-item">
                        <div class="linkRemove"><a href="javascript:;" class="repeat-remove red plain" title="$_('Remove this link')">[x]</a></div>
                        <a href="$link.url">$link.title</a><span class="link wrap">$link.url</span>
                        <input type="hidden" name="${prefix}links--${index}--title" value="$link.title"/>
                        <input type="hidden" name="${prefix}links--${index}--url" value="$link.url"/>
                    </li>
            </ul>
        </div>
    </div>

</fieldset>

<script type="text/javascript">
<!--
    \$().ready(function() {
        \$("#links").repeat({
            vars: {
                prefix: "$prefix"
            },
            validate: function(data) {                
                if (\$.trim(data.url) == "" || \$.trim(data.url) == "http://") {
                    \$("#link-errors").show().html("$_('Please provide a URL.')");
                    \$("#link-url").focus();
                    return false;
                }
                if (\$.trim(data.title) == "") {
                    \$("#link-errors").show().html("$_('Please provide a label.')");
                    \$("#link-label").focus();
                    return false;
                }
                \$("#link-errors").hide();
                return true;
            }
        });
    });
//-->
</script>

<div class="formElement">
    <div class="tip footnote"><span class="orange">*</span> $_('"Good" means no spammy links, please. Keep them relevant to the book. Irrelevant sites may be removed. Blatant spam will be deleted without remorse.')</div>
</div>
title: Work web links (edit)