concept edit - book view in category aurelia

appears as: edit-book view
Aurelia in Action

This is an excerpt from Manning's book Aurelia in Action.

Consuming the star-rating component from the edit-book view-model is a trivial process. Hook into the bind component-lifecycle event, adding a listener to the change event on the ratingElement. This property value is bound from the edit-book view using the ref="ratingElement" expression, as shown in listing 6.14.

Listing 7.14. Adding shelf management to the edit-book view (edit-books.html)
<template>
    <require from='./star-rating'></require>
    <require from='../value-converters/date-format'></require>
    <div ref="editFormDiv" ... >
        <div class="wrapper">
            ...
            <form>
               <div class="form-group row">
                    <label for="description">Description</label>
                     ...
               </div>
               <hr/>
               <div class="form-inline row">

                    <star-rating ... ></star-rating>
               </div>
               <hr/>
               <div class="form-inline row">
                    <div id="own-a-copy"
                          class="form-check mb-2 mr-sm-2 mb-sm-0">
                        ...
                    </div>
                    <div class="form-group">
                        <label for="shelves"                               #1
                              class="mb-2 mr-sm-2 mb-sm-0">
                              Shelves
                        </label>

                        <select show.bind="editingShelves"                 #2
                                name="shelves"
                                class="form-control
                                        mb-1
                                        mr-sm-1
                                        mb-sm-0"
                                multiple                                   #3
                                value.bind="temporaryBook.shelves">        #4
                            <option repeat.for="shelf of shelves"          #5
                                    value.bind="shelf">                    #6
                                ${shelf}                                   #7
                            </option>
                        </select>
                        <button show.bind="editingShelves"                 #8
                                click.delegate="toggleEditShelves()"       #9
                                class="btn btn-secondary btn-sm">
                                ok
                        </button>
                        <div class="mb-2 mr-sm-2 mb-sm-0"
                             show.bind="!editingShelves">                  #10
                            <span repeat.for="shelf                        #11
                                              of temporaryBook.shelves"
                                  class="badge badge-pill
                                         badge-default
                                         mb-2 mr-sm-2
                                         mb-sm-0">
                                  ${shelf}                                 #12
                            </span>
                            <span class="icon-button"
                                   click.delegate="toggleEditShelves()">   #13
                                    <i class="fa fa-pencil"
                                       aria-hidden="true"></i>
                            </span>
                        </div>
                    </div>
                   ...
            </form>
        </div>
    </div>
</template>