Skip to content

Commit 3debe09

Browse files
committed
html fix
1 parent fdbc856 commit 3debe09

File tree

2 files changed

+31
-19
lines changed

2 files changed

+31
-19
lines changed

index.html

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<script src="src/global.js"></script>
1717
<script src="src/checkout.js"></script>
1818
<script src="src/navBar.js"></script>
19+
<!-- custom style -->
1920
<link rel="stylesheet" href="css/global.css">
2021
<link rel="stylesheet" href="css/background.css">
2122
<link rel="stylesheet" href="css/navBar.css">
@@ -47,18 +48,24 @@
4748

4849

4950
<body>
51+
5052
<!-- START background -->
53+
5154
<div id="background"></div>
5255
<div id="particles-js">
5356
<script type="text/javascript" src="src/background.js"></script>
5457
</div>
58+
5559
<!-- END background -->
5660

61+
5762
<main id="app">
5863

5964

6065

66+
6167
<!-- START nav bar -->
68+
6269
<nav class="navigator">
6370
<img id="pageLogo" src="assets/page-logo.png">
6471
<div class="search-box filter"></div>
@@ -82,6 +89,7 @@
8289
<a href="#" id="cart-button" role="button" @click="cartButton()" value="inactive"><img class="cart-logo" src="assets/cart-logo.png"><span class="badge">{{cart.length}}</span></a>
8390
</div>
8491
</nav>
92+
8593
<!-- END nav bar -->
8694

8795

@@ -94,9 +102,7 @@
94102

95103

96104
<!-- START carousel -->
97-
98105

99-
100106
<div id="carousel-cards" class="carousel slide" data-ride="carousel" :key="carouselCards">
101107

102108
<div class="found-cards" v-if="searchOn">
@@ -142,16 +148,18 @@ <h2 class="title" v-text="card.title"></h2>
142148

143149

144150
<!-- START cart container -->
151+
145152
<div id="cart-container" v-if="cartOn">
153+
<!-- START shopping cart -->
146154
<div class="shopping-cart">
147155
<div class="shopping-cart-header">
148156
<i class="fa fa-shopping-cart cart-icon"></i><span class="badge">{{cart.length}}</span>
149157
<div class="shopping-cart-total">
150158
<span class="lighter-text">Total:</span>
151-
<span class="main-color-text">£{{getTotal()}}</span>
159+
<span class="main-color-text">£{{getTotal}}</span>
152160
</div>
153161
</div>
154-
<!--end shopping-cart-header -->
162+
<!--END shopping-cart-header -->
155163

156164

157165

@@ -176,8 +184,10 @@ <h2 class="title" v-text="card.title"></h2>
176184

177185

178186

179-
</div> <!--end shopping-cart -->
180-
<!-- START ceckout -->
187+
</div>
188+
<!--END shopping-cart -->
189+
190+
<!-- START ceckout -->
181191
<div class="checkout-container">
182192
<form name= "checkoutForm" id="checkoutForm" action="#" onsubmit="return false" method="post"> <!-- A form is used to submit data -->
183193
<div class = "wrapper in">
@@ -196,8 +206,9 @@ <h2 class="title" v-text="card.title"></h2>
196206
</div>
197207
</form>
198208
</div>
199-
<!-- END checkout -->
209+
<!-- END checkout -->
200210
</div>
211+
201212
<!--END cart container -->
202213

203214

src/vue.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,19 @@ var vueApp = new Vue({
3030
console.log("Page loaded!");
3131
},
3232

33-
computed:{},
33+
computed:{
34+
/**
35+
* Getting the cart total price
36+
* @return {number}
37+
*/
38+
getTotal(){
39+
let total = 0;
40+
for(let item of this.cart){
41+
total += this.getProductById(item.id).price * item.qty;
42+
}
43+
return total;
44+
},
45+
},
3446

3547
methods:{
3648

@@ -182,17 +194,6 @@ var vueApp = new Vue({
182194
return product? product.spaces > 0: false;
183195
},
184196

185-
/**
186-
* Getting the cart total price
187-
* @return {number}
188-
*/
189-
getTotal(){
190-
let total = 0;
191-
for(let item of this.cart){
192-
total += this.getProductById(item.id).price * item.qty;
193-
}
194-
return total;
195-
},
196197

197198
includeCarousel(num){
198199
num = !isNaN(parseInt(num))? parseInt(num): false;

0 commit comments

Comments
 (0)