kai-jacobsen/kontentblocks

View on GitHub
js/src/templates/fields/Link.hbs

Summary

Maintainability
Test Coverage
<div class="kb-field kb-js-field kb-field--link field-api-link">
    <label class="heading">{{ model.label }}</label>
    <input class="kb-js-link-input" data-kbf-link-url
           id="{{ model.index }}_link_input"
           type="text"
           name="{{ fieldName model.baseId model.index model.primeKey }}[link]"
           value="{{ model.value.link }}">
    <a class='button kb-js-add-link'>Add internal link</a>
    {{#if model.linktext }}
        <div class='kb-field--link-meta'><label for='{{ model.index }}-linktext'>{{ i18n.linktext }}</label><br>
            <input
                    type='text' data-kbf-link-linktext
                    name="{{ fieldName model.baseId model.index model.primeKey }}[linktext]"
                    class='kb-field--link-linktext'
                    id='{{ model.index }}-linktext'
                    value='{{ model.value.linktext }}'>
        </div>
    {{/if}}

    {{#if model.linktitle }}
        <div class='kb-field--link-meta'><label for='{{ model.index }}-linktitle'>{{ i18n.linktitle }}</label><br>
            <input
                    type='text'
                    name="{{ fieldName model.baseId model.index model.primeKey }}[linktitle]"
                    class='kb-field--link-linktitle'
                    id='{{ model.index }}-linktitle'
                    value='{{ model.value.linktitle }}'>
        </div>
    {{/if}}

    {{#if model.showtarget }}
        <div class='kb-field--link-meta'>
            <label for='{{ model.index }}-linktarget'>
                <input data-kbf-link-target type='checkbox' class='kb-field--link-target'
                       id='{{ model.index }}-linktarget'
                    {{#if model.value.target }}
                       checked="checked"
                    {{/if}}
                       value='{{ model.value.target }}'
                       name='{{ fieldname model.baseId model.index model.primeKey }}[linktarget]'>
                {{ i18n.linktarget }} </label>
        </div>

    {{/if}}
    <p class="description">{{ model.description }}</p>

</div>