Skip to content

Commit d212568

Browse files
committed
State params wired for training and solutions page.
1 parent 747053c commit d212568

6 files changed

Lines changed: 45 additions & 10 deletions

File tree

src/components/app.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ $stateProvider
3535
controller: 'profileCtrl'
3636
})
3737
.state('menu.solutions',{
38-
url: 'solutions',
38+
url: 'solutions/:kataid',
3939
templateUrl:'./components/solutions/solutions.html',
4040
controller: 'solutionsCtrl'
4141
})
4242
.state('menu.training',{
43-
url: 'training',
43+
url: 'training/:kataid',
4444
templateUrl:'./components/training/training.html',
4545
controller: 'trainingCtrl'
4646
});
47-
47+
4848
$urlRouterProvider.otherwise('/login');
4949
});

src/components/kata_list/kata_list.scss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,17 @@ $grey-color: #C0C0C0;
8383
width: 15vw;
8484
}
8585

86+
.kata-sort {
87+
display: flex;
88+
flex-direction: column;
89+
}
90+
91+
.kata-sort-div {
92+
display: flex;
93+
flex-direction: row;
94+
95+
}
96+
8697
.kata-list-right {
8798
width: 85vw;
8899
background-color: blue;

src/components/kata_list/library.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,26 @@
44
<div class="kata-search">
55
<input id='kata-search' ng-model="searchText" placeholder="Search">
66
</div>
7+
8+
<div class="kata-sort">
9+
<div class="kata-sort-div">
10+
<p>Sort by: </p>
11+
<p>Here's where the sort goes</p>
12+
</div>
13+
<div class="kata-sort-div">
14+
<p>Language: </p>
15+
<p>Here's where the language goes</p>
16+
</div>
17+
<div class="kata-sort-div">
18+
<p>Status: </p>
19+
<p>Here's where the Status goes</p>
20+
</div>
21+
<div class="kata-sort-div">
22+
<p>Progress: </p>
23+
<p>Here's where the Progress goes</p>
24+
</div>
25+
</div>
26+
727
</div>
828

929
<div class="kata-list-right">

src/components/mainService.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ angular.module('app').service('mainService', function($http, $q, $sce) {
8888
this.getKatasByKyu = (kyu) => {
8989
return $http({
9090
method: 'GET',
91-
url: `/api/katas-by-kyu/` + kyu
91+
url: `/api/katas-by-kyu/` + kyu
9292
});
9393
};
9494

src/components/solutions/solutionsCtrl.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
1+
/************ SOLUTIONS CONTROLLER *********/
22
// each Ctrl should call - mainService.user - for access to the user object
33

4-
angular.module('app').controller('solutionsCtrl', function($scope, $state, mainService) {
4+
angular.module('app').controller('solutionsCtrl', function($scope, $state, mainService, $stateParams) {
5+
6+
$scope.kataid = $stateParams.kataid;
57

68
// $scope.getKataById to be at the top of the page and the solutions will go below
79

@@ -15,7 +17,7 @@ angular.module('app').controller('solutionsCtrl', function($scope, $state, mainS
1517
$scope.init = () => {
1618
$scope.getKataSolutions(1 /* replace 1 with kataid when set up */);
1719
}
18-
1920

2021

21-
});
22+
23+
});

src/components/training/trainingCtrl.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
// each Ctrl should call - mainService.user - for access to the user object
44

5-
angular.module('app').controller('trainingCtrl', function($scope, $state, mainService) {
5+
angular.module('app').controller('trainingCtrl', function($scope, $state, mainService, $stateParams) {
6+
7+
$scope.kataid = $stateParams.kataid;
68

79
/** Create text areas **/
810
var textarea1 = document.getElementById('solution-input');
@@ -49,7 +51,7 @@ angular.module('app').controller('trainingCtrl', function($scope, $state, mainSe
4951
});
5052
}
5153

52-
$scope.getKataById(2);
54+
$scope.getKataById($scope.kataid);
5355

5456

5557

0 commit comments

Comments
 (0)