Skip to content

Commit 2fa52da

Browse files
committed
Merge pull request #2 from ahliddin/master
Fixed layout && RailwayStation List output
2 parents b267891 + a9d14e2 commit 2fa52da

File tree

6 files changed

+35
-35
lines changed

6 files changed

+35
-35
lines changed
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11

22
<div class="input-append">
3-
<input style="width:358px;" class="span2" type="text" ng-model="carName" required min="1" />
3+
<input style="width:358px; margin-left: 100px;" class="span2" type="text" ng-model="carName" required min="1" />
44
<button class="btn btn-primary" ng-disabled="!carName" ng-click="addNewCar(carName)">Add Car</button>
55
</div>
66

7-
<h3>Car List</h3>
8-
<div class="alert alert-info" style="width:400px;" ng-show="cars.length == 0">
7+
<h3 style="margin-left:100px;">Car List</h3>
8+
<div class="alert alert-info" style="width:400px;margin-left:100px;" ng-show="cars.length == 0">
99
No cars found
1010
</div>
11-
<table class="table table-bordered table-striped" style="width:450px;" ng-show="cars.length > 0">
11+
<table class="table table-bordered table-striped" style="width:450px; margin-left: 100px;" ng-show="cars.length > 0">
1212
<thead>
1313
<tr>
1414
<th style="text-align: center; width: 25px;">Action</th>
@@ -17,9 +17,9 @@ <h3>Car List</h3>
1717
</thead>
1818
<tbody>
1919
<tr ng-repeat="car in cars">
20-
<td style="width:70px;text-align: center;"><button class="btn btn-mini btn-danger" ng-click="removeCar(car)">Remove</button></td>
20+
<td style="width:70px;text-align:center;"><button class="btn btn-mini btn-danger" ng-click="removeCar(car)">Remove</button></td>
2121
<td>{{car}}</td>
2222
</tr>
2323
</tbody>
2424
</table>
25-
<button class="btn btn-danger" ng-show="cars.length > 1" ng-click="removeAllCars()">Remove All Cars</button>
25+
<button style="margin-left:100px;" class="btn btn-danger" ng-show="cars.length > 1" ng-click="removeAllCars()">Remove All Cars</button>

src/main/webapp/WEB-INF/html/railwaystations/layout.html

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,18 @@ <h3>Railway Stations List</h3>
5757
<tr>
5858
<th style="text-align: center; width: 25px;">Id</th>
5959
<th style="text-align: center;">Name</th>
60-
<!--
6160
<th style="text-align: center;">Speed</th>
6261
<th style="text-align: center;">Diesel</th>
63-
-->
6462
<th style="text-align: center;">Action</th>
6563
</tr>
6664
</thead>
6765
<tbody>
6866
<tr ng-repeat="item in railwaystations | orderBy:predicate">
6967
<td style="text-align: center;">{{item.id}}</td>
7068
<td>{{item.name}}</td>
71-
72-
73-
<!-- <td>{{train.speed}}</td>
69+
<td>{{item.train.speed}}</td>
7470
<td style="text-align: center; width: 20px;"><span
75-
ng-show="train.diesel" class="icon-ok"></span></td> -->
71+
ng-show="item.train.diesel" class="icon-ok"></span></td>
7672

7773
<td style="width: 100px; text-align: center;">
7874
<button class="btn btn-mini btn-danger"

src/main/webapp/resources/css/app.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#wrapper {
44
margin: 0 auto;
5-
width: 500px;
5+
width: 650px;
66
margin-top: 50px;
77
}
88

src/main/webapp/resources/js/controllers/CarController.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@ var CarController = function($scope, $http) {
99
$http.get('cars/carlist.json').success(function(carList){
1010
$scope.cars = carList;
1111
});
12-
}
12+
};
1313

1414
$scope.addNewCar = function(newCar) {
1515
$http.post('cars/addCar/' + newCar).success(function() {
1616
$scope.fetchCarsList();
1717
});
1818
$scope.carName = '';
19-
}
19+
};
2020

2121
$scope.removeCar = function(car) {
2222
$http.delete('cars/removeCar/' + car).success(function() {
2323
$scope.fetchCarsList();
2424
});
25-
}
25+
};
2626

2727
$scope.removeAllCars = function() {
2828
$http.delete('cars/removeAllCars').success(function() {
@@ -32,4 +32,4 @@ var CarController = function($scope, $http) {
3232
};
3333

3434
$scope.fetchCarsList();
35-
}
35+
};

src/main/webapp/resources/js/controllers/RailwayStationController.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ var RailwayStationController = function($scope, $http) {
1212
$http.get('railwaystations/railwaystationlist.json').success(function(rsList){
1313
$scope.railwaystations = rsList;
1414
});
15-
}
15+
};
1616

1717
$scope.addNewRailwayStation = function(rs) {
1818

@@ -27,7 +27,7 @@ var RailwayStationController = function($scope, $http) {
2727
}).error(function() {
2828
$scope.setError('Could not add a new station');
2929
});
30-
}
30+
};
3131

3232
$scope.updateRailwayStation = function(rs) {
3333
$scope.resetError();
@@ -42,13 +42,13 @@ var RailwayStationController = function($scope, $http) {
4242
}).error(function() {
4343
$scope.setError('Could not update the train');
4444
});
45-
}
45+
};
4646

4747
$scope.editRailwayStation = function(rs) {
4848
$scope.resetError();
4949
$scope.rs = rs;
5050
$scope.editMode = true;
51-
}
51+
};
5252

5353
$scope.removeRailwayStation = function(id) {
5454
$scope.resetError();
@@ -58,7 +58,9 @@ var RailwayStationController = function($scope, $http) {
5858
}).error(function() {
5959
$scope.setError('Could not remove train');
6060
});
61-
}
61+
62+
$scope.rs = '';
63+
};
6264

6365
$scope.removeAllRailwayStations = function() {
6466
$scope.resetError();
@@ -75,19 +77,19 @@ var RailwayStationController = function($scope, $http) {
7577
$scope.resetError();
7678
$scope.rs = {};
7779
$scope.editMode = false;
78-
}
80+
};
7981

8082
$scope.resetError = function() {
8183
$scope.error = false;
8284
$scope.errorMessage = '';
83-
}
85+
};
8486

8587
$scope.setError = function(message) {
8688
$scope.error = true;
8789
$scope.errorMessage = message;
88-
}
90+
};
8991

9092
$scope.fetchRailwayStationsList();
9193

9294
$scope.predicate = 'id';
93-
}
95+
};

src/main/webapp/resources/js/controllers/TrainController.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ var TrainController = function($scope, $http) {
1212
$http.get('trains/trainslist.json').success(function(trainList){
1313
$scope.trains = trainList;
1414
});
15-
}
15+
};
1616

1717
$scope.addNewTrain = function(train) {
1818
$scope.resetError();
@@ -25,7 +25,7 @@ var TrainController = function($scope, $http) {
2525
}).error(function() {
2626
$scope.setError('Could not add a new train');
2727
});
28-
}
28+
};
2929

3030
$scope.updateTrain = function(train) {
3131
$scope.resetError();
@@ -39,13 +39,13 @@ var TrainController = function($scope, $http) {
3939
}).error(function() {
4040
$scope.setError('Could not update the train');
4141
});
42-
}
42+
};
4343

4444
$scope.editTrain = function(train) {
4545
$scope.resetError();
4646
$scope.train = train;
4747
$scope.editMode = true;
48-
}
48+
};
4949

5050
$scope.removeTrain = function(id) {
5151
$scope.resetError();
@@ -55,7 +55,9 @@ var TrainController = function($scope, $http) {
5555
}).error(function() {
5656
$scope.setError('Could not remove train');
5757
});
58-
}
58+
$scope.train.name = '';
59+
$scope.train.speed = '';
60+
};
5961

6062
$scope.removeAllTrains = function() {
6163
$scope.resetError();
@@ -72,19 +74,19 @@ var TrainController = function($scope, $http) {
7274
$scope.resetError();
7375
$scope.train = {};
7476
$scope.editMode = false;
75-
}
77+
};
7678

7779
$scope.resetError = function() {
7880
$scope.error = false;
7981
$scope.errorMessage = '';
80-
}
82+
};
8183

8284
$scope.setError = function(message) {
8385
$scope.error = true;
8486
$scope.errorMessage = message;
85-
}
87+
};
8688

8789
$scope.fetchTrainsList();
8890

8991
$scope.predicate = 'id';
90-
}
92+
};

0 commit comments

Comments
 (0)