Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Card #443

Closed
wants to merge 37 commits into from
Closed

Card #443

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
3ffa495
initial commit
Aug 30, 2018
46be4d0
feat: vehicles.json data
Aug 30, 2018
194a0e3
Merge pull request #1 from bmabreu/1
shiratiee Aug 30, 2018
9758169
fix: setting up environment
Aug 31, 2018
749e561
add: boostrap CDN + css file in index.html
Aug 31, 2018
311122e
fix: set up ngRepeat on the list of vehicles
Aug 31, 2018
97659d0
Merge pull request #2 from bmabreu/4
shiratiee Aug 31, 2018
2116e81
step-3, refactored to use components
Aug 31, 2018
66a74eb
complete step 4, refactoring and setting up component infrastucture
Aug 31, 2018
b30fdff
step 5 completed, filter and search on UI
Aug 31, 2018
26b2889
finished step 5 and searh bar on UI
Aug 31, 2018
a017aa7
Merge pull request #3 from bmabreu/8
bmabreu Aug 31, 2018
269cd2f
initial commit
Aug 31, 2018
8f3328e
fix: merge conflicts
Aug 31, 2018
9c32fa1
feat: filter and orderby
Aug 31, 2018
8756534
fix: query, convert controller
Aug 31, 2018
6f72d91
add: images to vehicles json
Aug 31, 2018
9b31db1
feat: created thumbnails with image descriptions
Aug 31, 2018
5ae81ca
Merge pull request #4 from bmabreu/9
shiratiee Aug 31, 2018
e9f7c47
routing all vehicles and single vehicle
Aug 31, 2018
975cf0f
single vehicle renders
Aug 31, 2018
aacdb86
Merge pull request #5 from bmabreu/11
bmabreu Aug 31, 2018
dfcfb3f
initial commit
Aug 31, 2018
2981048
feat: navbar added to index.html
Aug 31, 2018
d5dbd20
fix: commiting root level files
Aug 31, 2018
77640c4
Merge pull request #6 from bmabreu/3
shiratiee Aug 31, 2018
d17cdd3
form component rendering, needs routing to be hooked up and validations
Sep 3, 2018
baa7f33
Merge pull request #7 from bmabreu/form
bmabreu Sep 4, 2018
07cb0bf
initial commit
Sep 4, 2018
1d2f2db
add: made cart icon route to form
Sep 4, 2018
1dd10bb
feat: added form validation using ng-messages
Sep 4, 2018
a02eaef
final commit
Sep 4, 2018
8911722
Merge pull request #8 from bmabreu/6
shiratiee Sep 4, 2018
1098d83
md-select working for user state
Sep 4, 2018
0cca869
refactoring form to Material almost complete
Sep 4, 2018
4678436
Merge pull request #9 from bmabreu/13
bmabreu Sep 4, 2018
0e54d4f
cards are rendering, needs styling
Sep 4, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions app/app.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
'use strict';

angular.module('myApp').config([
'$locationProvider',
'$routeProvider',
function config($locationProvider, $routeProvider) {
$locationProvider.hashPrefix('!');

$routeProvider
.when('/vehicles', {
template: '<vehicle-list></vehicle-list>'
})
.when('/vehicles/:vehicleId', {
template: '<vehicle-detail></vehicle-detail>'
})
.when('/cartform', {
template: '<cart-form></cart-form>'
})
.otherwise('/vehicles');
}
]);
26 changes: 2 additions & 24 deletions app/app.css
Original file line number Diff line number Diff line change
@@ -1,25 +1,3 @@
/* app css stylesheet */

.menu {
list-style: none;
border-bottom: 0.1em solid black;
margin-bottom: 2em;
padding: 0 0 0.5em;
}

.menu:before {
content: "[";
}

.menu:after {
content: "]";
}

.menu > li {
display: inline;
}

