Skip to content

Commit c59ef6f

Browse files
committed
💄Update UI of team home page for SP
1 parent 93f4a5d commit c59ef6f

File tree

2 files changed

+56
-5
lines changed

2 files changed

+56
-5
lines changed

‎public/javascripts/team_home.js‎

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ app.controller('TeamHomeController', ['$scope', '$uibModal', '$log', '$http', '$
2020
$scope.Rleagues = {};
2121
$http.get("/api/teams/leagues").then(function (response) {
2222
$scope.leagues = response.data;
23-
2423
for(let l of $scope.leagues){
2524
$scope.Rleagues[l] = false;
2625
}
@@ -101,4 +100,26 @@ app.controller('TeamHomeController', ['$scope', '$uibModal', '$log', '$http', '$
101100
}
102101

103102
}
103+
104+
const lColor = [
105+
'#81ecec',
106+
'#74b9ff',
107+
'#a29bfe',
108+
'#ffeaa7',
109+
'#fab1a0',
110+
'#fd79a8',
111+
'#b2bec3'
112+
]
113+
$scope.leagueColor = function(league){
114+
let lIndex = $scope.leagues.indexOf(league) % lColor.length;
115+
return lColor[lIndex];
116+
}
117+
118+
$scope.isSmartPhone = function() {
119+
if (window.matchMedia && window.matchMedia('(max-device-width: 640px)').matches) {
120+
return true;
121+
} else {
122+
return false;
123+
}
124+
}
104125
}]);

‎views/team_home.pug‎

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ block content
5555
label.checkbox(for="checkL_{{key}}") {{key}}
5656

5757

58-
table.custom(style="margin-bottom:20px;")
58+
table.custom(style="margin-bottom:20px;" ng-if="!isSmartPhone()")
5959
thead
6060
tr
6161
th {{"common.teamCode" | translate}}
6262
th {{"common.team" | translate}}
6363
th {{"common.region" | translate}}
6464
th {{"common.league" | translate}}
65-
th {{"common.checkin" | translate}}
65+
//th {{"common.checkin" | translate}}
6666
th {{"common.inspected" | translate}}
6767
th {{'common.operation' | translate}}
6868
tbody
@@ -71,7 +71,7 @@ block content
7171
td(ng-bind='team.name')
7272
td(ng-bind='team.country')
7373
td(ng-bind='team.league')
74-
td
74+
//td
7575
i(class="fa fa-2x fa-check" aria-hidden="true" style="color:#2ecc71;" ng-if="team.checkin")
7676
i(class="fa fa-2x fa-times" aria-hidden="true" style="color:#e74c3c;" ng-if="!team.checkin")
7777
td
@@ -92,4 +92,34 @@ block content
9292
if view
9393
button.btn.btn-sm.btn-success(type='button', ng-click="go('/document/reviewed/' + team._id + '?return=/home/' + team.competition + '/teams')", style="margin-right:5px;")
9494
i.fas.fa-file-alt  
95-
| {{"team_home.result" | translate}}
95+
| {{"team_home.result" | translate}}
96+
97+
.card(style='width: 100%;margin-bottom:10px;' ng-repeat='team in teams | filter:list_filter | orderBy:"[teamCode, name]"' ng-if="isSmartPhone()")
98+
.card-body
99+
h5.card-title {{team.teamCode}} {{team.name}}
100+
h6.card-subtitle.mb-2.text-muted
101+
span.badge(style="margin:0 5px 0 5px;color:#444;" ng-style="{backgroundColor: leagueColor(team.league)}") {{team.league}}
102+
span.badge.badge-success(ng-if="team.inspected" style="margin:0 5px 0 5px;") {{"common.inspected" | translate}} 
103+
i(class="fa fa-check" aria-hidden="true" style="color:#fff;")
104+
span.badge.badge-danger(ng-if="!team.inspected" style="margin:0 5px 0 5px;") {{"common.inspected" | translate}} 
105+
i(class="fa fa-times" aria-hidden="true" style="color:#fff;")
106+
span(ng-show="team.country")
107+
i.fas.fa-globe-asia  
108+
span {{team.country}}
109+
110+
111+
if judge
112+
button.btn.btn-sm.btn-outline-warning(type='button', ng-click="go('/document/inspection/' + team._id)", style="margin:0 5px 5px 0;")
113+
i.fas.fa-ruler-combined  
114+
| {{"common.inspection" | translate}}
115+
button.btn.btn-sm.btn-outline-info(type='button', ng-click="go('/document/public/' + team._id)", style="margin:0 5px 5px 0;", ng-if="team.document.public")
116+
i.fas.fa-file-alt  
117+
| {{"team_home.document" | translate}}
118+
if judge
119+
button.btn.btn-sm.btn-outline-primary(type='button', ng-click="go('/document/review/' + team._id + '?return=/home/' + team.competition + '/teams')", style="margin:0 5px 5px 0;")
120+
i.fas.fa-file-alt  
121+
| {{"team_home.review" | translate}}
122+
if view
123+
button.btn.btn-sm.btn-outline-success(type='button', ng-click="go('/document/reviewed/' + team._id + '?return=/home/' + team.competition + '/teams')", style="margin:0 5px 5px 0;")
124+
i.fas.fa-file-alt  
125+
| {{"team_home.result" | translate}}

0 commit comments

Comments
 (0)