Skip to content
This repository has been archived by the owner on May 19, 2020. It is now read-only.

Commit

Permalink
Merge pull request #70 from 18F/better-links
Browse files Browse the repository at this point in the history
Adding links to marketplace
  • Loading branch information
jcscottiii committed Aug 14, 2015
2 parents 9c135e2 + 6250d2a commit 6e86e47
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 26 deletions.
16 changes: 9 additions & 7 deletions static/app/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@

app.controller('MarketCtrl', function($scope, $cloudfoundry, $location, $routeParams, MenuData) {
loadOrg(MenuData, $routeParams, $cloudfoundry, $scope);
// Show a specific service details by going to service landing page
$scope.showService = function(service) {
$location.path($location.path() + '/' + service.metadata.guid);
};
// Get all the services associated with an org
$cloudfoundry.getOrgServices($routeParams['orgguid']).then(function(services) {
$scope.services = services;
Expand All @@ -102,10 +98,16 @@
var checkIfCreated = function(response) {
$scope.disableSubmit = false;
if (response.status == 400) {
$scope.message = {type: 'error', message: response.data.description}
$scope.message = {
type: 'error',
message: response.data.description
}
} else {
$scope.activePlan = null;
$scope.message = {type: 'success', message: "Service Created!"};
$scope.activePlan = null;
$scope.message = {
type: 'success',
message: "Service Created!"
};
}
};
// Show maker and populate with space info
Expand Down
9 changes: 6 additions & 3 deletions static/app/views/marketplace.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ <h3 class="text-center">{{activeOrg | orgNameFilter}} - Service Marketplace</h3>
<div class="input-group-addon"><span class="glyphicon glyphicon-search" aria-hidden="true"></span>
</div>

<input id="serviceSearch" type="text" class="form-control" placeholder="Search for a service" ng-model="searchService">
<input id="serviceSearch" type="text" class="form-control" placeholder="Search for a service"
ng-model="searchService">

</div>
</div>
Expand Down Expand Up @@ -39,8 +40,10 @@ <h3 class="text-center">{{activeOrg | orgNameFilter}} - Service Marketplace</h3>
</th>
</thead>
<tbody>
<tr ng-click="showService(service)" ng-repeat="service in services | orderBy:sortType:sortReverse | filter:searchService">
<td class="service-name-data">{{service.entity.label}}</td>
<tr ng-repeat="service in services | orderBy:sortType:sortReverse | filter:searchService">
<td class="service-name-data">
<a href='#/org/{{ activeOrg.guid }}/marketplace/{{ service.metadata.guid }}'>{{service.entity.label}}</a>
</td>
<td class="service-description-data">{{service.entity.description}}</td>
<td class="service-date-created-data">{{service.metadata.created_at | date:'yyyy-MM-dd'}}</td>
</tr>
Expand Down
16 changes: 0 additions & 16 deletions static/tests/Ctrl_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,6 @@ var getUserInfoGivenName = function() {
}
};

// Location path mock
var path = function(callback) {
return callback()
}

describe('HomeCtrl', function() {

var scope, cloudfoundry;
Expand Down Expand Up @@ -361,10 +356,6 @@ describe('MarketCtrl', function() {
getOrgServices: getOrgServices,
findActiveOrg: findActiveOrg
}
// Mock location service
location = {
path: path
}
spyOn(cloudfoundry, 'getOrgServices').and.callThrough();

// Load Ctrl and scope
Expand All @@ -387,13 +378,6 @@ describe('MarketCtrl', function() {
it('should return the active org', function() {
expect(scope.activeOrg.entity.name).toEqual('org1')
});

it('should go to the specific service details', function() {
spyOn(location, 'path');
scope.showService({metadata: {guid: 'serviceguid'}})
expect(location.path).toHaveBeenCalledWith('undefined/serviceguid');
});

});

describe('ServiceCtrl', function() {
Expand Down

0 comments on commit 6e86e47

Please sign in to comment.