UI work for "Automatic Actions" feature. No back end yet.
This commit is contained in:
parent
5a3cf70229
commit
a45ad075e0
@ -42,6 +42,7 @@
|
|||||||
<script src="js/controllers/boardsItemView.js"></script>
|
<script src="js/controllers/boardsItemView.js"></script>
|
||||||
<script src="js/controllers/files.js"></script>
|
<script src="js/controllers/files.js"></script>
|
||||||
<script src="js/controllers/settings.js"></script>
|
<script src="js/controllers/settings.js"></script>
|
||||||
|
<script src="js/controllers/settingsAutoActions.js"></script>
|
||||||
<script src="js/controllers/settingsUser.js"></script>
|
<script src="js/controllers/settingsUser.js"></script>
|
||||||
<script src="js/controllers/settingsUserForm.js"></script>
|
<script src="js/controllers/settingsUserForm.js"></script>
|
||||||
<script src="js/controllers/settingsBoard.js"></script>
|
<script src="js/controllers/settingsBoard.js"></script>
|
||||||
|
137
js/controllers/settingsAutoActions.js
Normal file
137
js/controllers/settingsAutoActions.js
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
taskBoardControllers.controller('AutomaticActionsCtrl',
|
||||||
|
['$scope', '$interval',
|
||||||
|
function ($scope, $interval) {
|
||||||
|
$scope.loadingActions = false; // Change to true once loading is implemented
|
||||||
|
$scope.actions = [];
|
||||||
|
|
||||||
|
$scope.actionData = {
|
||||||
|
isSaving: false,
|
||||||
|
board: null,
|
||||||
|
trigger: 0,
|
||||||
|
triggerWord: '',
|
||||||
|
secondary: null,
|
||||||
|
action: 0,
|
||||||
|
color: null,
|
||||||
|
category: null,
|
||||||
|
assignee: null
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.actionOptions = {
|
||||||
|
triggers: [
|
||||||
|
{
|
||||||
|
id: 0,
|
||||||
|
trigger: 'Item moves to lane',
|
||||||
|
actions: [
|
||||||
|
{ id: 0, action: 'Set item color' },
|
||||||
|
{ id: 1, action: 'Set item category'},
|
||||||
|
{ id: 2, action: 'Set item assignee' },
|
||||||
|
{ id: 3, action: 'Clear item due date' }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
trigger: 'Item assigned to user',
|
||||||
|
actions: [
|
||||||
|
{ id: 0, action: 'Set item color' },
|
||||||
|
{ id: 1, action: 'Set item category'},
|
||||||
|
{ id: 3, action: 'Clear item due date' }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
trigger: 'Item set to category',
|
||||||
|
actions: [
|
||||||
|
{ id: 0, action: 'Set item color' },
|
||||||
|
{ id: 2, action: 'Set item assignee' },
|
||||||
|
{ id: 3, action: 'Clear item due date' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.addAction = function() {
|
||||||
|
// TBD
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.secondarySelection = [];
|
||||||
|
$scope.updateSecondary = function() {
|
||||||
|
$scope.secondarySelection = [];
|
||||||
|
$scope.actionData.secondary = null;
|
||||||
|
$scope.actionData.action = 0;
|
||||||
|
var boardData = null;
|
||||||
|
|
||||||
|
$scope.boards.forEach(function(board) {
|
||||||
|
if (board.id === $scope.actionData.board) {
|
||||||
|
boardData = board;
|
||||||
|
$scope.boardCategories = board.ownCategory;
|
||||||
|
$scope.userList = board.sharedUser;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (null !== boardData) {
|
||||||
|
switch($scope.actionData.trigger) {
|
||||||
|
case 0:
|
||||||
|
$scope.secondarySelection = boardData.ownLane;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
$scope.secondarySelection = boardData.sharedUser;
|
||||||
|
$scope.secondarySelection.forEach(function(user) {
|
||||||
|
user.name = user.username;
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
$scope.secondarySelection = boardData.ownCategory;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.getTriggerWord = function() {
|
||||||
|
if ($scope.actionData.trigger !== null) {
|
||||||
|
var word = $scope.actionOptions.triggers[$scope.actionData.trigger].trigger.split(" ").pop();
|
||||||
|
$scope.actionData.triggerWord = word.charAt(0).toUpperCase() + word.slice(1);
|
||||||
|
}
|
||||||
|
$scope.updateSecondary();
|
||||||
|
};
|
||||||
|
$scope.getTriggerWord();
|
||||||
|
|
||||||
|
$scope.resetActionSecondary = function() {
|
||||||
|
$scope.actionData.color = null;
|
||||||
|
$scope.actionData.category = null;
|
||||||
|
$scope.actionData.assignee = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
var defaultColor = '#ffffe0';
|
||||||
|
$scope.spectrum = function(color) {
|
||||||
|
color = color || defaultColor;
|
||||||
|
$('#spectrum').spectrum({
|
||||||
|
color: color,
|
||||||
|
allowEmpty: false,
|
||||||
|
localStorageKey: 'taskboard.colorPalette',
|
||||||
|
showPalette: true,
|
||||||
|
palette: [[]],
|
||||||
|
showSelectionPalette: true,
|
||||||
|
showButtons: false,
|
||||||
|
showInput: true,
|
||||||
|
preferredFormat: 'hex3',
|
||||||
|
disabled: $scope.actionData.board === null
|
||||||
|
});
|
||||||
|
};
|
||||||
|
$scope.updateColorpicker = function() {
|
||||||
|
if (null !== $scope.actionData.board) {
|
||||||
|
$('#spectrum').spectrum("enable");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$('#spectrum').spectrum("disable");
|
||||||
|
};
|
||||||
|
|
||||||
|
// Check every 250ms to see if a board has been chosen.
|
||||||
|
var updateIfBoardChosen = function() {
|
||||||
|
if ($scope.actionData.board !== null) {
|
||||||
|
$interval.cancel($scope.interval); // Stop checking once it has.
|
||||||
|
$scope.getTriggerWord();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
$scope.interval = $interval(updateIfBoardChosen, 250);
|
||||||
|
$scope.$on('$destroy', function () { $interval.cancel($scope.interval); });
|
||||||
|
}]);
|
@ -40,5 +40,11 @@
|
|||||||
<div data-include-replace="partials/settingsBoardTable.html"></div>
|
<div data-include-replace="partials/settingsBoardTable.html"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="min-padding col-md-6">
|
||||||
|
<div class="settings-widget" data-ng-controller="AutomaticActionsCtrl">
|
||||||
|
<h3 class="widget-header">Automatic Actions</h3>
|
||||||
|
<div data-include-replace="partials/settingsAutoActions.html"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
98
partials/settingsAutoActions.html
Normal file
98
partials/settingsAutoActions.html
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
<div class="widget-content">
|
||||||
|
<h4>Current Actions</h4>
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table tabe-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Board</th><th>Trigger</th><th>Action</th><th>Remove</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr data-ng-if="loadingActions">
|
||||||
|
<td colspan="4" align="center">
|
||||||
|
<span class="fa fa-refresh fa-spin"></span> Loading Board Actions...
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr data-ng-if="!loadingActions && !actions.length">
|
||||||
|
<td data-ng-if="!currentUser.isAdmin" colspan="4" align="center">
|
||||||
|
There are no automatic actions. Contact an admin user to create one.
|
||||||
|
</td>
|
||||||
|
<td data-ng-if="currentUser.isAdmin" colspan="4" align="center">
|
||||||
|
There are no current automatic actions. Use the <strong>Add Action</strong> form below to add one.
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr data-ng-repeat="action in actions">
|
||||||
|
<td>{{ action.board }}</td>
|
||||||
|
<td>{{ action.trigger }}</td>
|
||||||
|
<td>{{ action.action }}</td>
|
||||||
|
<td>
|
||||||
|
<span class="links">
|
||||||
|
<a class="fa fa-trash-o" title="Remove Action" data-ng-click="removeAction(action.id)"></a>
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div data-ng-if="currentUser.isAdmin">
|
||||||
|
<h4>Add Action</h4>
|
||||||
|
<fieldset data-ng-disabled="actionData.isSaving || loadingActions || currentBoard.loading">
|
||||||
|
<div class="form-group col-md-4">
|
||||||
|
<label for="boards">Select Board:</label>
|
||||||
|
<select class="form-control" id="boards" data-ng-model="actionData.board"
|
||||||
|
data-ng-options="board.id as board.name for board in boardNames"
|
||||||
|
data-ng-change="updateColorpicker()">
|
||||||
|
<option value="">Select Board...<option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-4">
|
||||||
|
<label for="triggerSelect">Select Trigger:</label>
|
||||||
|
<select class="form-control" id="triggerSelect" data-ng-model="actionData.trigger"
|
||||||
|
data-ng-options="trigger.id as trigger.trigger for trigger in actionOptions.triggers"
|
||||||
|
data-ng-disabled="null === actionData.board"
|
||||||
|
data-ng-change="getTriggerWord()">
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-4">
|
||||||
|
<label for="triggerSelect">Select Action:</label>
|
||||||
|
<select class="form-control" id="triggerSelect" data-ng-model="actionData.action"
|
||||||
|
data-ng-options="action.id as action.action for action in actionOptions.triggers[actionData.trigger].actions"
|
||||||
|
data-ng-disabled="null === actionData.board"
|
||||||
|
data-ng-change="resetActionSecondary()">
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-4 col-md-offset-4">
|
||||||
|
<select class="form-control" data-ng-model="actionData.secondary"
|
||||||
|
data-ng-options="select.id as select.name for select in secondarySelection"
|
||||||
|
data-ng-disabled="null === actionData.board">
|
||||||
|
<option value="">Select {{ actionData.triggerWord }}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-4 disabled">
|
||||||
|
<input class="form-control" type="text" id="spectrum" data-ng-model="actionData.color"
|
||||||
|
data-on-load-callback="spectrum"
|
||||||
|
data-ng-if="actionData.action === 0">
|
||||||
|
<select class="form-control" data-ng-model="actionData.category"
|
||||||
|
data-ng-options="cat.id as cat.name for cat in boardCategories"
|
||||||
|
data-ng-disabled="null === actionData.board"
|
||||||
|
data-ng-if="actionData.action === 1">
|
||||||
|
<option value="">Select Category</option>
|
||||||
|
</select>
|
||||||
|
<select class="form-control" data-ng-model="actionData.assignee"
|
||||||
|
data-ng-options="user.id as user.username for user in userList"
|
||||||
|
data-ng-disabled="null === actionData.board"
|
||||||
|
data-ng-if="actionData.action === 2">
|
||||||
|
<option value="">Select Assignee</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-12">
|
||||||
|
<p>
|
||||||
|
<a role="button" id="addAction" class="btn btn-info pull-right"
|
||||||
|
data-ng-click="addAction()" title="Add Action">
|
||||||
|
Add Action <span class="fa fa-plus"></span>
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -97,11 +97,11 @@ Count was done from parent directory of TaskBoard as `./cloc-1.62.pl TaskBoard -
|
|||||||
|
|
||||||
Language | Files | Blank Lines | Comments | Code
|
Language | Files | Blank Lines | Comments | Code
|
||||||
-------------------|-------:|-------------:|---------:|---------:
|
-------------------|-------:|-------------:|---------:|---------:
|
||||||
Javascript | 21 | 154 | 32 | 1569
|
Javascript | 22 | 164 | 34 | 1694
|
||||||
HTML | 16 | 7 | 8 | 822
|
HTML | 17 | 7 | 8 | 927
|
||||||
PHP | 6 | 130 | 54 | 738
|
PHP | 6 | 130 | 54 | 738
|
||||||
CSS | 1 | 12 | 33 | 608
|
CSS | 1 | 12 | 33 | 608
|
||||||
Bourne Again Shell | 4 | 10 | 0 | 53
|
Bourne Again Shell | 4 | 10 | 0 | 53
|
||||||
__SUM:__ | __48__ | __313__ | __127__ | __3790__
|
__SUM:__ | __50__ | __323__ | __129__ | __4020__
|
||||||
|
|
||||||
Counts Last Updated: Oct. 10, 2014
|
Counts Last Updated: Oct. 10, 2014
|
||||||
|
Reference in New Issue
Block a user