oglimmer/lunchy

View on GitHub
src/main/webapp/partials/finder.html

Summary

Maintainability
Test Coverage

<div class="container">

    <form class="form-horizontal" novalidate name="editLocation">
        <fieldset>
            <legend>What could I eat today?</legend>

            <div class="row form-group">
                <label for="selectedOffice" class="col-md-2 control-label">Office</label>
                <div class="col-md-10">
                    <select class="form-control" id="selectedOffice" ng-model="data.selectedOffice" 
                        ng-change="selectedOfficeChanged()" ng-options="office.name for office in offices track by office.id">                        
                    </select>
                </div>
            </div>
            
            <div class="row form-group">
                <label for="tags" class="col-md-2 control-label">Incl. Tags</label>
                <div class="col-md-10">
                    <tag-input taglist='data.inclTags' inputdisabled='true' deletecallback='deleteInclTag(changedString)'></tag-input>
                    <span class="help-block">Only locations which offer one of those will be shown. <a href="javascript:void(null);" ng-click="removeAll()">Remove all</a></span>
                </div>
            </div>

            <div class="row form-group">
                <label for="tags" class="col-md-2 control-label">Excl. Tags</label>
                <div class="col-md-10">
                    <tag-input taglist='data.exclTags' inputdisabled='true' deletecallback='deleteExclTag(changedString)'></tag-input>
                    <span class="help-block">List of available tags. <a href="javascript:void(null);" ng-click="addAll()">Add all</a></span>
                </div>
            </div>

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

            <div class="row form-group">
                <label for="maxTime" class="col-md-2 control-label">Max time</label>
                <div class="col-md-10">
                    <input type="number" class="form-control" id="maxTime" name="maxTime" ng-model="data.maxTime" placeholder="e.g. 20">
                    <span class="help-block">Only locations with an average turn around time of less will be shown.</span>
                </div>
            </div>

            <div class="row form-group" ng-show="authetication.loggedIn">
                <label for="maxTime" class="col-md-2 control-label">Your min rating</label>
                <div class="col-md-10">
                    <input type="number" class="form-control" id="minRating" name="minRating" ng-model="data.minRating" placeholder="e.g. 4">
                    <span class="help-block">Only locations which match your rating will be shown. Use 0 to show only locations without a complete rating.</span>
                </div>
            </div>

            <div class="row form-group">
                <div class="col-md-10 col-md-offset-2">
                    <button type="button" class="btn btn-primary" ng-click="search()">Advise!</button>
                    <button type="button" class="btn btn-primary" ng-click="searchRandom()">Get me a random one!</button>
                </div>
            </div>

        </fieldset>
    </form>
    
    <h2 ng-show="resultData">Result</h2>
    <div ng-repeat="section in resultData">
        <h3>Agreed rating: {{section.minRating}}</h3>
        <div ng-repeat="rows in section.sectionLines | partition:2" class="row">
            <div ng-repeat="update in rows" class="col-sm-6">
                <a href="#/view/{{update.location.id}}">
                    {{update.location.officialName}} in {{update.location.city}} time: {{update.location.turnAroundTime}}
                </a>
                <ul>
                    <li ng-repeat="rating in update.ratings">{{rating.userName}} {{rating.score}}</li>
                </ul>                
            </div>
        </div>
    </div>

</div>