<partial template="header"></partial>

<div class="container">

<p class="lead">Fragments</p>

<p>
    Define an insertion cassette as a fragment first, annotate the fragment,
    then easily insert the fragment into a genome.
</p>

<div class="well">
<div class="input-group">
    <span class="input-group-addon"> Search: </span>
    <input ng-model="query" class='form-control' ng-change="delayFetch()">
</div>
</div>

<div class="pull-right">
<button class="btn btn-primary btn-xs"
        ng-if="hasPrev" ng-click="prevPage()">Prev Page</button>
&nbsp;
<button class="btn btn-primary btn-xs"
        ng-if="hasMore" ng-click="nextPage()">Next Page</button>
</div>

<table class="table table-striped table-condensed">
<thead> <tr> <th>ID</th> <th>Name</th> <th>Length</th></tr> </thead>
<tr ng-repeat="fragment in fragments">
    <td> <a href="#/fragments/{{fragment.id}}">{{ fragment.id }}</a> </td>
    <td> <a class="fs-block" href="#/fragments/{{fragment.id}}">{{ fragment.name }}</a> </td>
    <td> {{ fragment.length }} </td>
</tr>
</table>

<p class="lead space-top">
Add new fragment
</p>

<div class="well" ng-show="add_fragment_error">
    <span class="text-danger">Error: {{ add_fragment_error.message }}</span>
</div>

<form role="form">
    <div class="form-group">
        <label for="fragment_name">Name:</label>
        <input class="fs-block" id="fragment_name" type="text" ng-model="fragment.name" />
    </div>
    <div class="form-group">
        <label for="fragment_sequence">Sequence:</label><br/>
        <textarea id="fragment_sequence" class="sequence" ng-model="fragment.sequence"></textarea>
    </div>
    <button class="btn btn-primary" ng-click="addFragment(fragment)">Create Fragment</button>
</form>

</div> <!-- container -->

