Merge "Make task ordering in Story view selectable"
This commit is contained in:
commit
3f94f2fe85
@ -60,6 +60,29 @@ angular.module('sb.story').controller('StoryDetailController',
|
|||||||
$scope.projects = {};
|
$scope.projects = {};
|
||||||
$scope.tasks = tasks;
|
$scope.tasks = tasks;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allowing sorting tasks in search results by certain fields.
|
||||||
|
*/
|
||||||
|
$scope.tasks_sort_field = {
|
||||||
|
label: 'Id',
|
||||||
|
value: 'id'
|
||||||
|
};
|
||||||
|
$scope.changeOrder = function(orderBy){
|
||||||
|
$scope.tasks_sort_field.label = orderBy.toString();
|
||||||
|
switch(orderBy) {
|
||||||
|
case 'Id':
|
||||||
|
$scope.tasks_sort_field.value = 'id';
|
||||||
|
break;
|
||||||
|
case 'Status':
|
||||||
|
$scope.tasks_sort_field.value = 'status';
|
||||||
|
break;
|
||||||
|
case 'Title':
|
||||||
|
$scope.tasks_sort_field.value = 'title';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
function mapTaskToProject(task) {
|
function mapTaskToProject(task) {
|
||||||
Project.get({id: task.project_id}).$promise.then(function(project) {
|
Project.get({id: task.project_id}).$promise.then(function(project) {
|
||||||
var idx = $scope.projectNames.indexOf(project.name);
|
var idx = $scope.projectNames.indexOf(project.name);
|
||||||
|
@ -390,6 +390,25 @@
|
|||||||
|
|
||||||
<!-- Template for the task list -->
|
<!-- Template for the task list -->
|
||||||
<script type="text/ng-template" id="/inline/task_list.html">
|
<script type="text/ng-template" id="/inline/task_list.html">
|
||||||
|
<div class="pull-right">
|
||||||
|
Sort by:
|
||||||
|
<span class="dropdown form-control-static" dropdown="">
|
||||||
|
<button class="btn btn-xs btn-default" dropdown-toggle="" aria-haspopup="true" aria-expanded="true">
|
||||||
|
<li class="dropdown-header">{{tasks_sort_field.label}}</li>
|
||||||
|
</button>
|
||||||
|
<ul class="dropdown-menu dropdown-menu-right" role="menu">
|
||||||
|
<li ng-click="changeOrder('Id')">
|
||||||
|
<a>Id</a>
|
||||||
|
</li>
|
||||||
|
<li ng-click="changeOrder('Title')">
|
||||||
|
<a>Title</a>
|
||||||
|
</li>
|
||||||
|
<li ng-click="changeOrder('Status')">
|
||||||
|
<a>Status</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
<h3>Tasks</h3>
|
<h3>Tasks</h3>
|
||||||
<div ng-repeat="name in projectNames | orderBy">
|
<div ng-repeat="name in projectNames | orderBy">
|
||||||
<h4>
|
<h4>
|
||||||
@ -428,7 +447,7 @@
|
|||||||
<!-- Template for a table of tasks -->
|
<!-- Template for a table of tasks -->
|
||||||
<script type="text/ng-template" id="/inline/task_table.html">
|
<script type="text/ng-template" id="/inline/task_table.html">
|
||||||
<table class="table table-striped table-supercondensed">
|
<table class="table table-striped table-supercondensed">
|
||||||
<tr ng-repeat="task in projects[name].branches[branchName].tasks | orderBy: 'id'"
|
<tr ng-repeat="task in projects[name].branches[branchName].tasks | orderBy: tasks_sort_field.value"
|
||||||
ng-include src="'/inline/task_list_item.html'">
|
ng-include src="'/inline/task_list_item.html'">
|
||||||
</tr>
|
</tr>
|
||||||
<tr ng-show="isLoggedIn && !projects[name].branches[branchName].showAddTask">
|
<tr ng-show="isLoggedIn && !projects[name].branches[branchName].showAddTask">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user