<div ng-controller="Umbraco.Overlays.LinkPickerController">

    <umb-control-group label="@content_urls">
        <input type="text"
            localize="placeholder"
            placeholder="@general_url"
            class="umb-editor umb-textstring"
            ng-model="model.target.url"
            ng-disabled="model.target.id"/>
    </umb-control-group>

    <umb-control-group label="@content_nodeName">
        <input type="text"
            localize="placeholder"
            placeholder="@placeholders_entername"
            class="umb-editor umb-textstring"
            ng-model="model.target.name" />
    </umb-control-group>

    <umb-control-group label="@content_target">
        <select class="umb-editor umb-dropdown" ng-model="model.target.target">
            <option value=""></option>
            <option value="_blank">
                <localize key="defaultdialogs_openInNewWindow">Opens the linked document in a new window or tab</localize>
            </option>
            <option value="_top">
                <localize key="defaultdialogs_openInFullBody">Opens the linked document in the full body of the window</localize>
            </option>
            <option value="_parent">
                <localize key="defaultdialogs_openInParentFrame">Opens the linked document in the parent frame</localize>
            </option>
        </select>
    </umb-control-group>

    <div class="umb-control-group">
        <h5>
            <localize key="defaultdialogs_linkToPage">Link to page</localize>
        </h5>

        <umb-tree-search-box
            hide-search-callback="hideSearch"
            search-callback="onSearchResults"
            search-from-id="{{searchInfo.searchFromId}}"
            search-from-name="{{searchInfo.searchFromName}}"
            show-search="{{searchInfo.showSearch}}"
            section="{{section}}">
        </umb-tree-search-box>

        <br/>

        <umb-tree-search-results
            ng-if="searchInfo.showSearch"
            results="searchInfo.results"
            select-result-callback="selectResult">
        </umb-tree-search-results>

        <div ng-hide="searchInfo.showSearch">
            <umb-tree
                section="content"
                hideheader="true"
                hideoptions="true"
                eventhandler="dialogTreeEventHandler"
                isdialog="true"
                enablecheckboxes="true">
            </umb-tree>
        </div>

    </div>

    <div class="umb-control-group">
        <h5>
            <localize key="defaultdialogs_linkToMedia">Link to media</localize>
        </h5>
        <a href ng-click="switchToMediaPicker()" class="btn">
            <localize key="defaultdialogs_selectMedia">Select media</localize>
        </a>
    </div>

    <umb-overlay
        ng-if="mediaPickerOverlay.show"
        model="mediaPickerOverlay"
        view="mediaPickerOverlay.view"
        position="right">
    </umb-overlay>

</div>
