Skip to content

Commit

Permalink
integrated first events
Browse files Browse the repository at this point in the history
  • Loading branch information
julianseeger committed Jun 23, 2014
1 parent 4af3ece commit 80de842
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
12 changes: 9 additions & 3 deletions web/app/scripts/controllers/navi.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Controller of the metricsApp
*/
angular.module('metricsApp')
.controller('NaviCtl', ['$scope', '$location', '$modal', 'Api', 'ProjectScope', function ($scope, $location, $modal, Api, ProjectScope) {
.controller('NaviCtl', ['$scope', '$rootScope', '$location', '$modal', 'Api', 'ProjectScope', function ($scope, $rootScope, $location, $modal, Api, ProjectScope) {
/** @type ApiService Api */
$scope.projects = [];
$scope.ProjectScope = ProjectScope;
Expand All @@ -27,17 +27,23 @@ angular.module('metricsApp')
});

modalInstance.result.then(function () {
$scope.reloadProjects();
$rootScope.$emit('projectsChange');
});
};

$scope.selectProject = function (project) {
ProjectScope.project = project;
$scope.versions = Api.getVersions(project);
$scope.reloadVersions();
};

$scope.reloadVersions = function() {
$scope.versions = Api.getVersions(ProjectScope.project);
};

$scope.reloadProjects = function() {
$scope.projects = Api.getProjects();
};
$scope.reloadProjects();
$rootScope.$on('versionsChange', $scope.reloadVersions);
$rootScope.$on('projectsChange', $scope.reloadProjects);
}]);
3 changes: 2 additions & 1 deletion web/app/scripts/controllers/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Controller of the metricsApp
*/
angular.module('metricsApp')
.controller('MaterialUploadCtl', ['$scope', '$upload', 'ProjectScope', function ($scope, $upload, ProjectScope) {
.controller('MaterialUploadCtl', ['$scope', '$rootScope', '$upload', 'ProjectScope', function ($scope, $rootScope, $upload, ProjectScope) {
$scope.version = '';
$scope.ProjectScope = ProjectScope;

Expand All @@ -34,6 +34,7 @@ angular.module('metricsApp')
}).success(function(data, status, headers, config) {
// file is uploaded successfully
console.log(data);
$rootScope.$emit('versionsChange');
});
//.error(...)
//.then(success, error, progress);
Expand Down
4 changes: 4 additions & 0 deletions web/app/styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,7 @@ body {
border-bottom: 0;
}
}

.tag-active {
color: green
}
2 changes: 1 addition & 1 deletion web/app/views/navi.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<li class="dropdown-header">{{ versions.length }} New Versions</li>
<li class="message-preview" ng-repeat="version in versions | orderBy:'label':true">
<a href="#">
<i class="fa fa-tag"></i> {{ version.label }} <span ng-if="$first" class="label label-success">latest</span>
<i class="fa fa-tag" ng-class="{'tag-active':$first}"></i> {{ version.label }} <span ng-if="$first" class="label label-success">latest</span>
</a>
</li>
<li class="divider"></li>
Expand Down

0 comments on commit 80de842

Please sign in to comment.