Initial COmmit WIP
This commit is contained in:
7
js/controller/AppController.js
Normal file
7
js/controller/AppController.js
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
app.controller('AppController', function ($scope, $location, $http, $route, $log, $rootScope, $stateParams) {
|
||||
$rootScope.sidebar = {
|
||||
show: false
|
||||
};
|
||||
$scope.sidebar = $rootScope.sidebar;
|
||||
});
|
||||
146
js/controller/BoardController.js
Normal file
146
js/controller/BoardController.js
Normal file
@@ -0,0 +1,146 @@
|
||||
|
||||
app.controller('BoardController', function ($rootScope, $scope, $location, $http, $route, $stateParams, boardFactory, stackFactory, StackService) {
|
||||
|
||||
$scope.sidebar = $rootScope.sidebar;
|
||||
$scope.newCard = {};
|
||||
$scope.stackservice = StackService;
|
||||
$scope.id = $stateParams.boardId;
|
||||
|
||||
$scope.status = {
|
||||
'active': true,
|
||||
'icon': 'loading',
|
||||
'title': 'Bitte warten',
|
||||
'text': 'Es dauert noch einen kleinen Moment'
|
||||
};
|
||||
|
||||
$scope.setStatus = function($icon, $title, $text='') {
|
||||
$scope.status.active = true;
|
||||
$scope.status.icon = $icon;
|
||||
$scope.status.title = $title;
|
||||
$scope.status.text = $text;
|
||||
}
|
||||
|
||||
$scope.unsetStatus = function() {
|
||||
$scope.status = {
|
||||
'active': false
|
||||
}
|
||||
}
|
||||
|
||||
$scope.getBoard = function() {
|
||||
boardFactory.getBoard($scope.id)
|
||||
.then(function (response) {
|
||||
$scope.board = response.data;
|
||||
$scope.unsetStatus();
|
||||
}, function (error) {
|
||||
$scope.setStatus('error','Unable to load board data', error);
|
||||
});
|
||||
}
|
||||
|
||||
$scope.getStacks = function() {
|
||||
stackFactory.getStacks($scope.id)
|
||||
.then(function (response) {
|
||||
|
||||
$scope.stacks = response.data;
|
||||
$scope.unsetStatus();
|
||||
}, function (error) {
|
||||
$scope.setStatus('error','Unable to load board data', error);
|
||||
});
|
||||
}
|
||||
|
||||
$scope.createStack = function () {
|
||||
$scope.newStack.boardId = $scope.id;
|
||||
stackFactory.createStack($scope.newStack)
|
||||
.then(function (response) {
|
||||
$scope.stacks.push(response.data);
|
||||
$scope.newStack = {};
|
||||
$scope.status.addStack=false;
|
||||
}, function(error) {
|
||||
$scope.status.createBoard = 'Unable to insert board: ' + error.message;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.rgblight = function (hex) {
|
||||
var result = /^([A-Fa-f\d]{2})([A-Fa-f\d]{2})([A-Fa-f\d]{2})$/i.exec(hex);
|
||||
var color = result ? {
|
||||
r: parseInt(result[1], 16),
|
||||
g: parseInt(result[2], 16),
|
||||
b: parseInt(result[3], 16)
|
||||
} : null;
|
||||
if(result !== null) {
|
||||
var rgba = "rgba(" + color.r + "," + color.g + "," + color.b + ",0.7)";
|
||||
return rgba;
|
||||
} else {
|
||||
return "#"+hex;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// settings for card sorting
|
||||
$scope.sortOptions = {
|
||||
itemMoved: function (event) {
|
||||
event.source.itemScope.modelValue.status = event.dest.sortableScope.$parent.column;
|
||||
console.log(event.dest.sortableScope.$parent);
|
||||
},
|
||||
orderChanged: function (event) {
|
||||
},
|
||||
scrollableContainer: '#board',
|
||||
containerPositioning: 'relative',
|
||||
containment: '#board',
|
||||
// auto scroll on drag
|
||||
dragMove: function (itemPosition, containment, eventObj) {
|
||||
if (eventObj) {
|
||||
var container = $("#board");
|
||||
var offset = container.offset();
|
||||
targetX = eventObj.pageX - (offset.left || container.scrollLeft());
|
||||
targetY = eventObj.pageY - (offset.top || container.scrollTop());
|
||||
if (targetX < offset.left) {
|
||||
container.scrollLeft(container.scrollLeft() - 50);
|
||||
} else if (targetX > container.width()) {
|
||||
container.scrollLeft(container.scrollLeft() + 50);
|
||||
}
|
||||
if (targetY < offset.top) {
|
||||
container.scrollTop(container.scrollTop() - 50);
|
||||
} else if (targetY > container.height()) {
|
||||
container.scrollTop(container.scrollTop() + 50);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$scope.sortStackOptions = {
|
||||
itemMoved: function (event) {
|
||||
event.source.itemScope.modelValue.status = event.dest.sortableScope.$parent.column;
|
||||
console.log(event.dest.sortableScope.$parent);
|
||||
},
|
||||
orderChanged: function (event) {
|
||||
},
|
||||
scrollableContainer: '#board',
|
||||
containerPositioning: 'relative',
|
||||
containment: '#board',
|
||||
// auto scroll on drag
|
||||
dragMove: function (itemPosition, containment, eventObj) {
|
||||
if (eventObj) {
|
||||
var container = $("#board");
|
||||
var offset = container.offset();
|
||||
targetX = eventObj.pageX - (offset.left || container.scrollLeft());
|
||||
targetY = eventObj.pageY - (offset.top || container.scrollTop());
|
||||
if (targetX < offset.left) {
|
||||
container.scrollLeft(container.scrollLeft() - 50);
|
||||
} else if (targetX > container.width()) {
|
||||
container.scrollLeft(container.scrollLeft() + 50);
|
||||
}
|
||||
if (targetY < offset.top) {
|
||||
container.scrollTop(container.scrollTop() - 50);
|
||||
} else if (targetY > container.height()) {
|
||||
container.scrollTop(container.scrollTop() + 50);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
$scope.getBoard();
|
||||
$scope.getStacks();
|
||||
|
||||
|
||||
});
|
||||
23
js/controller/CardController.js
Normal file
23
js/controller/CardController.js
Normal file
@@ -0,0 +1,23 @@
|
||||
|
||||
|
||||
app.controller('CardController', function ($scope, $rootScope, $routeParams, $location, $stateParams) {
|
||||
$scope.sidebar = $rootScope.sidebar;
|
||||
|
||||
$scope.location = $location;
|
||||
$scope.card = {'id': 1, 'title': 'We should implement all the useful things, that a kanban like project managemnt system needs for having success', 'description': 'Non et quibusdam officiis expedita excepturi. Tenetur ea et dignissimos qui. Rerum quis commodi aperiam amet dolorum suscipit asperiores. Enim dolorem ea nisi voluptate. \
|
||||
Consequatur enim iste dolore autem est unde voluptatum. Aut sit et iure. Suscipit deserunt nisi repellat in officiis alias. Nihil beatae ea ut laudantium at.\
|
||||
Doloribus nihil ipsa consequatur laudantium qui enim eveniet quo. Voluptatum tenetur sunt quis sint aliquam et molestias. Quae voluptatem tempora qui eaque qui esse possimus magni. Animi dolorem maiores iste.\
|
||||
Totam ut tempora officiis ipsam dolorem modi. Dolores hic aut itaque. Earum in est voluptas voluptatum. Cumque pariatur qui omnis placeat. Eius sed sunt corrupti dolorem quo.'};
|
||||
$scope.cardId = $stateParams.cardId;
|
||||
|
||||
console.log($stateParams);
|
||||
|
||||
|
||||
|
||||
/*var menu = $('#app-content');
|
||||
menu.click(function(event){
|
||||
$scope.location.path('/board/'+$scope.boardId);
|
||||
$scope.$apply();
|
||||
|
||||
});*/
|
||||
});
|
||||
64
js/controller/ListController.js
Normal file
64
js/controller/ListController.js
Normal file
@@ -0,0 +1,64 @@
|
||||
|
||||
app.controller('ListController', function ($scope, $location, boardFactory, StackService) {
|
||||
$scope.boards = null;
|
||||
$scope.newBoard = {};
|
||||
$scope.status = {};
|
||||
$scope.colors = ['31CC7C', '317CCC', 'FF7A66', 'F1DB50', '7C31CC', 'CC317C', '3A3B3D', 'CACBCD'];
|
||||
$scope.stackservice = StackService;
|
||||
|
||||
$scope.getBoards = function() {
|
||||
boardFactory.getBoards()
|
||||
.then(function (response) {
|
||||
$scope.boards = response.data;
|
||||
for (var i = 0; i < $scope.boards.length; i++) {
|
||||
$scope.boards[i].status = {
|
||||
'edit': false,
|
||||
}
|
||||
}
|
||||
}, function (error) {
|
||||
$scope.status.getBoards = 'Unable to load customer data: ' + error.message;
|
||||
});
|
||||
}
|
||||
|
||||
$scope.createBoard = function () {
|
||||
boardFactory.createBoard($scope.newBoard)
|
||||
.then(function (response) {
|
||||
$scope.boards.push(response.data);
|
||||
$scope.newBoard = {};
|
||||
$scope.status.addBoard=false;
|
||||
}, function(error) {
|
||||
$scope.status.createBoard = 'Unable to insert board: ' + error.message;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.updateBoard = function(board) {
|
||||
boardFactory.updateBoard(board)
|
||||
.then(function (response) {
|
||||
board = response.data;
|
||||
}, function(error) {
|
||||
$scope.status.createBoard = 'Unable to insert board: ' + error.message;
|
||||
});
|
||||
board.status.edit = false;
|
||||
$scope.$apply();
|
||||
};
|
||||
|
||||
$scope.selectColor = function(color) {
|
||||
$scope.newBoard.color = color;
|
||||
};
|
||||
|
||||
$scope.deleteBoard = function (index) {
|
||||
var board = $scope.boards[index];
|
||||
boardFactory.deleteBoard(board.id)
|
||||
.then(function (response) {
|
||||
$scope.status.deleteBoard = 'Deleted Board';
|
||||
$scope.boards.splice( index, 1 );
|
||||
|
||||
}, function(error) {
|
||||
$scope.status.deleteBoard = 'Unable to insert board: ' + error.message;
|
||||
});
|
||||
};
|
||||
$scope.getBoards();
|
||||
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user