Commit 57248126 authored by Francesc Guasch's avatar Francesc Guasch
Browse files

[#328] Count public and private bases at startup

After counting private and public show the toggle
view button.
parent 0afc5dbc
......@@ -119,16 +119,6 @@
});
$scope.has_public = false;
$scope.toggle_has_public=function() {
$scope.has_public = true;
};
$scope.has_private = false;
$scope.toggle_has_private =function() {
$scope.has_private = true;
};
$scope.only_public = false;
$scope.toggle_only_public=function() {
$scope.only_public = !$scope.only_public;
......
......@@ -8,8 +8,13 @@
$_anonymous=<%= ($_anonymous or 0) %>;
</script>
% my $public_bases = 0;
% my $private_bases = 0;
% for my $machine(@$machines) {
% $public_bases = 1 if $machine->{is_public};
% if ($machine->{is_public}) {
% $public_bases++;
% } else {
% $private_bases++;
% }
% }
......@@ -22,8 +27,8 @@
<div class="panel panel-default">
<div class="panel-heading">
<h2><%=l 'Choose a Machine to Start' %></h2>
% if ($user->is_admin) {
<div ng-show="has_public and has_private" ng-cloak>
% if ($user->is_admin && $public_bases && $private_bases) {
<div ng-cloak>
<a ng-click="toggle_only_public()" class="label label-primary"
align="right" ng-show="!only_public">Hide Private</a>
<a ng-click="toggle_only_public()" class="label label-primary"
......@@ -32,7 +37,6 @@
</div>
</div>
% }
<div class="panel-body">
% if (! $public_bases ) {
<div class="panel panel-warning">
......@@ -48,9 +52,8 @@
% }
% for my $machine (@$machines) {
% next if !$machine->{is_public} && !$user->is_admin;
<div class="col-sm-4"
<% if (!$machine->{is_public}) { %> ng-show="!only_public" ng-init="toggle_has_private()" <% } %>
<% if ($machine->{is_public}) { %> ng-init="toggle_has_public()" <% } %> >
<div class="col-sm-4"
ng-hide="<%= !$machine->{is_public} %> && only_public">
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title"><a
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment