Skip to content

Commit 4e3393f

Browse files
committed
add remove button for selected entities
1 parent 81d4849 commit 4e3393f

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

app/scripts/controllers/crunchinator.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,20 @@ angular.module('crunchinatorApp.controllers')
4545
}
4646
};
4747

48+
$scope.removeInvestor = function(investor) {
49+
$scope.selectedInvestors.splice($scope.selectedInvestors.indexOf(investor), 1);
50+
inv_ids = _.pluck($scope.selectedInvestors, 'id');
51+
$scope.filteredCompanies();
52+
$scope.clearLookingFor();
53+
};
54+
55+
$scope.removeCompany = function(company) {
56+
$scope.selectedCompanies.splice($scope.selectedCompanies.indexOf(company), 1);
57+
company_ids = _.pluck($scope.selectedCompanies, 'id');
58+
$scope.filteredInvestors();
59+
$scope.clearLookingFor();
60+
};
61+
4862
$scope.geoJsonData = _.memoize(function(filteredCompanies) {
4963
var geojson = {
5064
'type': 'FeatureCollection',

app/styles/main.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,7 @@ body {
7070
#investors .dataset, #companies .dataset {
7171
height: 251px;
7272
}
73+
74+
.remove-selected {
75+
text-align: right;
76+
}

app/views/main.tpl.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ <h3 class="pull-left">Investors</h3>
7979
<tbody>
8080
<tr ng-repeat="investor in selectedInvestors">
8181
<td>{{investor.name}}</td>
82+
<td class="remove-selected">
83+
<span class="glyphicon glyphicon-remove-circle" ng-click="removeInvestor(investor)"></span>
84+
</td>
8285
</tr>
8386
</tbody>
8487
</table>
@@ -102,6 +105,9 @@ <h3 class="pull-left">Companies</h3>
102105
<tbody>
103106
<tr ng-repeat="company in selectedCompanies">
104107
<td>{{company.name}}</td>
108+
<td class="remove-selected">
109+
<span class="glyphicon glyphicon-remove-circle remove-selected" ng-click="removeCompany(company)"></span>
110+
</td>
105111
</tr>
106112
</tbody>
107113
</table>

0 commit comments

Comments
 (0)