mirror of
https://github.com/semaphoreui/semaphore.git
synced 2025-01-20 15:29:28 +01:00
Improve project creation UI
- Improve project adding UI - Fix bug filtering for single project
This commit is contained in:
parent
1805c32e90
commit
4be4d12c3b
@ -2,13 +2,15 @@ define(['controllers/projects/edit'], function () {
|
||||
app.registerController('DashboardCtrl', ['$scope', '$http', '$uibModal', function ($scope, $http, $modal) {
|
||||
$scope.projects = [];
|
||||
|
||||
$http.get('/projects').success(function (projects) {
|
||||
$scope.projects = projects;
|
||||
});
|
||||
$scope.refresh = function () {
|
||||
$http.get('/projects').success(function (projects) {
|
||||
$scope.projects = projects;
|
||||
});
|
||||
|
||||
$http.get('/events').success(function (events) {
|
||||
$scope.events = events;
|
||||
});
|
||||
$http.get('/events').success(function (events) {
|
||||
$scope.events = events;
|
||||
});
|
||||
}
|
||||
|
||||
$scope.addProject = function () {
|
||||
$modal.open({
|
||||
@ -16,10 +18,13 @@ define(['controllers/projects/edit'], function () {
|
||||
}).result.then(function (project) {
|
||||
$http.post('/projects', project)
|
||||
.success(function () {
|
||||
$scope.refresh();
|
||||
}).error(function (data, status) {
|
||||
swal('Error', 'Could not create project: ' + status, 'error');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$scope.refresh();
|
||||
}]);
|
||||
});
|
@ -15,11 +15,11 @@ func getEvents(c *gin.Context) {
|
||||
LeftJoin("project as p on event.project_id=p.id").
|
||||
OrderBy("created desc")
|
||||
|
||||
projectObj, exists := c.Get("event")
|
||||
projectObj, exists := c.Get("project")
|
||||
if exists == true {
|
||||
// limit query to project
|
||||
project := projectObj.(models.Project)
|
||||
q = q.Where("project_id=?", project.ID)
|
||||
q = q.Where("event.project_id=?", project.ID)
|
||||
} else {
|
||||
q = q.LeftJoin("project__user as pu on pu.project_id=p.id").
|
||||
Where("p.id IS NULL or pu.user_id=?", user.ID)
|
||||
|
Loading…
Reference in New Issue
Block a user