Skip to content

Commit 647c841

Browse files
committed
selected match data passed into details
1 parent 3eb88ad commit 647c841

File tree

8 files changed

+55
-10
lines changed

8 files changed

+55
-10
lines changed

build/Look.BackOffice.nuspec

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
<file src="..\src\Our.Umbraco.Look.BackOffice\Client\package.manifest" target="Content\App_Plugins\Look\package.manifest" />
2626
<file src="..\src\Our.Umbraco.Look.BackOffice\Client\Look.css" target="Content\App_Plugins\Look\Look.css" />
2727

28+
<file src="..\src\Our.Umbraco.Look.BackOffice\Client\Controllers\DetailsController.js" target="Content\App_Plugins\Look\Controllers\DetailsController.js" />
2829
<file src="..\src\Our.Umbraco.Look.BackOffice\Client\Controllers\LocationsController.js" target="Content\App_Plugins\Look\Controllers\LocationsController.js" />
2930
<file src="..\src\Our.Umbraco.Look.BackOffice\Client\Controllers\MatchesController.js" target="Content\App_Plugins\Look\Controllers\MatchesController.js" />
3031
<file src="..\src\Our.Umbraco.Look.BackOffice\Client\Controllers\NodesController.js" target="Content\App_Plugins\Look\Controllers\NodesController.js" />
@@ -38,6 +39,7 @@
3839
<file src="..\src\Our.Umbraco.Look.BackOffice\Client\Directives\LazyLoadDirective.js" target="Content\App_Plugins\Look\Directives\LazyLoadDirective.js" />
3940

4041
<file src="..\src\Our.Umbraco.Look.BackOffice\Client\Services\ApiService.js" target="Content\App_Plugins\Look\Services\ApiService.js" />
42+
<file src="..\src\Our.Umbraco.Look.BackOffice\Client\Services\MatchService.js" target="Content\App_Plugins\Look\Services\MatchService.js" />
4143
<file src="..\src\Our.Umbraco.Look.BackOffice\Client\Services\SortService.js" target="Content\App_Plugins\Look\Services\SortService.js" />
4244
<file src="..\src\Our.Umbraco.Look.BackOffice\Client\Services\TreeService.js" target="Content\App_Plugins\Look\Services\TreeService.js" />
4345

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
(function () {
2+
'use strict';
3+
4+
angular
5+
.module('umbraco')
6+
.controller('Look.BackOffice.DetailsController', DetailsController);
7+
8+
DetailsController.$inject = ['$scope', 'Look.BackOffice.MatchService'];
9+
10+
function DetailsController($scope, matchService) {
11+
12+
$scope.viewData = {
13+
debug: matchService
14+
};
15+
16+
}
17+
18+
})();

src/Our.Umbraco.Look.BackOffice/Client/Controllers/MatchesController.js

+5-8
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
.module('umbraco')
77
.controller('Look.BackOffice.MatchesController', MatchesController);
88

9-
MatchesController.$inject = ['$scope', 'Look.BackOffice.SortService', '$q', 'dialogService'];
9+
MatchesController.$inject = ['$scope', 'Look.BackOffice.SortService', '$q', 'dialogService', 'Look.BackOffice.MatchService'];
1010

1111
// this controller will handle paging for more results
12-
function MatchesController($scope, sortService, $q, dialogService) {
12+
function MatchesController($scope, sortService, $q, dialogService, matchService) {
1313

1414
$scope.matches = []; // full collection of matches to render
1515
$scope.currentlyLoading = false;
@@ -75,10 +75,9 @@
7575
return enableNameBreaker;
7676
};
7777

78-
79-
$scope.showDetails = function (id) {
80-
console.log(id);
81-
78+
$scope.showDetails = function (match) {
79+
80+
matchService.selectedMatch = match;
8281

8382
dialogService.open({
8483
template: '/App_Plugins/Look/BackOffice/LookTree/Partials/Details.html',
@@ -87,8 +86,6 @@
8786
};
8887

8988

90-
91-
9289
$scope.reload = function () {
9390
reset();
9491
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
(function () {
2+
'use strict';
3+
4+
// service used to pass selected match from matches to the details controller
5+
angular
6+
.module('umbraco')
7+
.factory('Look.BackOffice.MatchService', MatchService);
8+
9+
MatchService.$inject = [];
10+
11+
function MatchService() {
12+
13+
var selectedMatch = null;
14+
15+
return {
16+
selectedMatch: selectedMatch
17+
};
18+
}
19+
20+
})();
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
<p>Details</p>
1+
<div ng-controller="Look.BackOffice.DetailsController">
2+
<p>Details</p>
3+
4+
<pre>{{ viewData | json}}</pre>
5+
</div>

src/Our.Umbraco.Look.BackOffice/Client/Views/Partials/Matches.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<p>{{match.name.charAt(0)}}</p>
88
</div>
99

10-
<div class="look-match" ng-class-even="'even'" ng-class-odd="'odd'" ng-click="showDetails(match.id)">
10+
<div class="look-match" ng-class-even="'even'" ng-class-odd="'odd'" ng-click="showDetails(match)">
1111

1212
<span class="look-match-score">{{match.score}}</span>
1313

src/Our.Umbraco.Look.BackOffice/Client/package.manifest

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"javascript": [
3+
"~/App_Plugins/Look/Controllers/DetailsController.js",
34
"~/App_Plugins/Look/Controllers/LocationsController.js",
45
"~/App_Plugins/Look/Controllers/MatchesController.js",
56
"~/App_Plugins/Look/Controllers/NodesController.js",
@@ -13,6 +14,7 @@
1314
"~/App_Plugins/Look/Directives/LazyLoadDirective.js",
1415

1516
"~/App_Plugins/Look/Services/ApiService.js",
17+
"~/App_Plugins/Look/Services/MatchService.js",
1618
"~/App_Plugins/Look/Services/SortService.js",
1719
"~/App_Plugins/Look/Services/TreeService.js"
1820
],

src/Our.Umbraco.Look.BackOffice/Our.Umbraco.Look.BackOffice.csproj

+2
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,11 @@
219219
<ItemGroup>
220220
<Content Include="Client\Controllers\LocationsController.js" />
221221
<Content Include="Client\Controllers\NodeTypeController.js" />
222+
<Content Include="Client\Services\MatchService.js" />
222223
<Content Include="Client\Services\SortService.js" />
223224
<Content Include="Client\Controllers\NodesController.js" />
224225
<Compile Include="Attributes\ValidateSearcherAttribute.cs" />
226+
<Content Include="Client\Controllers\DetailsController.js" />
225227
<Compile Include="Controllers\ApiController.cs" />
226228
<Compile Include="Controllers\TreeController.cs" />
227229
<Compile Include="Interfaces\ILookTreeNode.cs" />

0 commit comments

Comments
 (0)