-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathride-details.html
113 lines (100 loc) · 4.83 KB
/
ride-details.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<!DOCTYPE html>
<html ng-app="pelotonApp">
<head>
<style>
</style>
<base target="_top">
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.0/angular.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<script>
angular.module('pelotonApp', [])
.controller('PelotonRideController', function($scope, $httpParamSerializer) {
var rideController = this;
rideController.competition=null;
rideController.loading=false;
rideController.competitions=JSON.parse("<?= JSON.stringify(getCompetitions()) ?>");
rideController.ride=JSON.parse("<?= JSON.stringify(getRideDetails(ride_id)) ?>");
rideController.loadWorkoutsForRide=function(ride_id){
rideController.loading=true;
if(rideController.competition==null) {
alert("Please select a competition. Add one to the competitions worksheet if it's missing");
rideController.loading=false;
}
google.script.run.loadRaceResults(ride_id, rideController.competition);
};
rideController.purgeWorkoutsForRide=function(ride_id){
rideController.loading=true;
if(rideController.competition==null) {
if(!confirm("Purge ALL results for any Event? Select 'Cancel/No' if you want to purge results for a specific event, and select the event before clicking this button!")) {
rideController.loading=false;
return;
}
}
google.script.run.purgeRaceResults(ride_id, rideController.competition);
};
});
</script>
</head>
<body ng-controller="PelotonRideController as peloton">
<div class="card bg-dark text-white">
<img src="{{peloton.ride.image_url}}" class="card-img" alt="...">
<div class="card-img-overlay">
<h4 class="card-title">{{peloton.ride.title}}</h4>
<h5 class="card-title">{{peloton.ride.instructor.name}}</h5>
<p class="card-text">{{peloton.ride.original_air_time*1000 | date:"yyyy-MM-dd HH:mma"}}</p>
</div>
</div>
<div class="container">
<div class="row mx-md-n3 mt-3">
<div class="col col-md-4 px-md-n2">
<div class="card">
<div class="card-body">
<h3>{{peloton.ride.title}}</h3>
<p class="card-text"> {{peloton.ride.description}}</p>
</div>
</div>
</div>
<div class="col col-md-4 px-md-n2">
<div class="card">
<div class="card-body">
<p class="card-text">
<b>Rating:</b>{{peloton.ride.overall_rating_avg * 100|number:1}}%
<br><b>People who rated:</b> {{peloton.ride.overall_rating_count}}
<br><b>Workouts:</b> {{peloton.ride.total_workouts}}
<span style='color:red;' ng-if="peloton.ride.total_in_progress_workouts>0">({{peloton.ride.total_in_progress_workouts}} right now)</span>
<br><b>Duration:</b> {{peloton.ride.duration / 60}} Minutes
<br><b>Difficulty Rating:</b> {{peloton.ride.difficulty_estimate *100|number:1}}%
<br><b>Total Following Workouts:</b> {{peloton.ride.total_following_workouts}}
<br><b>Your Workouts:</b> {{peloton.ride.total_user_workouts}}
<br><b>Favorite:</b> {{peloton.ride.is_favorite}}
<hr>
<h4>Add/Refresh Ride Results</h4>
<small class="muted">This will automatically purge/refresh any other results for this ride</small>
<label for="competitionSelect"> Race/Event (Required): </label>
<select name="competitionSelect" id="competitionSelect" ng-model="peloton.competition">
<option ng-repeat="comp in peloton.competitions |orderBy:'comp.Start.getTime()':reverse" value="{{comp.Name}}">{{comp.Name}}</option>
</select>
<div ng-if="peloton.loading" style="text-align:center"> <i class="fa fa-circle-o-notch fa-spin fa-3x fa-fw"></i></div>
<br>
<button ng-disabled="peloton.loading" ng-show="peloton.ride.total_following_workouts > 0" ng-click="peloton.loadWorkoutsForRide(peloton.ride.id)"
class="badge badge-pill badge-danger">Load/Refresh Ride Results</button>
<br>
<button ng-disabled="peloton.loading" ng-click="peloton.purgeWorkoutsForRide(peloton.ride.id)"
class="badge badge-pill badge-secondary">Purge Ride Results</button>
</div>
</div>
</div>
<div class="col col-md-4 px-md-n2" >
<div class="card">
<img src="{{peloton.ride.instructor.image_url}}" class="card-img-top"/>
<div class="card-body">
<p class="card-text"> {{peloton.ride.instructor.bio}} </p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>