Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
E
Ecsite
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shoei.kanno
Ecsite
Commits
aa39ea59
Commit
aa39ea59
authored
Oct 21, 2020
by
keita.onoguchi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'カート画面js' into 'master'
カート画面修正途中 See merge request
!48
parents
3d5eac0e
12e311e5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
3 deletions
+30
-3
EcsiteController.java
src/main/java/com/example/web/EcsiteController.java
+8
-0
style.css
src/main/resources/static/css/style.css
+5
-0
cart.js
src/main/resources/static/js/cart.js
+11
-0
cart.html
src/main/resources/templates/cart.html
+5
-2
list.html
src/main/resources/templates/list.html
+1
-1
No files found.
src/main/java/com/example/web/EcsiteController.java
View file @
aa39ea59
...
...
@@ -140,6 +140,9 @@ HttpSession session;
model
.
addAttribute
(
"user"
,
user
);
items
=
(
LinkedHashMap
<
String
,
Items
>)
session
.
getAttribute
(
"cart"
);
if
(
items
==
null
)
{
if
(
session
.
getAttribute
(
"cartValue"
)
==
null
)
{
model
.
addAttribute
(
"cartValue"
,
0
);
}
return
"Cart"
;
}
items
.
forEach
((
key
,
value
)
->
{
...
...
@@ -151,6 +154,11 @@ HttpSession session;
});
model
.
addAttribute
(
"totalPrice"
,
totalPrice
);
totalPrice
=
0
;
if
(
session
.
getAttribute
(
"cartValue"
)
==
null
)
{
model
.
addAttribute
(
"cartValue"
,
0
);
}
else
{
model
.
addAttribute
(
"cartValue"
,
session
.
getAttribute
(
"cartValue"
));
}
return
"Cart"
;
}
}
src/main/resources/static/css/style.css
View file @
aa39ea59
...
...
@@ -1733,6 +1733,11 @@ label {
margin-bottom
:
50px
;
}
#totalPrice
{
text-align
:
right
;
padding-right
:
115px
;
padding-top
:
20px
;
}
/* カート画面モーダル */
#buy
{
...
...
src/main/resources/static/js/cart.js
View file @
aa39ea59
...
...
@@ -8,4 +8,14 @@ $(function(){
$
(
'.js-modal'
).
fadeOut
();
return
false
;
});
});
//購入処理
$
(
'#ok-btn'
).
on
(
'click'
,
function
(){
$
.
ajax
({
type
:
'GET'
,
url
:
'/limited/buy'
})
.
done
()
return
false
;
});
\ No newline at end of file
src/main/resources/templates/cart.html
View file @
aa39ea59
...
...
@@ -69,7 +69,7 @@
</ul>
<ul
class=
"nav navbar-nav navbar-right cart-menu"
>
<li><a
class=
"search-btn"
><i
class=
"fa fa-search"
aria-hidden=
"true"
></i></a></li>
<li
class=
"active"
><a
th:href=
"@{/limited/cart}"
><span>
Cart
</span>
<span
class=
"shoping-cart"
>
0
</span></a></li>
<li
class=
"active"
><a
th:href=
"@{/limited/cart}"
><span>
Cart
</span>
<span
class=
"shoping-cart"
th:text=
"${cartValue}"
>
0
</span></a></li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
...
...
@@ -117,6 +117,10 @@
</div>
</tbody>
</table>
<div
id=
"totalPrice"
th:switch=
"${totalPrice}"
>
<p
th:case=
"null"
id=
"total-price"
>
Total Price
<span
id=
"total-price-span"
>
¥
0
</span></p>
<p
th:case=
"*"
id=
"total-price"
>
Total Price
<span
id=
"total-price-span"
th:text=
"'¥' + ${totalPrice}"
>
10000
</span></p>
</div>
<div
id=
"buy"
>
<button
class=
"js-modal-open"
id=
"buy-btn"
>
Buy
</button>
</div>
...
...
@@ -141,7 +145,6 @@
<div
class=
"modal__bg js-modal-close"
></div>
<div
class=
"modal__content"
>
<p
id=
"sign-up-text"
>
Do you really buy?
</p>
<p
id=
"total-price"
>
Total Price
<span
id=
"total-price-span"
>
¥
10000
</span></p>
<div>
<button
class=
"js-modal-sign-up"
id=
"ok-btn"
>
Buy
</button>
<button
class=
"js-modal-close"
id=
"close-btn"
>
Close
</button>
...
...
src/main/resources/templates/list.html
View file @
aa39ea59
...
...
@@ -63,7 +63,7 @@
<!-- 履歴ページへ遷移 -->
<li><a
th:href=
"@{/limited/log/{id}(id=${user.id})}"
>
My Purchase Log
</a></li>
<!-- カートページへ遷移 -->
<li><a
th:href=
"@{cart}"
>
Cart
</a></li>
<li><a
th:href=
"@{
/limited/
cart}"
>
Cart
</a></li>
<!-- ログアウト -->
<li><form
th:action=
"@{/logout}"
method=
"post"
><input
type=
"submit"
value=
"logout"
style=
"border:none;background-color:transparent;text-decoration:none;"
class=
"logoutBtn"
/></form></li>
</ul>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment