/upstream/macros/TypeChanger
Type: /type/macro
description: Change page type macro
macro: value: $def with (type, usetable=0)

<script>
function changeTemplate() {
    var t = document.edit['type.key'].value;
    document.location.href += '&t=' + t;
}
</script>

<div class="formElement pagetype collapse adminOnly" id="pageType">
    $if ctx.user and ctx.user.is_admin():
        <div class="label">
            <label for="type.key">$_("Page Type")</label>
            <span class="small gray">&nbsp;<a href="javascript:;" onclick="\$('#typeSplain').slideToggle();">Huh</a>?</span>
        </div>
        <div class="hidden" id="typeSplain">
            <p class="smaller">Every piece of Open Library is defined by the type of content it displays, usually by content definition (e.g. Authors, Editions, Works) but sometimes by content use (e.g. macro, template, rawtext). Changing this for an existing page will alter its presentation and the data fields available for editing its content. <span class="red">Please use caution changing Page Type!</span></p><p class="smaller">(Simplest solution: If you aren't sure whether this should be changed, don't change it.)</p>
        </div>
        <div class="input">
            $:thinginput(type, name="type.key", id="type.key", expected_type="/type/type", kind="regular",  onchange="changeTemplate();")
        </div>
</div>