{{#if this.showDeleteLabelModal}}
    <header class="modal-header">
        <h1>Are you sure you want to delete this label?</h1>
    </header>
    <a class="close" href="" role="button" title="Close" {{action "closeModal"}}>{{svg-jar "close"}}<span class="hidden">Close</span></a>

    <div class="modal-body">
        <p>
            You’re about to delete label "<strong>{{this.label.name}}</strong>". This is permanent! We warned you, k?
        </p>
    </div>

    <div class="modal-footer">
        <button class="gh-btn" type="button" {{action "closeModal"}}><span>Cancel</span></button>
        <GhTaskButton @buttonText="Delete" @successText="Deleted" @task={{this.deleteLabel}} @class="gh-btn gh-btn-red gh-btn-icon" />
    </div>
{{else}}

    <header class="modal-header" data-test-modal="label-form">
        <h1>{{if this.label.isNew "New label" "Edit label"}}</h1>
    </header>
    {{!-- disable mouseDown so it doesn't trigger focus-out validations --}}
    <button class="close" href title="Close" type="button" {{action "closeModal"}} {{action (optional this.noop) on="mouseDown"}}>
        {{svg-jar "close"}}
    </button>

    <div class="modal-body">
        <fieldset>
            <GhFormGroup @errors={{this.label.errors}} @hasValidated={{this.label.hasValidated}} @property="name">
                <label for="label-name" class="fw6 dib">Label name</label>
                <GhTextInput
                    @id="label-name"
                    @value={{this.label.name}}
                    @focus-out={{action "validate" "name" target=this.label}}
                    data-test-input="label-name"
                />
                {{#if this.label.errors}}
                    <GhErrorMessage @errors={{this.label.errors}} @property="name" data-test-error="label-name" />
                {{/if}}
            </GhFormGroup>
        </fieldset>
    </div>

    <div class="modal-footer">
        {{#if this.label.isNew}}
            <button
                class="gh-btn" data-test-button="cancel-label-form" type="button" {{action "closeModal"}}
                {{!-- disable mouseDown so it doesn't trigger focus-out validations --}}
                {{action (optional this.noop) on="mouseDown"}}
            >
                <span>Cancel</span>
            </button>
        {{else}}
            <button
                class="gh-btn gh-btn-red gh-btn-icon" data-test-button="delete-label" type="button" {{on "click" (action "toggleDeleteLabelModal")}}
                {{on "mousedown" (optional this.noop)}}
            >
                <span>Delete</span>
            </button>
        {{/if}}

        <GhTaskButton
            @buttonText="Save"
            @runningText="Saving..."
            @successText="Saved"
            @task={{this.saveTask}}
            @taskArgs={{this.label}}
            @class="gh-btn gh-btn-black gh-btn-icon"
            data-test-button="save-label" />
    </div>
{{/if}}