oglimmer/lunchy

View on GitHub
src/main/webapp/partials/view-location/edit-location.html

Summary

Maintainability
Test Coverage
<form class="form-horizontal" novalidate name="editLocation" ng-controller="LunchyControllerViewEditLocation">
    <fieldset>
        <legend>Edit {{data.officialName}} in {{data.city}}</legend>
        <div class="row form-group">
            <label for="fkOffice" class="col-md-2 control-label">Office</label>
            <div class="col-md-10">
                <select class="form-control" ng-model="data.selectedOffice" 
                    ng-options="office.name for office in offices track by office.id" ng-change="selectedOfficeChanged()">                    
                </select>
            </div>
        </div>
        <div class="row form-group" ng-class="{'has-error': editLocation.officialName.$invalid}">
            <label for="officialName" class="col-md-2 control-label required">Official name</label>
            <div class="col-md-10">
                <input type="text" class="form-control" name="officialName" ng-model="data.officialName" placeholder="Official name" focus="true"  required>
            </div>
        </div>
        <div class="row form-group">
            <label for="streetName" class="col-md-2 control-label">{{ companyName }} name</label>
            <div class="col-md-10">
                <input type="text" class="form-control" ng-model="data.streetName" placeholder="{{ companyName }} name" >
                <span ng-hide="editableButton" class="help-block">Separate multiple names by comma.</span>
            </div>
        </div>
        <div class="row form-group" ng-class="{'has-error': editLocation.address.$invalid || editLocation.city.$invalid}">
            <label for="address" class="col-md-2 control-label required">Address</label>
            <div class="col-md-4">
                <input type="text" class="form-control" name="address" ng-model="data.address" placeholder="Street" ng-disabled="data.geoMovedManually" required>
            </div>
            <div class="col-md-3">
                <input type="text" class="form-control" ng-model="data.zip" placeholder="ZIP" ng-disabled="data.geoMovedManually" >
            </div>
            <div class="col-md-3">
                <input type="text" class="form-control" name="city" ng-model="data.city" placeholder="City" ng-disabled="data.geoMovedManually" required>
            </div>
        </div>
        <div class="row form-group" ng-show="initialGeoMovedManually">
            <div class="col-md-10 col-md-offset-2">The pin on the map was moved manually, un-check to allow override. <input type="checkbox" name="geoMovedManually" ng-model="data.geoMovedManually"></div>
        </div>

        <div class="row form-group">
            <label for="url" class="col-md-2 control-label">Webpage</label>
            <div class="col-md-10">
                <input type="text" class="form-control" ng-model="data.url" placeholder="http://www.the-restaurant.de" >
            </div>
        </div>

        <div class="row form-group">
            <label for="comment" class="col-md-2 control-label">Comment</label>
            <div class="col-md-10">
                <textarea class="form-control" rows="3" ng-model="data.comment" focus="editLocationMode,true"></textarea>
                <span ng-hide="editableButton" class="help-block">Describe the location without judging it. Your personal opinions should go into a review.</span>
            </div>
        </div>

        <div class="row form-group">
            <label for="tags" class="col-md-2 control-label">Tags</label>
            <div class="col-md-10">
                <tag-input autocomplete='allTags' taglist='data.tags'></tag-input>
                <span class="help-block">Use the up/down cursor keys to scroll all available entries.</span>
            </div>
        </div>

        <div class="row form-group">
            <div class="col-md-10 col-md-offset-2">
                Created: {{data.createdOn | date :'short'}} by {{data.creationUser}}, last update: {{data.lastUpdate | date :'short'}}
            </div>
        </div>

        <div class="row form-group">
            <div class="col-md-10 col-md-offset-2">
                <button type="button" class="btn btn-default" ng-click="cancelEdit()">Cancel</button>

                <button type="button" class="btn btn-primary" ng-click="editLocationSave()" ng-disabled="editLocation.$invalid">Save</button>
                
                <button type="button" class="btn btn-danger pull-right" ng-click="editLocationDelete()" ng-confirm-click="Do you really want to delete this location?" ng-show="allowedToDeletePermission">Delete</button>
            </div>
        </div>

    </fieldset>
</form>