Skip to content

Commit 544d5ca

Browse files
committed
Updated modal to show snippit object details
1 parent 3f28fa9 commit 544d5ca

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

app/scripts/controllers/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ angular.module('codeSearchApp')
5252
});
5353
};
5454

55-
$scope.open = function(size, snippitData) {
55+
$scope.open = function(size, snippitObj) {
5656

5757
var modalInstance = $modal.open({
5858
templateUrl: '/partials/codesnippetmodal',
@@ -61,7 +61,7 @@ angular.module('codeSearchApp')
6161
resolve: {
6262
data: function() {
6363
return {
64-
snippitData: snippitData
64+
snippitObj: snippitObj
6565
}
6666
}
6767
}

app/scripts/controllers/modal.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ angular.module('codeSearchApp')
77
$modalInstance.dismiss('cancel');
88
};
99

10-
$scope.snippitData = data.snippitData;
10+
$scope.snippitObj = data.snippitObj;
11+
12+
$scope.snippit = data.snippitObj.snippit;
1113

1214
});
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<div>
2-
<pre>{{snippitData}}</pre>
2+
<p>{{snippitObj.repoUrl}}</p>
3+
<pre>{{snippitObj.docContent}}</pre>
34
</div>
45
<a style="color: black;" ng-click="ok()">&times;</a>

app/views/partials/main.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ <h3>Results:</h3>
8888
{{page.currPage + 1}} / {{ getNumPages() }}
8989
</div>
9090
<br>
91-
<div class="snippit" ng-repeat="snippit in codeSnippits |
91+
<div class="snippit" ng-repeat="snippitObj in codeSnippits |
9292
startPageFrom : page.currPage*page.resultsPerPage |
9393
limitTo : page.resultsPerPage track by $index">
94-
<pre ng-click="open('lg', snippit)">{{snippit}}</pre>
94+
<pre ng-click="open('lg', snippitObj)">{{snippitObj.snippit}}</pre>
9595
</div>
9696
<div>
9797
<button ng-disabled="page.currPage === 0"

0 commit comments

Comments
 (0)