.menu > li + li:before {
content: "|";
padding-right: 0.3em;
body {
padding-top: 20px;
}
14 changes: 0 additions & 14 deletions app/app.js

This file was deleted.

12 changes: 12 additions & 0 deletions app/app.module.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"use strict";

// define the myApp module
let myApp = angular.module("myApp", [
// ...which depends on the `vehicleList` module
"ngRoute",
"ngMessages",
"vehicleDetail",
"vehicleList",
"cartForm",
"ngMaterial"
]);
24 changes: 24 additions & 0 deletions app/components/cart-form.component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"use strict";

angular.module("cartForm").component("cartForm", {
controllerAs: "vm",

templateUrl: "components/cart-form.template.html",

controller: function($scope) {
let vm = $scope;
vm.master = {};

vm.update = function(user) {
vm.master = angular.copy(user);
};

vm.reset = function() {
vm.user = angular.copy(vm.master);
};

vm.state = [{ state: "New York" }, { state: "New Jersey" }];

vm.reset();
}
});
3 changes: 3 additions & 0 deletions app/components/cart-form.module.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"use strict";

angular.module("cartForm", ["ngRoute", "ngMessages", "ngMaterial"]);
125 changes: 125 additions & 0 deletions app/components/cart-form.template.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
<div>
<form name="cartForm" class="css-form">

<!-- USERNAME FORM & VALIDATION -->
<md-input-container>
<label>
Name:
</label>
<input aria-label="name" matInput type="text" ng-model="user.name" name="uName" required />
</md-input-container>

<span ng-hide="cartForm.uName.$pristine">
<div ng-messages="cartForm.uName.$error" style="color:red" role="alert">
<div ng-message="required">Please enter your name.</div>
</div>
</span>


<!-- EMAIL FORM & VALIDATION -->
<md-input-container>
<label>
E-mail:
</label>
<input aria-label="email" type="email" ng-model="user.email" name="uEmail" required />

<span ng-hide="cartForm.uEmail.$pristine">
<div ng-messages="cartForm.uEmail.$error" style="color:red" role="alert">
<div ng-message="required">Please enter your email.</div>
</div>
</span>
</md-input-container>


<!-- ADDRESS FORM & VALIDATION -->
<md-input-container>
<label>
Address:
</label>
<input aria-label="address" type="address" ng-model="user.address" name="uAddress" required />

<span ng-hide="cartForm.uAddress.$pristine">
<div ng-messages="cartForm.uAddress.$error" style="color:red" role="alert">
<div ng-message="required">Please enter your address.</div>
</div>
</span>
</md-input-container>


<!-- ZIPCODE FORM & VALIDATION -->
<md-input-container>
<label>
Zipcode:
</label>
<input type="zipcode" ng-model="zipcode.email" name="uZipcode" required/>

<span ng-hide="cartForm.uZipcode.$pristine">
<div ng-messages="cartForm.uZipcode.$error" style="color:red" role="alert">
<div ng-message="required">Please enter your zipcode.</div>
</div>
</span>
</md-input-container>


<!-- CITY FORM & VALIDATION -->
<md-input-container>
<label>
City:
</label>
<input type="city" ng-model="city.email" name="uCity" required />

<span ng-hide="cartForm.uCity.$pristine">
<div ng-messages="cartForm.uCity.$error" style="color:red" role="alert">
<div ng-message="required">Please enter your city.</div>
</div>
</span>
</md-input-container>

<!-- STATE OPTIONS -->

<md-input-container>
<label>State:</label>
<md-select ng-model="user" placeholder="Select a state">
<md-option ng-value="user" ng-repeat="user in state">{{ user.state }}
</md-select>
</md-input-container>


<!-- GENDER FORM & VALIDATION -->
<br/>
<label aria-label="gender">
Gender:
</label>
<md-checkbox>
<label>
Male
</label>
<!-- <input type="checkbox" ng-model="user.gender" value="male" /> -->
</md-checkbox>

<md-checkbox>
<label>
Female
</label>
<!-- <input type="checkbox" ng-model="user.gender" value="female" /> -->
</md-checkbox>

<br/>


<!-- AGREE FORM & VALIDATION -->

<label> I agree:
<input type="checkbox" ng-model="user.agree" name="userAgree" required />
</label>

<input ng-show="user.agree" type="text" ng-model="user.agreeSign" required />


<!-- RESET AND SUBMIT BUTTONS -->
<input type="button" ng-click="reset(form)" value="Reset" />
<input type="submit" ng-click="update(user)" value="Submit" />

</form>

</div>
19 changes: 19 additions & 0 deletions app/components/vehicle-detail.component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use strict';

// Register `vehicleDetail` component, along with its associated controller and template
angular.
module('vehicleDetail').
component('vehicleDetail', {
controllerAs: 'vm',
templateUrl: 'components/vehicle-detail.template.html',
controller: ['$http','$routeParams',
function VehicleDetailController($http, $routeParams) {

$http.get('./vehicles.json' )
.then(res => {
this.vehicle = res.data[$routeParams.vehicleId]
console.log('CURRENT', this.vehicle)
})
}
]
});
6 changes: 6 additions & 0 deletions app/components/vehicle-detail.module.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
'use strict';

// Define the `vehicleDetail` module
angular.module('vehicleDetail', [
'ngRoute'
]);
25 changes: 25 additions & 0 deletions app/components/vehicle-detail.template.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<img ng-src="{{vm.vehicle.imageURL}}" class="vehicle" />

<h1>{{vm.vehicle.make}} {{vm.vehicle.model}}</h1>

<p>{{vm.vehicle.description}}</p>

<ul class="specs">
<h4>Details</h4>
<table class="table">
<thead>
<tr>
<th scope="col">Year</th>
<th scope="col">Color</th>
<th scope="col">Type</th>
</tr>
</thead>
<tbody>
<tr>
<td scope="row">{{vm.vehicle.year}}</td>
<td scope="row">{{vm.vehicle.color}}</td>
<td scope="row">{{vm.vehicle.type}}</td>
</tr>
</tbody>
</table>
</ul>
18 changes: 18 additions & 0 deletions app/components/vehicle-list.component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
'use strict';

angular.module('vehicleList').component('vehicleList', {
controllerAs: 'vm',

templateUrl: 'components/vehicle-list.template.html',

controller: function VehicleController($scope, $http) {
let vm = $scope;

vm.orderProp = 'year';
vm.vehicles = [];

$http.get('./vehicles.json').then(result => {
vm.vehicles = result.data;
});
}
});
4 changes: 4 additions & 0 deletions app/components/vehicle-list.module.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
'use strict';

// Define the `vehicleList` module
angular.module('vehicleList', []);
39 changes: 39 additions & 0 deletions app/components/vehicle-list.template.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<div class="container-fluid">
<mat-grid-list cols="2" rowHeight="2:1">
<!--Sidebar content-->
<p>
Search:
<input ng-model="vm.query" />
</p>

<p>
Sort by:
<select ng-model="vm.orderProp">
<option value="make">Make</option>
<option value="year">Year</option>
</select>
</p>
</div>
<md-content>
<div flex-xs flex-gt-xs="50" layout="row" >
<md-card>
<mat-grid-title ng-repeat="vehicle in vehicles | filter: vm.query | orderBy: vm.orderProp " class="thumbnail">
<a href="#!/vehicles/{{ vehicle.id }}" class="thumb">
<img ng-src="{{ vehicle.imageURL }}" class="md-card-image" alt="Washed Out">
</a>
<md-card-title>
<md-card-title-text>
<a href="#!/vehicles/{{ vehicle.id }}">{{ vehicle.make }} {{ vehicle.model }}</a>
</md-card-title-text>
</md-card-title>
<md-card-content>
<p> {{ vehicle.description }} </p>
</md-card-content>
<mat-grid-title/>
</md-card>
<div/>
<md-content/>
<div>
</div>
</mat-grid-list>
</div>
9 changes: 0 additions & 9 deletions app/components/version/interpolate-filter.js

This file was deleted.

15 changes: 0 additions & 15 deletions app/components/version/interpolate-filter_test.js

This file was deleted.

9 changes: 0 additions & 9 deletions app/components/version/version-directive.js

This file was deleted.

Loading