diff --git a/campics_/content/views.py b/campics_/content/views.py index 7b094a34b23e7d4093ffa6b8bba709799586c3ac..d41bb7c16f97d0c68824173b530a1872cc38d429 100644 --- a/campics_/content/views.py +++ b/campics_/content/views.py @@ -81,25 +81,6 @@ class ViewFeed(APIView): return Response(status=200, data=dict(message='피드 조회 완료.')) -class CreateReply(APIView): - def post(self, request): - feed_id = request.data.get('feed_id') - email = request.data.get('email') - - # feed_id = 1 - # email = "ksshhses@ajou.ac.kr" - - feed = Feed.objects.filter(id=feed_id).first() - - if feed is None: - return Response(status=500, data=dict(message='삭제 실패')) - - if feed.email == email: - feed.delete() - return render(request, "jinstagram/main.html") #프로필페이지 - else: - return Response(status=500, data=dict(message='삭제 실패')) - ## 시환님꺼 class DeleteFeed(APIView): def post(self, request): @@ -116,31 +97,41 @@ class DeleteFeed(APIView): if feed.email == email: feed.delete() - return render(request, "jinstagram/main.html") #프로필페이지 + return Response(status=200, data=dict(message='삭제 성공')) else: return Response(status=500, data=dict(message='삭제 실패')) class searchUniv(APIView): def get(self, request): - # search_word = request.data.get('univ') - search_word = '대학' - univ_list = Univ.objects.filter(univ__contains=search_word).values('univ') + search_word = request.GET.get('keyword') + # search_word = '대학' + + if search_word is None: + univ_list = Univ.objects.values('univ').order_by('univ') + else: + univ_list = Univ.objects.filter(univ__contains=search_word).values('univ').order_by('univ') + + user_list = None + message = None if univ_list.count() == 0: - return Response(status=404, data=dict(message='대학이 없습니다.')) - else: - return Response(status=200, data=dict(univ=univ_list)) - # return render(request, "jinstagram/search_result.html") + message='검색한 정보가 없습니다.' + return render(request, + 'jinstagram/search.html', + context=dict(univ_list=univ_list,user_list=user_list,message=message)) class searchUser(APIView): def get(self, request): - # search_word = request.data.get('user') - search_word = 's1' + search_word = request.GET.get('keyword') + # search_word = 's1' user_list = Feed.objects.filter(user_id__contains=search_word) # .values() 뭐 필요? print(user_list) - + univ_list = None + message = None if user_list.count() == 0: - return Response(status=404, data=dict(message='유저가 없습니다.')) - else: - return Response(status=200, data=dict(user=user_list)) + message='검색한 정보가 없습니다.' + + return render(request, + 'jinstagram/search.html', + context=dict(univ_list=univ_list,user_list=user_list,message=message)) diff --git a/campics_/jinstagram/views.py b/campics_/jinstagram/views.py index 59f60df4360635e1f3ad6e53de9e98e2141d1ba6..dc4bc60ba0a7e51f1d4c247bb46d37666242ac78 100644 --- a/campics_/jinstagram/views.py +++ b/campics_/jinstagram/views.py @@ -18,6 +18,12 @@ class Main(APIView): type = request.GET.get('type', None) order_condition = request.GET.get('order', None) + + if type == None: + type = 'photozone' + + if order_condition == None: + order_condition = 'recent' if type == 'photozone': if order_condition == 'recent': @@ -55,7 +61,8 @@ class Main(APIView): return render(request, 'jinstagram/imgboard.html', context=dict(feed_list=feed_list, - user=user)) + user=user, + type=type)) class Post(APIView): def get(self, request): @@ -86,6 +93,7 @@ class Post(APIView): context=dict(id=feed.id, profile_image=profile_image, feed_user_id=feed.user_id, + feed_type=feed.type, user_email=user.email, user_id=user.user_id, image=feed.image, @@ -181,4 +189,4 @@ class Profile(APIView): 'jinstagram/profile.html', context=dict(feed_list=feed_list, feed_count=feed_count, - user=user)) + user=user)) \ No newline at end of file diff --git a/campics_/templates/jinstagram/add.html b/campics_/templates/jinstagram/add.html deleted file mode 100644 index 382dc44d7bf1ff93b355df09b13798cee8f9e2b4..0000000000000000000000000000000000000000 --- a/campics_/templates/jinstagram/add.html +++ /dev/null @@ -1,97 +0,0 @@ -<!-- static 로딩 --> -{% load static %} - -<!doctype html> -<html lang="ko"> - <head> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, initial-scale=1"> - <title>자료등록</title> - <link href="{% static '/css/bootstrap.css' %}" rel="stylesheet" > - <link rel="stylesheet" href="{% static '/bootstrap-icons-1.8.2/bootstrap-icons.css' %}"> - <script src="{% static '/jquery/jquery.min.js' %}"></script> - <script src="{% static '/js/bootstrap.min.js' %}"></script> - - </head> - <body> - <div class="container"> - <!-- Page Top Start --> - <div class="fixed-top"> - <div class="text-bg-primary py-1" > - <div class="row align-middle"> - <div class="col col-2 text-start"> - <a href="javascript:history.back()" class="btn btn-sm fs-4 fw-bold text-light "> - <i class="bi bi-arrow-bar-left fs"></i> - </a> - </div> - <div class="col col-8 text-center "> - <span class="fs-3 fw-normal align-middle" >아주대학교 자료등록</span> - </div> - <div class="col col-2 text-end" ></div> - </div> - </div> - </div> - <!-- Page Top End --> - <!-- Page Content Start --> - <div class="row mt-5 py-4"> - <div class="text-center mb-3 "> - <img src="{% static '/img/empty.png' %}" class="rounded img-fluid " alt="..."> - </div> - <form id="addFrm" > - <div class="mb-3"> - <input class="form-control" type="file" id="formFile"> - </div> - <div class="mb-3"> - <label for="inputText" class="form-label">내용을 입력해 주세요</label> - <textarea class="form-control" id="inputText" rows="5"></textarea> - </div> - <div class="row "> - <div class="col text-center my-3"> - <a href="imgboard.html" type="button" class="btn btn-success">확인</a> - <a href="javascript:history.back()" type="button" class="btn btn-secondary">취소</a> - </div> - </div> - </form> - </div> - <!-- Page Content end --> - <!-- Page bottom Start --> - <div class="fixed-bottom"> - <div class="text-bg-primary py-1" > - <div class="row align-middle"> - <div class="col col-2 text-center"> - <a href="imgboard.html" class="btn btn-sm fs-3 fw-bold text-light" alt="my univ"> - <i class="bi bi-view-list fs"></i> - </a> - </div> - <div class="col col-2 text-center"> - <a href="imgboard.html" class="btn btn-sm fs-3 fw-bold text-light" alt="all"> - <i class="bi bi-view-stacked fs"></i> - </a> - </div> - <div class="col col-2 text-center"> - <a href="ranking.html" class="btn btn-sm fs-3 fw-bold text-light " alt="ranking"> - <i class="bi bi-list-ol fs"></i> - </a> - </div> - <div class="col col-2 text-center"> - <a href="imgboard.html" class="btn btn-sm fs-3 fw-bold text-light " alt="my list"> - <i class="bi bi-tags fs"></i> - </a> - </div> - <div class="col col-2 text-center"> - <a href="add.html" class="btn btn-sm fs-3 fw-bold text-light " alt="등록"> - <i class="bi bi-plus-circle fs"></i> - </a> - </div> - <div class="col col-2 text-center"> - <a href="univserach.html" class="btn btn-sm fs-3 fw-bold text-light " alt="대학검색"> - <i class="bi bi-search fs"></i> - </a> - </div> - </div> - </div> - </div> - <!-- Page bottom End --> - </div> - </body> -</html> \ No newline at end of file diff --git a/campics_/templates/jinstagram/imgboard.html b/campics_/templates/jinstagram/imgboard.html index ff9f026df94a2abc2770133dbea0836857759dbd..c833409a9d7594444556124cf9215e8c10d9bc57 100644 --- a/campics_/templates/jinstagram/imgboard.html +++ b/campics_/templates/jinstagram/imgboard.html @@ -266,8 +266,8 @@ </button> <ul class="dropdown-menu" aria-labelledby="dropdownMenuButton1"> - <li><a class="dropdown-item" href="/?order=recent">최신순</a></li> - <li><a class="dropdown-item" href="/?order=likesCount">추천순</a></li> + <li><a class="dropdown-item" href="/?order=recent&type={{type}}">최신순</a></li> + <li><a class="dropdown-item" href="/?order=likesCount&type={{type}}">추천순</a></li> </ul> </div> </div> @@ -295,12 +295,12 @@ <div class="text-bg-primary py-1" > <div class="row align-middle"> <div class="col col-2 text-center"> - <a href="{% url 'main' %}" class="btn btn-sm fs-3 fw-bold text-light" alt="my univ"> + <a href="{% url 'main' %}?type=photozone" class="btn btn-sm fs-3 fw-bold text-light" alt="my univ"> <i class="bi bi-view-list fs"></i> </a> </div> <div class="col col-2 text-center"> - <a href="{% url 'main' %}" class="btn btn-sm fs-3 fw-bold text-light" alt="all"> + <a href="{% url 'main' %}?type=scene" class="btn btn-sm fs-3 fw-bold text-light" alt="all"> <i class="bi bi-view-stacked fs"></i> </a> </div> @@ -515,6 +515,7 @@ const user_id = $.trim($('#input_user_id').text()); const email = $.trim($('#input_email').text()); const univ = $.trim($('#input_univ').text()); + const type = '{{ type }}'; const file = files[0]; @@ -527,6 +528,7 @@ fd.append('user_id', user_id); fd.append('email', email); fd.append('univ', univ); + fd.append('type', type); if (image.length <= 0) { alert("이미지가 비어있습니다."); diff --git a/campics_/templates/jinstagram/main.html b/campics_/templates/jinstagram/main.html deleted file mode 100644 index 1ded46a727c7a7dbdf076873f8d35e3be8236645..0000000000000000000000000000000000000000 --- a/campics_/templates/jinstagram/main.html +++ /dev/null @@ -1,685 +0,0 @@ -<!doctype html> -<html lang="en"> -<head> - {% load static %} - <!-- Required meta tags --> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, initial-scale=1"> - - <!-- Bootstrap CSS --> - <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/css/bootstrap.min.css" rel="stylesheet" - integrity="sha384-KyZXEAg3QhqLMpG8r+8fhAXLRk2vvoC2f3B09zVXn8CA5QIVfZOJ3BCsw2P0p/We" crossorigin="anonymous"> - - <!-- 요기에 구글 머티리얼 아이콘 --> - <link - href="https://fonts.googleapis.com/css?family=Material+Icons|Material+Icons+Outlined|Material+Icons+Two+Tone|Material+Icons+Round|Material+Icons+Sharp" - rel="stylesheet"> - - <!-- jquery 사용하기 위해 --> - <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> - - <title>여기에 진스타그램 만들꺼임 </title> -</head> - -<style> - .main_body { - display: flex; - justify-content: center; - padding-top: 50px; - background-color: #FAFAFA; - z-index: 1; - } - - .left_body { - {#background-color: skyblue;#} margin-right: 100px; - width: 600px; - height: 2000px; - display: flex; - flex-direction: column; - } - - .right_body { - {#background-color: yellow;#} padding-top: 20px; - width: 300px; - height: 1000px; - left: 72%; - position: fixed; - } - - .feed_box { - background-color: white; - width: 580px; - margin: 10px; - min-height: auto; - padding-bottom: 10px; - } - - .feed_img { - width: 100%; - object-fit: contain; - } - - .feed_content { - padding: 0px 10px; - } - - .feed_like { - padding: 0px 10px; - } - - .feed_reply { - padding: 0px 10px; - display: flex; - flex-direction: column; - } - - - .feed_txt { - font-size: 14px; - } - - - .feed_icon { - padding: 5px 5px 0px 5px; - display: flex; - justify-content: space-between; - } - - span { - padding-right: 5px; - } - - .feed_name { - padding: 10px; - display: flex; - align-items: center; - } - - .feed_name_txt { - font-size: 14px; - padding: 0px 10px; - font-weight: bold; - } - - .profile_box { - width: 40px; - height: 40px; - border-radius: 70%; - overflow: hidden; - } - - .navi_profile_box { - width: 30px; - height: 30px; - border-radius: 70%; - overflow: hidden; - cursor: pointer; - } - - .profile_img { - width: 100%; - height: 100%; - object-fit: cover; - } - - .name_content { - display: flex; - flex-direction: column; - } - - .name_content_txt { - font-size: 12px; - padding: 0px 10px; - font-weight: bold; - color: lightgray; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - width: 190px; - } - - .big_profile_box { - width: 60px; - height: 60px; - border-radius: 70%; - overflow: hidden; - } - - .link_txt { - font-size: 14px; - font-weight: bold; - cursor: pointer; - text-decoration: none; - } - - .recommend_box { - display: flex; - justify-content: space-between; - padding: 5px; - font-size: 14px; - font-weight: bold; - align-items: center; - } - - .comment_box { - margin: 40px 0 0 5px; - font-size: 12px; - font-weight: bold; - color: lightgray; - display: flex; - flex-direction: column; - } - - - @media screen and (max-width: 1280px) { - .right_body { - display: none; - } - } - - - .modal { - width: 100%; - height: 100%; - position: absolute; - left: 0; - top: 0; - display: none; - flex-direction: column; - align-items: center; - justify-content: center; - background: rgba(0, 0, 0, 0.8); - backdrop-filter: blur(1.5px); - -webkit-backdrop-filter: blur(1.5px); - } - - .modal_window { - background: white; - backdrop-filter: blur(13.5px); - -webkit-backdrop-filter: blur(13.5px); - border-radius: 10px; - border: 1px solid rgba(255, 255, 255, 0.18); - width: 800px; - height: 600px; - position: relative; - } - - .modal_title { - display: flex; - flex-direction: row; - justify-content: space-between; - font-weight: bold; - font-size: 20px; - border-bottom: 1px solid rgba(0, 0, 0, 0.18); - } - - .modal_title_side { - margin: 5px; - flex: 0 0 40px; - text-align: center; - } - - .modal_image_upload { - outline: 2px dashed black; - outline-offset: -10px; - transition: all .15s ease-in-out; - width: 798px; - height: 548px; - text-align: center; - line-height: 548px; - } - - .modal_image_upload_content { - outline: 2px dashed black; - outline-offset: -10px; - text-align: center; - transition: all .15s ease-in-out; - width: 500px; - height: 548px; - } - - .modal_image_content { - display: flex; - flex-direction: row; - } - - .modal_content_write { - display: flex; - flex-direction: column; - border-left: 1px solid rgba(0, 0, 0, 0.18);; - } - - .feed_content_textarea { - resize: none; - width: 294px; - border: none; - } - - .navi_icons { - padding-right: 18px; - font-size: 28px; - cursor: pointer; - } - - .feed_reply_write{ - margin-top: 10px; - border-top: 1px solid silver; - display: flex; - align-items: center; - } - - .icons { - cursor: pointer; - } - - .write_reply_input:focus{ - outline: none; - box-shadow: none; - } -</style> - -<body> - -<div style="min-width: 1024px"> - <!-- 상단 내비게이션 바 --> - <nav class="navbar navbar-expand-lg navbar-light bg-white border-bottom" - style="width: 100%;height: 50px;position: fixed;z-index: 9999"> - <div class="container" style="min-width: 800px"> - <img class="go_home" style="height: 30px; object-fit: contain;cursor: pointer" - src="https://www.instagram.com/static/images/web/mobile_nav_type_logo-2x.png/1b47f9d0e595.png"> - <input class="form-control" style="width: 200px" type="search" placeholder="Search" aria-label="Search"> - <div style="display: flex; flex-direction: row; align-items: center; "> - <span class="material-icons navi_icons go_home">home</span> - <span id="add_feed" class="material-icons-outlined navi_icons">add_box</span> - <span class="material-icons-outlined navi_icons">explore</span> - <span class="material-icons-outlined navi_icons "> - favorite_border - </span> - <div class="dropdown" style="position: relative; z-index: 9999"> - <div class="navi_profile_box" id="dropdownMenuButton1" - data-bs-toggle="dropdown" aria-expanded="false"> - <img class="profile_img" - src="{% get_media_prefix %}{{ user.thumbnail }}"> - </div> - - <ul class="dropdown-menu" style="left: -130px" aria-labelledby="dropdownMenuButton1"> - <li><a class="dropdown-item" href="{% url 'profile' %}">프로필</a></li> - <li><a class="dropdown-item" href="#">저장됨</a></li> - <li> - <hr class="dropdown-divider"> - </li> - <li><a class="dropdown-item" href="{% url 'logout' %}">로그아웃</a></li> - </ul> - </div> - </div> - </div> - </nav> - - <!-- 바디 영역 --> - <div class="main_body"> - <div class="left_body"> - {% for feed in feed_list %} - <div class="border feed_box"> - <div class="feed_name"> - <div class="profile_box"> - <img class="profile_img" src="{% get_media_prefix %}{{ feed.profile_image }}"> - </div> - <span class="feed_name_txt"> {{ feed.user_id }}</span> - </div> - <img class="feed_img" src="{% get_media_prefix %}{{ feed.image }}"> - <div class="feed_icon"> - <div> - <span class="favorite_icon material-icons-outlined icons" feed_id="{{ feed.id }}" style="color: red"> - {% if feed.is_like %} - favorite - {% else %} - favorite_border - {% endif %} - </span> - <span class="material-icons-outlined"> - mode_comment - </span> - </div> - <div> - <span class="bookmark_icon material-icons-outlined" feed_id="{{ feed.id }}"> - {% if feed.is_bookmarked %} - turned_in - {% else %} - turned_in_not - {% endif %} - </span> - </div> - </div> - <div class="feed_like"> - <p class="feed_txt"><b>좋아요 <span>{{ feed.like_count }}</span>개</b></p> - </div> - <div class="feed_content"> - <p class="feed_txt"><b> {{ feed.user_id }} </b> {{ feed.content }}</p> - </div> - <div class="feed_reply"> - {% for reply in feed.reply_list %} - <span class="feed_txt"> <b> {{ reply.user_id }} </b> {{ reply.content }} </span> - {% endfor %} - </div> - <div class="feed_reply_write"> - <input type="text" class="write_reply_input floating_input form-control" style="border: none;" id="floatingName" placeholder="댓글 달기..."> - <span class="write_reply" feed_id="{{ feed.id }}" style="width: 60px; font-size: 16px; color: deepskyblue;font-weight: bold"> 게시 </span> - </div> - </div> - {% endfor %} - </div> - <div class="right_body"> - <div class="feed_name" style="justify-content: space-between"> - <div style="display: flex; align-items: center; "> - <div class="big_profile_box"> - <img class="profile_img" - src="{% get_media_prefix %}{{ user.thumbnail }}"> - </div> - <div class="name_content"> - <span class="feed_name_txt"> {{ user.user_id }} </span> - <span class="name_content_txt"> {{ user.name }}</span> - </div> - </div> - - <a class="link_txt"> - 전환 - </a> - </div> - - <div class="recommend_box"> - <span style="color: gray"> 회원님을 위한 추천</span> - <span style="font-size: 12px"> 모두 보기 </span> - </div> - <div> - <div class="feed_name" style="justify-content: space-between"> - <div class="profile_box"> - <img class="profile_img" - src="https://i.pinimg.com/736x/93/a6/8b/93a68b57a54e4bdc73d43d1d049b94b3.jpg"> - </div> - <div class="name_content"> - <span class="feed_name_txt"> dation3388 </span> - <span class="name_content_txt"> Jinstargram 신규가입</span> - </div> - <a class="link_txt"> - 팔로우 - </a> - </div> - <div class="feed_name" style="justify-content: space-between"> - <div class="profile_box"> - <img class="profile_img" - src="http://file3.instiz.net/data/cached_img/upload/2021/01/27/18/2ce2f41f7e9f09c0acc77faac7452dbf.jpg"> - </div> - <div class="name_content"> - <span class="feed_name_txt"> gaoudi </span> - <span class="name_content_txt"> IU 외 5명이 팔로우</span> - </div> - <a class="link_txt"> - 팔로우 - </a> - </div> - <div class="feed_name" style="justify-content: space-between"> - <div class="profile_box"> - <img class="profile_img" - src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTTiCVWdogd6Ocsm08kL8ph4sb1MN0AYEiSUQ&usqp=CAU"> - </div> - <div class="name_content"> - <span class="feed_name_txt"> CAU </span> - <span class="name_content_txt"> IU 외 5명이 팔로우</span> - </div> - <a class="link_txt"> - 팔로우 - </a> - </div> - <div class="feed_name" style="justify-content: space-between"> - <div class="profile_box"> - <img class="profile_img" - src="https://pbs.twimg.com/media/EhzH0_DU4AEZ9yr.jpg"> - </div> - <div class="name_content"> - <span class="feed_name_txt"> 123456789 </span> - <span class="name_content_txt"> 그냥 추천해봄 </span> - </div> - <a class="link_txt"> - 팔로우 - </a> - </div> - <div class="feed_name" style="justify-content: space-between"> - <div class="profile_box"> - <img class="profile_img" - src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQHPNYM5RQgA2F7BtpBQ-OrNFKDXVDUpypRuw&usqp=CAU"> - </div> - <div class="name_content"> - <span class="feed_name_txt"> instiz </span> - <span class="name_content_txt"> 애도 유명해 </span> - </div> - <a class="link_txt"> - 팔로우 - </a> - </div> - </div> - <div class="comment_box"> - <span> 인스타그램 클론 코딩 </span> - <span> https://cholol.tistory.com </span> - <br> - <span> @2021 Jin.99 </span> - </div> - </div> - </div> - - -</div> -<div id="modal_add_feed" class="modal modal_overlay"> - <div class="modal_window"> - <div class="modal_title"> - <div class="modal_title_side"></div> - <div> 새 게시물</div> - <div class="modal_title_side"> - <span id="close_modal" class="close_modal material-icons-outlined" style="font-size: 30px"> - close - </span> - </div> - </div> - <div class="modal_image_upload"> - <span style="text-align: center"> 사진을 여기에 끌어다 놓으세요. </span> - - </div> - </div> -</div> - -<div id="modal_add_feed_content" class="modal modal_overlay_content"> - <div class="modal_window"> - <div class="modal_title"> - <div class="modal_title_side"></div> - <div style="margin: 5px"> 새 게시물</div> - <div class="modal_title_side"> - <span id="close_modal" class="close_modal material-icons-outlined" style="font-size: 30px"> - close - </span> - </div> - </div> - <div class="modal_image_content"> - <div id="input_image" class="modal_image_upload_content"> - - </div> - <div class="modal_content_write"> - <div class="feed_name"> - <div class="profile_box"> - <img id="input_profile_image" class="profile_img" - src="{% get_media_prefix %}{{ user.thumbnail }}"> - </div> - <span id="input_user_id" class="feed_name_txt"> {{ user.user_id }} </span> - <span id="input_email" style="display: none"> {{ user.email }} </span> - </div> - <div style="height: 440px"> - <textarea id="input_content" class="feed_content_textarea form-control col-sm-5" rows="10" - placeholder="설명을 입력하세요..."></textarea> - </div> - <div style="width: 100%; text-align: center"> - <button id="button_write_feed" type="button" class="btn btn-primary" style="width: 268px"> 공유하기 - </button> - </div> - </div> - </div> - - </div> -</div> - -<!-- Optional JavaScript; choose one of the two! --> -<script> - // 모달 띄우기 코드 - const modal = document.getElementById("modal_add_feed"); - const buttonAddFeed = document.getElementById("add_feed"); - buttonAddFeed.addEventListener("click", e => { - modal.style.top = window.pageYOffset + 'px'; // top을 이용해 시작 y위치를 바꿔줌 - modal.style.display = "flex"; - document.body.style.overflowY = "hidden"; // 스크롤 없애기 - }); - - $('.close_modal').on("click", () => { - closeModal(); - }); - - $('.go_home').on("click", () => { - location.replace('/'); - }); - - function closeModal() { - $('.modal').css({ - display: 'none' - }); - $(document.body).css({ - overflowY: 'visible' - }); - }; - - $('.modal_image_upload') - .on("dragover", dragOver) - .on("dragleave", dragOver) - .on("drop", uploadFiles); - - function dragOver(e) { - e.stopPropagation(); - e.preventDefault(); - - if (e.type == "dragover") { - $(e.target).css({ - "background-color": "black", - "outline-offset": "-20px" - }); - } else { - $(e.target).css({ - "background-color": "white", - "outline-offset": "-10px" - }); - } - }; - - let files; - - function uploadFiles(e) { - e.stopPropagation(); - e.preventDefault(); - console.log(e.dataTransfer) - console.log(e.originalEvent.dataTransfer) - - e.dataTransfer = e.originalEvent.dataTransfer; - - files = e.dataTransfer.files; - if (files.length > 1) { - alert('하나만 올려라.'); - return; - } - - if (files[0].type.match(/image.*/)) { - $('#modal_add_feed_content').css({ - display: 'flex' - }); - $('.modal_image_upload_content').css({ - "background-image": "url(" + window.URL.createObjectURL(files[0]) + ")", - "outline": "none", - "background-size": "contain", - "background-repeat": "no-repeat", - "background-position": "center" - }); - $('#modal_add_feed').css({ - display: 'none' - }) - } else { - alert('이미지가 아닙니다.'); - return; - } - }; - - $('#button_write_feed').on('click', () => { - const image = $('#input_image').css("background-image").replace(/^url\(['"](.+)['"]\)/, '$1'); - const content = $('#input_content').val(); - const profile_image = $('#input_profile_image').attr('src'); - const user_id = $.trim($('#input_user_id').text()); - const email = $.trim($('#input_email').text()); - const univ = $.trim($('#input_univ').text()); - - const file = files[0]; - - let fd = new FormData(); - - fd.append('file', file); - fd.append('image', image); - fd.append('content', content); - fd.append('profile_image', profile_image); - fd.append('user_id', user_id); - fd.append('email', email); - fd.append('univ', univ); - - if (image.length <= 0) { - alert("이미지가 비어있습니다."); - } else if (content.length <= 0) { - alert("설명을 입력하세요"); - } else if (profile_image.length <= 0) { - alert("프로필 이미지가 비어있습니다."); - } else if (user_id.length <= 0) { - alert("사용자 id가 없습니다."); - } else { - writeFeed(fd); - console.log(files[0]); - } - }); - - function writeFeed(fd) { - $.ajax({ - url: "/content/upload", - data: fd, - method: "POST", - processData: false, - contentType: false, - success: function (data) { - console.log("성공"); - }, - error: function (request, status, error) { - console.log("에러"); - }, - complete: function () { - console.log("무조건실행"); - closeModal(); - location.reload(); - } - }) - }; -</script> - - -<!-- Option 1: Bootstrap Bundle with Popper --> -<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/js/bootstrap.bundle.min.js" - integrity="sha384-U1DAWAznBHeqEIlVSCgzq+c9gqGAJn5c/t99JyeKa9xxaYpSvHU5awsuZVVFIhvj" - crossorigin="anonymous"> - - -</script> - -<!-- Option 2: Separate Popper and Bootstrap JS --> -<!-- -<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.3/dist/umd/popper.min.js" integrity="sha384-eMNCOe7tC1doHpGoWe/6oMVemdAVTMs2xqW4mwXrXsW0L84Iytr2wi5v2QjrP/xp" crossorigin="anonymous"></script> -<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/js/bootstrap.min.js" integrity="sha384-cn7l7gDp0eyniUwwAZgrzD06kc/tftFf19TOAs2zVinnD/C7E91j9yyk5//jjpt/" crossorigin="anonymous"></script> ---> - -</body> -</html> \ No newline at end of file diff --git a/campics_/templates/jinstagram/post.html b/campics_/templates/jinstagram/post.html index 9f2edc4fb435ffeec9af8a51fcb302435f3a74a5..c3e113585be8c926f5b8b6054e3acbe9454115f2 100644 --- a/campics_/templates/jinstagram/post.html +++ b/campics_/templates/jinstagram/post.html @@ -22,9 +22,17 @@ <div class="text-bg-primary py-1" > <div class="row align-middle"> <div class="col col-2 text-start"> - <a href="{% url 'main' %}" class="btn btn-sm fs-4 fw-bold text-light "> - <i class="bi bi-arrow-bar-left fs"></i> - </a> + {% if not feed_type %} + <a href="{% url 'main' %}?type=photozone" class="btn btn-sm fs-4 fw-bold text-light "> + <i class="bi bi-arrow-bar-left fs"></i> + </a> + {% endif %} + + {% if feed_type %} + <a href="{% url 'main' %}?type=scene" class="btn btn-sm fs-4 fw-bold text-light "> + <i class="bi bi-arrow-bar-left fs"></i> + </a> + {% endif %} </div> <div class="col col-8 text-center "> <span class="fs-3 fw-normal align-middle" >게시글 상세보기</span> @@ -43,14 +51,25 @@ <img src="{% get_media_prefix %}{{ image }}" class="rounded img-fluid" alt="..."> </div> <div class="row text-center"> - <label class="col col-form-label"><i class="like bi bi-hand-thumbs-up fs-5"></i>{{like_count}} 조회수 : {{view_count}}</label> + {% if is_like %} + <label class="col col-form-label"><i class="like bi bi-hand-thumbs-up-fill fs-5"></i> : {{like_count}} 조회수 : {{view_count}} + 신고 : <i class="report bi bi-exclamation-circle"></i></label> + {% else %} + <label class="col col-form-label"><i class="like bi bi-hand-thumbs-up fs-5"></i> : {{like_count}} 조회수 : {{view_count}} + 신고 : <i class="report bi bi-exclamation-circle"></i></label> + + + {% endif %} + </div> + <!-- <i class="bi bi-exclamation-circle-fill"></i> --> <div class="row text-center"> <div class="col"> <textarea class="form-control" id="inputText" rows="5">{{content}}</textarea> </div> </div> + {% if user_id == feed_user_id %} <div class="row justify-content-end text-center mt-3"> <div class="col col-2"> @@ -67,12 +86,12 @@ <div class="text-bg-primary py-1" > <div class="row align-middle"> <div class="col col-2 text-center"> - <a href="{% url 'main' %}" class="btn btn-sm fs-3 fw-bold text-light" alt="my univ"> + <a href="{% url 'main' %}?type=photozone" class="btn btn-sm fs-3 fw-bold text-light" alt="my univ"> <i class="bi bi-view-list fs"></i> </a> </div> <div class="col col-2 text-center"> - <a href="{% url 'main' %}" class="btn btn-sm fs-3 fw-bold text-light" alt="all"> + <a href="{% url 'main' %}?type=scene" class="btn btn-sm fs-3 fw-bold text-light" alt="all"> <i class="bi bi-view-stacked fs"></i> </a> </div> @@ -92,7 +111,7 @@ </span> </div> <div class="col col-2 text-center"> - <a href="univserach.html" class="btn btn-sm fs-3 fw-bold text-light " alt="대학검색"> + <a href="/content/searchUniv" class="btn btn-sm fs-3 fw-bold text-light " alt="대학검색"> <i class="bi bi-search fs"></i> </a> </div> @@ -120,7 +139,7 @@ dataType: "json", success: function (data){ alert(data.message); - location.replace("{% url 'main'%}?id=" + feed_id); + location.replace("{% url 'profile'%}"); }, error:function (request, status, error){ let data = JSON.parse(request.responseText); @@ -129,15 +148,21 @@ } }); }); - + + // 추천 $('.like').click(function(){ console.log("클릭했다"); let feed_id = "{{id}}" let email = "{{ user_email }}"; - let is_like = true; - console.log(feed_id); - console.log(email); + let is_like = false; + console.log('{{is_like}}'); + if ('{{is_like}}'=='False') { + is_like = true; + console.log('{{is_like}}'); + } + console.log(is_like); + $.ajax({ url: "/content/like", data: { @@ -157,6 +182,33 @@ } }); }); + // 신고 + $('.report').click(function(){ + // console.log("클릭했다"); + // let feed_id = "{{id}}" + // let email = "{{ user_email }}"; + // console.log(feed_id); + // console.log(email); + + // $.ajax({ + // url: "/content/delete", + // data: { + // feed_id: feed_id, + // email: email, + // }, + // method: "POST", + // dataType: "json", + // success: function (data){ + // alert(data.message); + // location.replace("{% url 'profile'%}"); + // }, + // error:function (request, status, error){ + // let data = JSON.parse(request.responseText); + // console.log(data.message); + // alert(data.message); + // } + // }); + }); </script> </body> </html> \ No newline at end of file diff --git a/campics_/templates/jinstagram/profile copy.html b/campics_/templates/jinstagram/profile copy.html deleted file mode 100644 index 66cda95b04fad2c8955bd5107451b066ed4c621f..0000000000000000000000000000000000000000 --- a/campics_/templates/jinstagram/profile copy.html +++ /dev/null @@ -1,651 +0,0 @@ -<!doctype html> -<html lang="en"> -<head> - {% load static %} - <!-- Required meta tags --> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, initial-scale=1"> - - <!-- Bootstrap CSS --> - <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/css/bootstrap.min.css" rel="stylesheet" - integrity="sha384-KyZXEAg3QhqLMpG8r+8fhAXLRk2vvoC2f3B09zVXn8CA5QIVfZOJ3BCsw2P0p/We" crossorigin="anonymous"> - - <!-- 요기에 구글 머티리얼 아이콘 --> - <link - href="https://fonts.googleapis.com/css?family=Material+Icons|Material+Icons+Outlined|Material+Icons+Two+Tone|Material+Icons+Round|Material+Icons+Sharp" - rel="stylesheet"> - - <!-- jquery 사용하기 위해 --> - <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> - - <title>여기에 진스타그램 만들꺼임 </title> -</head> - -<style> - .main_body { - display: flex; - justify-content: center; - padding-top: 50px; - z-index: 1; - background-color: #FAFAFA; - } - .sub_body{ - display: flex; - justify-content: center; - flex-direction: column; - min-width: 780px; - } - - span { - padding-right: 5px; - } - - .feed_name { - padding: 10px; - display: flex; - align-items: center; - } - - .row_feed { - width: 240px; - height: 240px; - object-fit: cover; - margin: 10px; - } - - .feed_name_txt { - font-size: 14px; - padding: 0px 10px; - font-weight: bold; - } - - .profile_box { - width: 40px; - height: 40px; - border-radius: 70%; - overflow: hidden; - } - - .navi_profile_box { - width: 30px; - height: 30px; - border-radius: 70%; - overflow: hidden; - cursor: pointer; - } - - .profile_img { - width: 100%; - height: 100%; - object-fit: cover; - } - - .modal { - width: 100%; - height: 100%; - position: absolute; - left: 0; - top: 0; - display: none; - flex-direction: column; - align-items: center; - justify-content: center; - background: rgba(0, 0, 0, 0.8); - backdrop-filter: blur(1.5px); - -webkit-backdrop-filter: blur(1.5px); - } - - .modal_window { - background: white; - backdrop-filter: blur(13.5px); - -webkit-backdrop-filter: blur(13.5px); - border-radius: 10px; - border: 1px solid rgba(255, 255, 255, 0.18); - width: 800px; - height: 600px; - position: relative; - } - - .modal_title { - display: flex; - flex-direction: row; - justify-content: space-between; - font-weight: bold; - font-size: 20px; - border-bottom: 1px solid rgba(0, 0, 0, 0.18); - } - - .modal_title_side { - margin: 5px; - flex: 0 0 40px; - text-align: center; - } - - .modal_image_upload { - outline: 2px dashed black; - outline-offset: -10px; - transition: all .15s ease-in-out; - width: 798px; - height: 548px; - text-align: center; - line-height: 548px; - } - - .modal_image_upload_content { - outline: 2px dashed black; - outline-offset: -10px; - text-align: center; - transition: all .15s ease-in-out; - width: 500px; - height: 548px; - } - - .modal_image_content { - display: flex; - flex-direction: row; - } - - .modal_content_write { - display: flex; - flex-direction: column; - border-left: 1px solid rgba(0, 0, 0, 0.18);; - } - - .feed_content_textarea { - resize: none; - width: 294px; - border: none; - } - - .navi_icons { - padding-right: 18px; - font-size: 28px; - cursor: pointer; - } - - .big_profile_box { - width: 150px; - height: 150px; - border-radius: 70%; - overflow: hidden; - margin: 30px; - } - -</style> - -<body> - -<div style="min-width: 1024px"> - <!-- 상단 내비게이션 바 --> - <nav class="navbar navbar-expand-lg navbar-light bg-white border-bottom" - style="width: 100%;height: 50px;position: fixed;z-index: 9999"> - <div class="container" style="min-width: 800px"> - <img class="go_home" style="height: 30px; object-fit: contain;cursor: pointer" - src="https://www.instagram.com/static/images/web/mobile_nav_type_logo-2x.png/1b47f9d0e595.png"> - <input class="form-control" style="width: 200px" type="search" placeholder="Search" aria-label="Search"> - <div style="display: flex; flex-direction: row; align-items: center; "> - <span class="material-icons navi_icons go_home">home</span> - <span id="add_feed" class="material-icons-outlined navi_icons">add_box</span> - <span class="material-icons-outlined navi_icons">explore</span> - <span class="material-icons-outlined navi_icons "> - favorite_border - </span> - <div class="dropdown" style="position: relative; z-index: 9999"> - <div class="navi_profile_box" id="dropdownMenuButton1" - data-bs-toggle="dropdown" aria-expanded="false"> - <img class="profile_img" - src="{% get_media_prefix %}{{ user.thumbnail }}"> - </div> - - <ul class="dropdown-menu" style="left: -130px" aria-labelledby="dropdownMenuButton1"> - <li><a class="dropdown-item" href="#">프로필</a></li> - <li><a class="dropdown-item" href="#">저장됨</a></li> - <li> - <hr class="dropdown-divider"> - </li> - <li><a class="dropdown-item" href="{% url 'logout' %}">로그아웃</a></li> - </ul> - </div> - </div> - </div> - </nav> - - <!-- 바디 영역 --> - <div class="main_body"> - <div class="sub_body"> - <!-- 프로필 영역 --> - <div style="display: flex; flex-direction: row"> - <div class="big_profile_box"> - <img class="profile_img" - src="{% get_media_prefix %}{{ user.thumbnail }}"> - </div> - <div style="display: flex; flex-direction: column; margin: 40px 60px"> - <div class="mb-3" style="display: flex; flex-direction: row;"> - <div style="font-size: 24px"> {{ user.user_id }} </div> - <div> - <button id="button_write_feed" type="button" - style="margin-left: 10px;font-size: 14px;width: 120px; border: 1px solid silver; background-color: transparent" onclick="ajaxFileUpload()"> - 프로필사진 변경 - </button> - <input id="ajaxFile" type="file" onchange="ajaxFileChange()" name="profile" style="display: none"> - </div> - </div> - <div class="mb-3" style="display: flex; flex-direction: row; margin-right: 100px"> - <div style="margin-right: 30px;"> 게시물 <span style="font-weight: bold"> {{ feed_count }} </span></div> - <div style="margin-right: 30px"> 팔로워 <span style="font-weight: bold"> {{ follower_count }} </span></div> - <div style="margin-right: 30px"> 팔로우 <span style="font-weight: bold"> {{ following_count }} </span></div> - </div> - <div style="display: flex; flex-direction: row"> - <div style="font-size: 18px;font-weight: bold"> {{ user.name }} </div> - </div> - - </div> - </div> - <!-- 중앙 메뉴 --> - <div style="font-size: 14px;padding: 0 140px;border-top: 1px solid silver; display: flex;width: 100%; flex-direction: row; justify-content: space-evenly"> - <div target_id="menu_feed" class="menu_content" style="display: flex; flex-direction: row; align-items: center;padding-top: 10px; border-top: 1px solid gray;font-weight: bold"> <span class="material-icons-outlined" style="font-size: 16px"> -grid_on -</span> 게시물 </div> - <div target_id="menu_bookmark" class="menu_content" style="display: flex; flex-direction: row; align-items: center;padding-top: 10px;font-weight: lighter"> <span class="material-icons-outlined" style="font-size: 16px"> -bookmark_border -</span> 저장됨 </div> - <div target_id="menu_taged" class="menu_content" style="display: flex; flex-direction: row; align-items: center;padding-top: 10px;font-weight: lighter"> <span class="material-icons-outlined" style="font-size: 16px"> -assignment_ind -</span>태그됨 </div> - </div> - <!-- 하단 컨텐츠 --> - <div id="menu_feed" class="menu_content_box" style="display: flex; flex-direction: column"> - {% for feed in feed_list %} - <div style="display: flex; flex-direction: row"> - {% for row_feed in feed.row_feed_list %} - <div> - <img class="row_feed" src="{% get_media_prefix %}{{ row_feed.image }}" > - </div> - {% endfor %} - </div> - {% endfor %} - </div> - <div id="menu_bookmark" class="menu_content_box" style="display: none; flex-direction: column"> - {% for feed in bookmark_feed_list %} - <div style="display: flex; flex-direction: row"> - {% for row_feed in feed.row_bookmark_feed_list %} - <div> - <img class="row_feed" src="{% get_media_prefix %}{{ row_feed.image }}"> - </div> - {% endfor %} - </div> - {% endfor %} - </div> - <div id="menu_taged" class="menu_content_box" style="display: none; flex-direction: column"> - {% for feed in feed_list %} - <div style="display: flex; flex-direction: row"> - {% for row_feed in feed.row_feed_list %} - <div> - <img class="row_feed" src="{% get_media_prefix %}{{ row_feed.image }}"> - </div> - {% endfor %} - </div> - {% endfor %} - </div> - </div> - - </div> - - -</div> -<div id="modal_add_feed" class="modal modal_overlay"> - <div class="modal_window"> - <div class="modal_title"> - <div class="modal_title_side"></div> - <div> 새 게시물</div> - <div class="modal_title_side"> - <span id="close_modal" class="close_modal material-icons-outlined" style="font-size: 30px"> - close - </span> - </div> - </div> - <div class="modal_image_upload"> - <span style="text-align: center"> 사진을 여기에 끌어다 놓으세요. </span> - - </div> - </div> -</div> - -<div id="modal_add_feed_content" class="modal modal_overlay_content"> - <div class="modal_window"> - <div class="modal_title"> - <div class="modal_title_side"></div> - <div style="margin: 5px"> 새 게시물</div> - <div class="modal_title_side"> - <span id="close_modal" class="close_modal material-icons-outlined" style="font-size: 30px"> - close - </span> - </div> - </div> - <div class="modal_image_content"> - <div id="input_image" class="modal_image_upload_content"> - - </div> - <div class="modal_content_write"> - <div class="feed_name"> - <div class="profile_box"> - <img id="input_profile_image" class="profile_img" - src="{% get_media_prefix %}{{ user.thumbnail }}"> - </div> - <span id="input_user_id" class="feed_name_txt"> {{ user.user_id }} </span> - <span id="input_email" style="display: none"> {{ user.email }} </span> - </div> - <div style="height: 440px"> - <textarea id="input_content" class="feed_content_textarea form-control col-sm-5" rows="10" - placeholder="설명을 입력하세요..."></textarea> - </div> - <div style="width: 100%; text-align: center"> - <button id="button_write_feed" type="button" class="btn btn-primary" style="width: 268px"> 공유하기 - </button> - </div> - </div> - </div> - - </div> -</div> - -<!-- Optional JavaScript; choose one of the two! --> -<script> - // 모달 띄우기 코드 - const modal = document.getElementById("modal_add_feed"); - const buttonAddFeed = document.getElementById("add_feed"); - buttonAddFeed.addEventListener("click", e => { - modal.style.top = window.pageYOffset + 'px'; // top을 이용해 시작 y위치를 바꿔줌 - modal.style.display = "flex"; - document.body.style.overflowY = "hidden"; // 스크롤 없애기 - }); - - <!-- jquery 부분 --> - <!-- @@@댓글 달기 --> - $('.write_reply').click(function () { - console.log($(this).prev().val()); - console.log($(this).attr('feed_id')); - let success = false; - let content = $(this).prev().val(); - let feed_id = Number($(this).attr('feed_id')); - - $.ajax({ - url: "/content/reply/create", - data: { - email: '{{ user.email }}', - user_id: '{{ user.user_id }}', - content: content, - feed_id: feed_id - }, - method: "POST", - dataType: "json", - async: false, - success: function (data) { - alert(data.message); - success = true - }, - error: function (request, status, error) { - let data = JSON.parse(request.responseText); - console.log(data.message); - alert(data.message); - } - }); - console.log(success) - if (success == true) { - $(this).parent().prev().append('<span class="feed_txt"><b> {{ user.user_id }} </b> ' + content + ' </span>'); - } - }); - - <!-- @@@좋아요 누르기 --> - $('.favorite_icon').click(function () { - console.log($(this).prev().val()); - console.log($(this).attr('feed_id')); - let success = false; - let icon = $.trim($(this).html()); - console.log('지금현재 상태 : ' + icon); - let is_like = false; - if (icon == 'favorite_border') { - is_like = true; - } - let feed_id = Number($(this).attr('feed_id')); - - $.ajax({ - url: "/content/like", - data: { - email: '{{ user.email }}', - is_like: is_like, - feed_id: feed_id - }, - method: "POST", - dataType: "json", - async: false, - success: function (data) { - alert(data.message); - success = true - }, - error: function (request, status, error) { - let data = JSON.parse(request.responseText); - console.log(data.message); - alert(data.message); - } - }); - console.log(success) - if (success == true) { - console.log(is_like) - if (is_like) { - $(this).html('favorite'); - let like_count_object = $(this).parent().parent().next().find('p').find('span'); - let like_count = Number(like_count_object.html()); - like_count_object.html(like_count + 1); - console.log(like_count); - } else { - $(this).html('favorite_border'); - let like_count_object = $(this).parent().parent().next().find('p').find('span'); - let like_count = Number(like_count_object.html()); - like_count_object.html(like_count - 1); - console.log(like_count); - } - } - }); - - - $('.close_modal').on("click", () => { - closeModal(); - }); - - function closeModal() { - $('.modal').css({ - display: 'none' - }); - $(document.body).css({ - overflowY: 'visible' - }); - }; - - $('.modal_image_upload') - .on("dragover", dragOver) - .on("dragleave", dragOver) - .on("drop", uploadFiles); - - function dragOver(e) { - e.stopPropagation(); - e.preventDefault(); - - if (e.type == "dragover") { - $(e.target).css({ - "background-color": "black", - "outline-offset": "-20px" - }); - } else { - $(e.target).css({ - "background-color": "white", - "outline-offset": "-10px" - }); - } - }; - - let files; - - function uploadFiles(e) { - e.stopPropagation(); - e.preventDefault(); - console.log(e.dataTransfer) - console.log(e.originalEvent.dataTransfer) - - e.dataTransfer = e.originalEvent.dataTransfer; - - files = e.dataTransfer.files; - if (files.length > 1) { - alert('하나만 올려라.'); - return; - } - - if (files[0].type.match(/image.*/)) { - $('#modal_add_feed_content').css({ - display: 'flex' - }); - $('.modal_image_upload_content').css({ - "background-image": "url(" + window.URL.createObjectURL(files[0]) + ")", - "outline": "none", - "background-size": "contain", - "background-repeat": "no-repeat", - "background-position": "center" - }); - $('#modal_add_feed').css({ - display: 'none' - }) - } else { - alert('이미지가 아닙니다.'); - return; - } - }; - - $('#button_write_feed').on('click', () => { - const image = $('#input_image').css("background-image").replace(/^url\(['"](.+)['"]\)/, '$1'); - const content = $('#input_content').val(); - const profile_image = $('#input_profile_image').attr('src'); - const user_id = $('#input_user_id').text(); - const email = $('#input_email').text(); - - const file = files[0]; - - let fd = new FormData(); - - fd.append('file', file); - fd.append('image', image); - fd.append('content', content); - fd.append('profile_image', profile_image); - fd.append('user_id', user_id); - fd.append('email', email); - - if (image.length <= 0) { - alert("이미지가 비어있습니다."); - } else if (content.length <= 0) { - alert("설명을 입력하세요"); - } else if (profile_image.length <= 0) { - alert("프로필 이미지가 비어있습니다."); - } else if (user_id.length <= 0) { - alert("사용자 id가 없습니다."); - } else { - writeFeed(fd); - console.log(files[0]); - } - }); - - function writeFeed(fd) { - $.ajax({ - url: "/content/upload", - data: fd, - method: "POST", - processData: false, - contentType: false, - success: function (data) { - console.log("성공"); - }, - error: function (request, status, error) { - console.log("에러"); - }, - complete: function () { - console.log("무조건실행"); - closeModal(); - location.reload(); - } - }) - }; - - $('.menu_content').click(function (event){ - $('.menu_content').css({ - 'border-top': 'none', - 'font-weight' : 'lighter' - }); - $(this).css({ - 'border-top' : '1px solid gray', - 'font-weight' : 'bold' - }); - - $('.menu_content_box').css({ - display : 'none' - }); - - let target_id = $(this).attr('target_id') - - $('#'+target_id).css({ - display : 'flex' - }); - }); - - $('.go_home').on("click", () => { - location.replace('/'); - }); - - function ajaxFileUpload() { - // 업로드 버튼이 클릭되면 파일 찾기 창을 띄운다. - $("#ajaxFile").click(); - } - - function ajaxFileChange() { - // 파일이 선택되면 업로드를 진행한다. - ajaxFileTransmit(); - } - - function ajaxFileTransmit() { - var formData = new FormData(); - formData.append("file", $("#ajaxFile")[0].files[0]); - - $.ajax({ - url : "{% url 'profile_update' %}" - , type : "POST" - , processData : false - , contentType : false - , data : formData - , dataType: "json" - , success:function(obj) { - let uuid = obj.uuid; - console.log(uuid); - $('.profile_img').attr('src','{% get_media_prefix %}' + uuid); - console.log($('.profile_img').attr('src')); - - } - }); - } - - -</script> - - -<!-- Option 1: Bootstrap Bundle with Popper --> -<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/js/bootstrap.bundle.min.js" - integrity="sha384-U1DAWAznBHeqEIlVSCgzq+c9gqGAJn5c/t99JyeKa9xxaYpSvHU5awsuZVVFIhvj" - crossorigin="anonymous"> - - -</script> - -<!-- Option 2: Separate Popper and Bootstrap JS --> -<!-- -<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.3/dist/umd/popper.min.js" integrity="sha384-eMNCOe7tC1doHpGoWe/6oMVemdAVTMs2xqW4mwXrXsW0L84Iytr2wi5v2QjrP/xp" crossorigin="anonymous"></script> -<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/js/bootstrap.min.js" integrity="sha384-cn7l7gDp0eyniUwwAZgrzD06kc/tftFf19TOAs2zVinnD/C7E91j9yyk5//jjpt/" crossorigin="anonymous"></script> ---> - -</body> -</html> \ No newline at end of file diff --git a/campics_/templates/jinstagram/profile.html b/campics_/templates/jinstagram/profile.html index dd8373a627d48bbe0b89929c6cf8cd36be1efc11..96bf254abec00d86bc88c339fbf9f2673474ede0 100644 --- a/campics_/templates/jinstagram/profile.html +++ b/campics_/templates/jinstagram/profile.html @@ -61,12 +61,12 @@ <div class="text-bg-primary py-1" > <div class="row align-middle"> <div class="col col-2 text-center"> - <a href="{% url 'main' %}" class="btn btn-sm fs-3 fw-bold text-light" alt="my univ"> + <a href="{% url 'main' %}?type=photozone" class="btn btn-sm fs-3 fw-bold text-light" alt="my univ"> <i class="bi bi-view-list fs"></i> </a> </div> <div class="col col-2 text-center"> - <a href="{% url 'main' %}" class="btn btn-sm fs-3 fw-bold text-light" alt="all"> + <a href="{% url 'main' %}?type=scene" class="btn btn-sm fs-3 fw-bold text-light" alt="all"> <i class="bi bi-view-stacked fs"></i> </a> </div> @@ -101,7 +101,6 @@ $('.row_feed').click(function(){ console.log("클릭했다"); let feed_id = $(this).attr('id'); - // let feed_id = 1; let email = "{{ user.email }}"; let is_view = true; console.log(feed_id); diff --git a/campics_/templates/jinstagram/ranking.html b/campics_/templates/jinstagram/ranking.html index 7bc91bf63de3e59f172efa77abbf69467f4fc82b..399bb3870f344fb2b1d93cf35b8586339750e683 100644 --- a/campics_/templates/jinstagram/ranking.html +++ b/campics_/templates/jinstagram/ranking.html @@ -63,12 +63,12 @@ <div class="text-bg-primary py-1" > <div class="row align-middle"> <div class="col col-2 text-center"> - <a href="{% url 'main' %}" class="btn btn-sm fs-3 fw-bold text-light" alt="my univ"> + <a href="{% url 'main' %}?type=photozone" class="btn btn-sm fs-3 fw-bold text-light" alt="my univ"> <i class="bi bi-view-list fs"></i> </a> </div> <div class="col col-2 text-center"> - <a href="{% url 'main' %}" class="btn btn-sm fs-3 fw-bold text-light" alt="all"> + <a href="{% url 'main' %}?type=scene" class="btn btn-sm fs-3 fw-bold text-light" alt="all"> <i class="bi bi-view-stacked fs"></i> </a> </div> diff --git a/campics_/templates/jinstagram/search_result.html b/campics_/templates/jinstagram/search.html similarity index 50% rename from campics_/templates/jinstagram/search_result.html rename to campics_/templates/jinstagram/search.html index 694f0d5393f02c51f6868b60deff8bdc065e27db..a4d0660ff089a88ec6633fcb7a286f75cc984cf7 100644 --- a/campics_/templates/jinstagram/search_result.html +++ b/campics_/templates/jinstagram/search.html @@ -43,32 +43,56 @@ <br> <div class="mt-5"> <div class="row" > - <form class="d-flex" role="search"> - <input class="form-control me-2" type="search" placeholder="Search" aria-label="Search"> - <button class="btn btn-outline-success" type="submit">Search</button> + <form class="d-flex" role="search" name="frm"> + <div class="col-3"> + <select class="form-select" id="condition" name="condition" onclick="listEmpty()"> + <option value="1" selected>학교검색</option> + <option value="2">작성자검색</option> + </select> + </div> + <div class="col-7"> + <input class="form-control me-2" type="search" id="keyword" name="keyword" placeholder="Search" aria-label="Search"> + </div> + <div class="col-2"> + <button class="btn btn-outline-success" type="button" onclick="frmSubmit()">Search</button> + </div> </form> - <ul class="list-group mt-4"> - <li class="list-group-item " aria-current="true">고려대학교</li> - <li class="list-group-item">경희대학교</li> - <li class="list-group-item">서울대학교</li> - <li class="list-group-item active">아주대학교</li> - <li class="list-group-item">연세대학교</li> + + <ul class="list-group mt-5" id = "univlist"> + {% for univ in univ_list %} + <li class="list-group-item list-group-item-action" onclick="moveUnivBoard()">{{univ.univ}}</li> + {% endfor %} </ul> + + <div class="mt-5" id="writerlist"> + <div class="row " style="display: flex; flex-direction: row"> + {% for feed in user_list %} + <div class="col col-4 g-1 mt-2 "> + <img class="row_feed img-fluid img-thumbnail" id="{{ feed.id}}" src="{% get_media_prefix %}{{ feed.image }}" > + </div> + {% endfor %} + </div> + </div> + {% if message == '검색한 정보가 없습니다.' %} + <div class="alert alert-danger col-11 align-self-center" role="alert"> + {{message}} + </div> + {% endif %} </div> </div> - + <!-- Page Content end --> <!-- Page bottom Start --> <div class="fixed-bottom"> <div class="text-bg-primary py-1" > <div class="row align-middle"> <div class="col col-2 text-center"> - <a href="{% url 'main' %}" class="btn btn-sm fs-3 fw-bold text-light" alt="my univ"> + <a href="{% url 'main' %}?type=photozone" class="btn btn-sm fs-3 fw-bold text-light" alt="my univ"> <i class="bi bi-view-list fs"></i> </a> </div> <div class="col col-2 text-center"> - <a href="{% url 'main' %}" class="btn btn-sm fs-3 fw-bold text-light" alt="all"> + <a href="{% url 'main' %}?type=scene" class="btn btn-sm fs-3 fw-bold text-light" alt="all"> <i class="bi bi-view-stacked fs"></i> </a> </div> @@ -97,5 +121,53 @@ </div> <!-- Page bottom End --> </div> + <script> + function moveUnivBoard(){ + location.href = "/?type=photozone"; + } + function frmSubmit(){ + if ( $("#condition").val() == 1) frm.action = "/content/searchUniv"; + if ( $("#condition").val() == 2) frm.action = "/content/searchUser"; + frm.submit(); + } + function listEmpty(){ + if ( $("#condition").val() == 1) { + $("#univlist").show(); + $("#writerlist").hide(); + }else if ( $("#condition").val() == 2) { + $("#univlist").hide(); + $("#writerlist").show(); + } + } + + // 조회수 + $('.row_feed').click(function(){ + console.log("클릭했다"); + let feed_id = $(this).attr('id'); + // let feed_id = 1; + let email = "{{ user.email }}"; + let is_view = true; + $.ajax({ + url: "/content/view", + data: { + feed_id: feed_id, + email: email, + is_view: is_view + }, + method: "POST", + dataType: "json", + success: function (data){ + location.replace("{% url 'post'%}?id=" + feed_id); + }, + error:function (request, status, error){ + let data = JSON.parse(request.responseText); + console.log(data.message); + alert(data.message); + } + }); + }); + </script> + + </body> </html> \ No newline at end of file diff --git a/campics_/templates/user/join copy.html b/campics_/templates/user/join copy.html deleted file mode 100644 index 2a1b5ac834d80025729b9b2c5c59a2b72e4fd07a..0000000000000000000000000000000000000000 --- a/campics_/templates/user/join copy.html +++ /dev/null @@ -1,121 +0,0 @@ -<!doctype html> -<html lang="en"> -<head> - <!-- Required meta tags --> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, initial-scale=1"> - - <!-- Bootstrap CSS --> - <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css" rel="stylesheet" - integrity="sha384-F3w7mX95PdgyTmZZMECAngseQB83DfGTowi0iMjiWaeVhAn4FJkqJByhZMI3AhiU" crossorigin="anonymous"> - - <!-- jquery 사용하기 위해 --> - <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> - - - <title>Jinstagram login</title> -</head> -<style> - .floating_form { - margin: 0px 30px; - } - - .floating_label { - margin-top: -4px; - font-size: 14px; - } - - .floating_input { - height: 50px !important; - padding-top: 20px !important; - font-size: 14px !important; - } - -</style> -<body style="background-color: #FAFAFA;height: 100%"> -<div style="font-size: 14px;text-align: center;width: 100%;min-height: 100vh;display: flex; flex-direction: row; align-items: center; justify-content: center"> - <div> - <div class="mb-3" style="background-color: white; width: 350px; height: 480px; border: 1px solid rgba(0, 0, 0, 0.18);"> - <div style="display: flex;align-items: center;justify-content: center"> - <img style="height: 50px; object-fit: contain; margin: 30px 0" - src="https://www.instagram.com/static/images/web/mobile_nav_type_logo-2x.png/1b47f9d0e595.png"> - </div> - <div style="font-size:17px; font-weight:600; line-height: 20px; text-align: center; color: rgba(142,142,142,1); margin: 0 40px 20px"> - 친구들의 사진과 동영상을 보려면 가입하세요. - </div> - <div class="form-floating mb-2 floating_form"> - <input type="email" class="floating_input form-control" id="floatingEmail" - placeholder="name@example.com"> - <label for="floatingEmail" class="floating_label">이메일 주소</label> - </div> - <div class="form-floating mb-2 floating_form"> - <input type="text" class="floating_input form-control" id="floatingName" placeholder="홍길동"> - <label for="floatingName" class="floating_label">성명</label> - </div> - <div class="form-floating mb-2 floating_form"> - <input type="text" class="floating_input form-control" id="floatingUserId" placeholder="hong"> - <label for="floatingUserId" class="floating_label">사용자 이름</label> - </div> - <div class="form-floating mb-3 floating_form"> - <input type="password" class="floating_input form-control" id="floatingPassword" placeholder="Password"> - <label for="floatingPassword" class="floating_label">비밀번호</label> - </div> - <div class="floating_form mb-3"> - <button id="button_join" type="button" class="btn btn-primary" style="width: 100%"> 가입 </button> - </div> - </div> - <div style="background-color: white; width: 350px; height: 70px; border: 1px solid rgba(0, 0, 0, 0.18);"> - <div style="margin-top: 25px"> - 계정이 있으신가요? <a href="{% url 'login' %}" style="font-weight: bold; color: cornflowerblue;text-decoration: none; cursor: pointer">가입하기</a> - </div> - </div> - </div> -</div> - - -<!-- Optional JavaScript; choose one of the two! --> -<script> - $('#button_join').on('click',()=>{ - console.log('클릭했다.'); - let email = $('#floatingEmail').val(); - let name = $('#floatingName').val(); - let user_id = $('#floatingUserId').val(); - let password = $('#floatingPassword').val(); - console.log('이멜 :' + email + ', 이름 :' + name + ', 사용자이름 :' + user_id + ', 비밀번호 :' + password); - - $.ajax({ - url: "/user/join", - data: { - email: email, - password: password, - user_id: user_id, - name: name - }, - method: "POST", - dataType: "json", - success: function (data){ - alert(data.message); - location.replace('{% url 'login' %}'); - }, - error:function (request, status, error){ - let data = JSON.parse(request.responseText); - console.log(data.message); - alert(data.message); - } - }); - - }); -</script> - -<!-- Option 1: Bootstrap Bundle with Popper --> -<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/js/bootstrap.bundle.min.js" - integrity="sha384-/bQdsTh/da6pkI1MST/rWKFNjaCP5gBSY4sEBT38Q/9RBh9AH40zEOg7Hlq2THRZ" - crossorigin="anonymous"></script> - -<!-- Option 2: Separate Popper and Bootstrap JS --> -<!-- -<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.3/dist/umd/popper.min.js" integrity="sha384-W8fXfP3gkOKtndU4JGtKDvXbO53Wy8SZCQHczT5FMiiqmQfUpWbYdTil/SxwZgAN" crossorigin="anonymous"></script> -<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/js/bootstrap.min.js" integrity="sha384-skAcpIdS7UcVUC05LJ9Dxay8AXcDYfBJqt1CJ85S/CFujBsIzCIv+l9liuYLaMQ/" crossorigin="anonymous"></script> ---> -</body> -</html> \ No newline at end of file diff --git a/campics_/templates/user/login copy.html b/campics_/templates/user/login copy.html deleted file mode 100644 index 50355e41ff06d4f5c11c04ef27e73b6c177bb26b..0000000000000000000000000000000000000000 --- a/campics_/templates/user/login copy.html +++ /dev/null @@ -1,110 +0,0 @@ -<!doctype html> -<html lang="en"> -<head> - <!-- Required meta tags --> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, initial-scale=1"> - - <!-- Bootstrap CSS --> - <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css" rel="stylesheet" - integrity="sha384-F3w7mX95PdgyTmZZMECAngseQB83DfGTowi0iMjiWaeVhAn4FJkqJByhZMI3AhiU" crossorigin="anonymous"> - - <!-- jquery 사용하기 위해 --> - <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> - - <title>Jinstagram login</title> -</head> -<style> - .floating_form { - margin: 0px 30px; - } - - .floating_label { - margin-top: -4px; - font-size: 14px; - } - - .floating_input { - height: 50px !important; - padding-top: 20px !important; - font-size: 14px !important; - } - -</style> -<body style="background-color: #FAFAFA;height: 100%"> -<div style="font-size: 14px;text-align: center;width: 100%;min-height: 100vh;display: flex; flex-direction: row; align-items: center; justify-content: center"> - <div> - <div class="mb-3" style="background-color: white; width: 350px; height: 380px; border: 1px solid rgba(0, 0, 0, 0.18);"> - <div style="display: flex;align-items: center;justify-content: center"> - <img style="height: 50px; object-fit: contain; margin: 30px 0" - src="https://www.instagram.com/static/images/web/mobile_nav_type_logo-2x.png/1b47f9d0e595.png"> - </div> - <div class="form-floating mb-2 floating_form"> - <input type="email" class="floating_input form-control" id="floatingEmail" - placeholder="name@example.com"> - <label for="floatingEmail" class="floating_label">이메일 주소</label> - </div> - <div class="form-floating mb-3 floating_form"> - <input type="password" class="floating_input form-control" id="floatingPassword" placeholder="Password"> - <label for="floatingPassword" class="floating_label">비밀번호</label> - </div> - <div class="floating_form mb-3"> - <button id="button_login" type="button" class="btn btn-primary" style="width: 100%"> 로그인</button> - </div> - <div class="mb-2" style="display: flex; align-items: center; justify-content: space-between"> - <hr style="border:1px silver;margin-left: 30px;width: 100px"> - 또는 - <hr style="border:1px silver;margin-right: 30px;width: 100px"> - </div> - <div style="font-weight: bold; color: royalblue"> - 테스트로 로그인 (둘러보기) - </div> - </div> - <div style="background-color: white; width: 350px; height: 70px; border: 1px solid rgba(0, 0, 0, 0.18);"> - <div style="margin-top: 25px"> - 계정이 없으신가요? <a href="{% url 'join' %}" style="font-weight: bold; color: cornflowerblue; text-decoration: none; cursor: pointer">가입하기</a> - </div> - </div> - </div> - - -</div> - - -<!-- Optional JavaScript; choose one of the two! --> -<script> - $('#button_login').on('click', ()=>{ - let email = $('#floatingEmail').val(); - let password = $('#floatingPassword').val(); - - $.ajax({ - url: "/user/login", - data: { - email: email, - password: password - }, - method: "POST", - dataType: "json", - success: function (data){ - location.replace('{% url 'main' %}'); - }, - error:function (request, status, error){ - let data = JSON.parse(request.responseText); - console.log(data.message); - alert(data.message); - } - }); - }); -</script> -<!-- Option 1: Bootstrap Bundle with Popper --> -<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/js/bootstrap.bundle.min.js" - integrity="sha384-/bQdsTh/da6pkI1MST/rWKFNjaCP5gBSY4sEBT38Q/9RBh9AH40zEOg7Hlq2THRZ" - crossorigin="anonymous"></script> - -<!-- Option 2: Separate Popper and Bootstrap JS --> -<!-- -<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.3/dist/umd/popper.min.js" integrity="sha384-W8fXfP3gkOKtndU4JGtKDvXbO53Wy8SZCQHczT5FMiiqmQfUpWbYdTil/SxwZgAN" crossorigin="anonymous"></script> -<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/js/bootstrap.min.js" integrity="sha384-skAcpIdS7UcVUC05LJ9Dxay8AXcDYfBJqt1CJ85S/CFujBsIzCIv+l9liuYLaMQ/" crossorigin="anonymous"></script> ---> -</body> -</html> \ No newline at end of file diff --git a/campics_/templates/user/login.html b/campics_/templates/user/login.html index d90b3325f773bb98df4b67093afdf97f1c35deec..fd1f7f06c4f5b1879cc1e2090cba65016bad24aa 100644 --- a/campics_/templates/user/login.html +++ b/campics_/templates/user/login.html @@ -62,7 +62,7 @@ method: "POST", dataType: "json", success: function (data){ - location.replace("{% url 'main' %}"); + location.replace("{% url 'main' %}?type=photozone"); }, error:function (request, status, error){ let data = JSON.parse(request.responseText);