Ghost/ghost/admin/app/templates/components/gh-navitem.hbs
Kevin Ansfield e0230adae6 Replace jquery-ui.sortable with ember-sortable for nav items
refs #6458, closes #6457
- replaces jquery-ui.sortable with ember-sortable for drag-n-drop handling
- moves the "new/blank" nav item out of the nav items list
  - allows it to be excluded from the draggable list
  - cleans up handling of the `navigationItems` array as there's no longer a need to ignore/exclude this extra item
- clears validation errors when typing in the respective field
- adds acceptance test for adding/removing nav items
- improves acceptance test for saving nav items to cover more edge cases
2016-02-09 22:08:21 +00:00

27 lines
1.3 KiB
Handlebars

{{#unless navItem.isNew}}
<span class="gh-blognav-grab icon-grab">
<span class="sr-only">Reorder</span>
</span>
{{/unless}}
<div class="gh-blognav-line">
{{#gh-validation-status-container tagName="span" class="gh-blognav-label" errors=navItem.errors property="label" hasValidated=navItem.hasValidated}}
{{gh-trim-focus-input focus=navItem.last placeholder="Label" value=navItem.label keyPress=(action "clearLabelErrors")}}
{{gh-error-message errors=navItem.errors property="label"}}
{{/gh-validation-status-container}}
{{#gh-validation-status-container tagName="span" class="gh-blognav-url" errors=navItem.errors property="url" hasValidated=navItem.hasValidated}}
{{gh-navitem-url-input baseUrl=baseUrl url=navItem.url isNew=navItem.isNew change="updateUrl" clearErrors=(action "clearUrlErrors")}}
{{gh-error-message errors=navItem.errors property="url"}}
{{/gh-validation-status-container}}
</div>
{{#if navItem.isNew}}
<button type="button" class="gh-blognav-add" {{action "addItem"}}>
<i class="icon-add2"><span class="sr-only">Add</span></i>
</button>
{{else}}
<button type="button" class="gh-blognav-delete" {{action "deleteItem" navItem}}>
<i class="icon-trash"><span class="sr-only">Delete</span></i>
</button>
{{/if}}