Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions src/admin/bundles/bundles-list.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,47 @@

bundlesListController.$inject = ['$scope', '$rootScope', 'BundlesFactory'];
function bundlesListController ($scope, $rootScope, BundlesFactory) {
$scope.bundles = [];
$scope.search = {};
BundlesFactory.query(function(bundles){
$scope.bundles = bundles;
});

$scope.allBundlesCount = function () {
if ($scope.bundles) {
return $scope.bundles.length;
} else {
return 0;
}
};

$scope.activeBundlesCount = function () {
var count = 0;
angular.forEach($scope.bundles, function (bundle) {
count += bundle.isActive() ? 1 : 0;
});

return count;
};

$scope.installedBundlesCount = function () {
var count = 0;
angular.forEach($scope.bundles, function (bundle) {
count += bundle.isInstalled() ? 1 : 0;
});

return count;
};

$scope.resolvedBundlesCount = function () {
var count = 0;
angular.forEach($scope.bundles, function (bundle) {
count += bundle.isResolved() ? 1 : 0;
});

return count;
};

}

})();
21 changes: 20 additions & 1 deletion src/admin/bundles/bundles-list.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
<motech-list>
<motech-list-item ng-repeat="bundle in bundles" >
<motech-list-header>
<form class="form-inline ">
<div class="form-group">
<label for="admin.bundles.list.filter">{{msg('admin.filter')}}</label>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be {{ 'admin.filter' | translate}} here and in all of the below lines?

<input id="admin.bundles.list.filter" type="text" ng-model="search.$"/>
</div>
</form>
<h3>{{msg('admin.bundles.statistics')}}</h3>
<dl>
<dt>{{msg('admin.bundles.statistics.total')}}</dt>
<dd>{{allBundlesCount()}}</dd>
<dt>{{msg('admin.bundles.statistics.active')}}</dt>
<dd>{{activeBundlesCount()}}</dd>
<dt>{{msg('admin.bundles.statistics.installed')}}</dt>
<dd>{{installedBundlesCount()}}</dd>
<dt>{{msg('admin.bundles.statistics.resolved')}}</dt>
<dd>{{resolvedBundlesCount()}}</dd>
</dl>
</motech-list-header>
<motech-list-item ng-repeat="bundle in bundles | filter:search" >
<div column-title="Name" class="bundle-main">
<a ui-sref="bundles.bundle({bundleId:bundle.bundleId})">
<img class="bundle-icon" alt="" ng-src="{{bundle.getIconURL()}}" />
Expand Down
9 changes: 9 additions & 0 deletions src/admin/bundles/bundles.factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@
return this.state === "ACTIVE";
};

Bundle.prototype.isInstalled = function () {
return this.state === 'INSTALLED';
};

Bundle.prototype.isResolved = function () {
return this.state === 'RESOLVED';
};

function callbackSuccess(){
LoadingModal.close();
Expand Down Expand Up @@ -75,6 +82,8 @@
});
};



return Bundle;
}

Expand Down
6 changes: 6 additions & 0 deletions src/common/base/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,9 @@ h3, h4{
position: relative;
padding: 0em 1em;
}

dl{
dt, dd{
line-height: 1em;
}
}
4 changes: 4 additions & 0 deletions src/common/motech-list/list.base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
@extend .clearfix;
background-color: $brand-accent;
padding: $space-size;
>*{
@extend .navbar;
border-bottom: 0px;
}
.pagination{
@extend .button-group-primary;
}
Expand Down
16 changes: 16 additions & 0 deletions src/common/navbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Styleguide 5.1
padding: 0em 0.5em;
display: block;
>*{
margin-bottom: 0px;
margin-right: 1em;
float: left;
}
Expand Down Expand Up @@ -53,3 +54,18 @@ nav.navbar,
border-bottom-color: transparent;
}
}

.navbar dl{
display: inline-block;
>*{
display: inline-block;
}
dt:after{
content: ": ";
white-space: pre;
}
dd:after{
content: ". ";
white-space: pre;
}
}