ankpan18 commited on
Commit
44a720b
·
1 Parent(s): 6924b02

worked on making ui of polls home page after signin

Browse files
polls/static/polls/arrow-up-right-from-square-solid.svg ADDED
polls/static/polls/header.js ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ function toggle_profile_options(event){
3
+ event.stopPropagation();
4
+
5
+ if(profile_options.classList.toggle("hidden")){
6
+ document.removeEventListener("click",hide_profile_options);
7
+ }
8
+ else{
9
+ document.addEventListener("click",hide_profile_options);
10
+ }
11
+ }
12
+
13
+ function hide_profile_options(){
14
+ console.log("working")
15
+ profile_options.classList.add("hidden");
16
+ document.removeEventListener("click",hide_profile_options);
17
+ }
polls/static/polls/index.css CHANGED
@@ -1,4 +1,4 @@
1
- .questions{
2
  display: flex;
3
  flex-wrap: wrap;
4
  }
@@ -30,4 +30,209 @@
30
  right: 5px;
31
  padding: 0;
32
  margin: 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  }
 
1
+ /* .questions{
2
  display: flex;
3
  flex-wrap: wrap;
4
  }
 
30
  right: 5px;
31
  padding: 0;
32
  margin: 0;
33
+ } */
34
+
35
+
36
+ /***********************New css*****************************/
37
+
38
+
39
+ *{
40
+ padding:0px;
41
+ margin: 0px;
42
+ }
43
+
44
+
45
+
46
+
47
+ header{
48
+ background-color: #5B66C6;
49
+ color:white;
50
+ height:80px;
51
+ display: flex;
52
+ flex-direction: row;
53
+ align-items: center;
54
+ justify-content: space-between;
55
+ padding: 0 80px;
56
+ }
57
+ header>#app_name{
58
+ font-size: larger;
59
+ }
60
+
61
+ #profile{
62
+ background-color: #00000058;
63
+
64
+ height: 60px;
65
+ aspect-ratio: 1;
66
+ border-radius: 50%;
67
+ position:relative;
68
+ }
69
+ #profile:hover{
70
+ cursor: pointer;
71
+ }
72
+
73
+ #profile>#first_alpha{
74
+ position:absolute;
75
+ top:50%;
76
+ left:50%;
77
+ transform: translate(-50%,-50%);
78
+
79
+ }
80
+
81
+ #profile>#profile_options{
82
+ position: absolute;
83
+ right:0;
84
+ top: 100%;
85
+ margin-top:10px;
86
+
87
+ background-color: #ffffff;
88
+
89
+ width: 180px;
90
+
91
+ box-shadow: 0px 4px 29px 0px #0000004b;
92
+ border-radius: 10px;
93
+
94
+ overflow: hidden;
95
+ }
96
+ #profile_options.hidden{
97
+ display: none;
98
+ }
99
+
100
+ #profile_options>.option{
101
+
102
+ padding: 10px 0;
103
+ color:black;
104
+ border-bottom: #C3C3C3 solid 1px;
105
+
106
+ display: flex;
107
+ flex-direction: column;
108
+ align-items: center;
109
+ }
110
+
111
+ #profile_options>.option:last-child{
112
+ border-bottom:none; /*used to remove border of last option*/
113
+ }
114
+
115
+ #profile_options>.option:hover{
116
+ background-color: gray;
117
+ color:white;
118
+ }
119
+
120
+
121
+
122
+
123
+ /*********************sub header***************************/
124
+ #sub_header{
125
+ font-weight:100;
126
+ padding:40px 40px;
127
+ padding-bottom: 0px;
128
+ }
129
+
130
+
131
+ /*******************main container*******************************/
132
+
133
+ #main_container{
134
+ display: flex;
135
+ flex-direction: column;
136
+ align-items: center;
137
+
138
+ }
139
+
140
+ .question_container{
141
+ width:500px;
142
+
143
+ color:#ffffff;
144
+ background-color: #5B66C6;
145
+
146
+ border-radius: 7px;
147
+ box-shadow: 0px 20px 52px 0px #0000004b;
148
+ overflow: hidden;
149
+ margin-top:40px;
150
+ }
151
+
152
+ .question_header{
153
+ padding: 10px 20px;
154
+ display: flex;
155
+ flex-direction: row;
156
+ align-items: center;
157
+ justify-content: space-between;
158
+
159
+ }
160
+
161
+ .question_meta{
162
+ display: flex;
163
+ flex-direction: column;
164
+ align-items: center;
165
+ justify-content: center;
166
+ margin-right: 30px;
167
+
168
+ font-size: small;
169
+ font-weight: 100;
170
+ }
171
+
172
+ .question_header>span{
173
+ width: 60%;
174
+ }
175
+ .question_header>.right_section{
176
+ display: flex;
177
+ align-items: center;
178
+
179
+ }
180
+ .question_header>.right_section>img{
181
+ fill: white;
182
+ height: 25px;
183
+
184
+
185
+ }
186
+
187
+ .question_container>.form_container{
188
+ box-sizing: border-box;
189
+ padding: 10px 20px;
190
+ width: 100%;
191
+ border-radius: 7px;
192
+
193
+ background-color: white;
194
+
195
+
196
+ display:flex;
197
+ flex-direction: column;
198
+ align-items: center;
199
+
200
+ }
201
+ .choices{
202
+ margin-top: 30px;
203
+ width: 100%;
204
+ }
205
+
206
+ .choice{
207
+ margin: 10px 0;
208
+ padding: 10px 20px;
209
+
210
+ background-color: #5b66c670;
211
+
212
+ border-radius: 3px;
213
+ }
214
+
215
+ .choice_text{
216
+ margin-left: 20px;
217
+ }
218
+
219
+ .choice:hover{
220
+ background-color: #5B66C6;
221
+ /* color:#C3C3C3; */
222
+ cursor: pointer;
223
+ }
224
+
225
+ .vote_btn{
226
+ margin: 10px 0;
227
+ border:none;
228
+ outline: none;
229
+
230
+ background-color: #5B66C6;
231
+ color: white;
232
+ padding: 10px 30px;
233
+ border-radius: 8px;
234
+ }
235
+
236
+ .vote_btn:hover{
237
+ cursor: pointer;
238
  }
polls/static/polls/login.css CHANGED
@@ -3,9 +3,6 @@
3
  --button-radius:6px;
4
  }
5
 
6
- *{
7
- font-family: 'Poppins';
8
- }
9
  #title{
10
  margin:0;
11
  padding:0;
 
3
  --button-radius:6px;
4
  }
5
 
 
 
 
6
  #title{
7
  margin:0;
8
  padding:0;
polls/static/polls/signup.css CHANGED
@@ -3,9 +3,6 @@
3
  --button-radius:6px;
4
  }
5
 
6
- *{
7
- font-family: 'Poppins';
8
- }
9
  #title{
10
  margin:0;
11
  padding:0;
 
3
  --button-radius:6px;
4
  }
5
 
 
 
 
6
  #title{
7
  margin:0;
8
  padding:0;
polls/templates/polls/font.html ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <link href='https://fonts.googleapis.com/css?family=Poppins' rel='stylesheet'>
2
+ <style>
3
+ *{
4
+ font-family: 'Poppins';
5
+ }
6
+ </style>
polls/templates/polls/index.html CHANGED
@@ -2,12 +2,79 @@
2
  <head>
3
  {% load static %}
4
  <link type="text/css" rel="stylesheet" href="{% static 'polls/index.css' %}">
 
5
  </head>
6
  <body>
7
- <h1>Polling App</h1>
8
- {{ request.user }}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  {% if latest_questions_list %}
10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  <div class="questions" >
12
  {% for question in latest_questions_list %}
13
 
@@ -21,7 +88,7 @@
21
 
22
  {% else %}
23
  <p>No questions yet</p>
24
- {% endif %}
25
-
26
  </body>
27
  </html>
 
2
  <head>
3
  {% load static %}
4
  <link type="text/css" rel="stylesheet" href="{% static 'polls/index.css' %}">
5
+ {% include 'polls/font.html' %}
6
  </head>
7
  <body>
8
+ <header>
9
+ <span id="app_name">Polling App</span>
10
+
11
+ <div id="profile" onclick="toggle_profile_options(event)">
12
+ <span id="first_alpha">{{ request.user }}</span>
13
+
14
+ <div id="profile_options" class="hidden">
15
+ <div class="option">Create Poll</div>
16
+ <div class="option">Your Polls</div>
17
+ <div class="option">Your Votes</div>
18
+ <div class="option">Settings</div>
19
+ <div class="option">Log Out</div>
20
+ </div>
21
+
22
+ </div>
23
+ </header>
24
+
25
+ <h2 id="sub_header">Public Polls</h2>
26
+
27
  {% if latest_questions_list %}
28
 
29
+
30
+ <div id="main_container">
31
+ {% for question in latest_questions_list %}
32
+
33
+ <div class="question_container">
34
+ <div class="question_header">
35
+ <span>{{ question.question_text }}</span>
36
+ <div class="right_section">
37
+ <div class="question_meta">
38
+ <span>
39
+ <span>{{ question.total_votes }}</span>
40
+ Votes
41
+ </span>
42
+
43
+ <span>Results in
44
+ <span>1 hour</span>
45
+ </span>
46
+ </div>
47
+
48
+ <img src="{% static 'polls/arrow-up-right-from-square-solid.svg' %}">
49
+
50
+ </div>
51
+ </div>
52
+ <div class="form_container">
53
+ <div class="choices">
54
+
55
+ {% for choice in question.choice_set.all %}
56
+ <div class="choice">
57
+ <span>
58
+ <span>{{ forloop.counter|add:"64"|stringformat:"c" }}</span>
59
+ <span> -</span>
60
+ </span>
61
+ <span class="choice_text">{{ choice.choice_text }}</span>
62
+ </div>
63
+ {% endfor %}
64
+ </div>
65
+ <button class="vote_btn">Vote</button>
66
+
67
+ </div>
68
+ </div>
69
+ {% endfor %}
70
+ </div>
71
+
72
+
73
+ {% else %}
74
+ <p>No questions yet</p>
75
+ {% endif %}
76
+ <!-- {% if latest_questions_list %}
77
+
78
  <div class="questions" >
79
  {% for question in latest_questions_list %}
80
 
 
88
 
89
  {% else %}
90
  <p>No questions yet</p>
91
+ {% endif %} -->
92
+ <script src="{% static 'polls/header.js' %}"></script>
93
  </body>
94
  </html>
polls/templates/polls/login.html CHANGED
@@ -2,7 +2,7 @@
2
  <head>
3
  {% load static %}
4
  <link rel="stylesheet" type="text/css" href="{% static 'polls/login.css' %}">
5
- <link href='https://fonts.googleapis.com/css?family=Poppins' rel='stylesheet'>
6
  <title>Login page</title>
7
  </head>
8
  <body>
 
2
  <head>
3
  {% load static %}
4
  <link rel="stylesheet" type="text/css" href="{% static 'polls/login.css' %}">
5
+ {% include 'polls/font.html' %}
6
  <title>Login page</title>
7
  </head>
8
  <body>
polls/templates/polls/signup.html CHANGED
@@ -2,7 +2,7 @@
2
  <head>
3
  {% load static %}
4
  <link rel="stylesheet" type="text/css" href="{% static 'polls/signup.css' %}">
5
- <link href='https://fonts.googleapis.com/css?family=Poppins' rel='stylesheet'>
6
  <title>Signup page</title>
7
  </head>
8
  <body>
 
2
  <head>
3
  {% load static %}
4
  <link rel="stylesheet" type="text/css" href="{% static 'polls/signup.css' %}">
5
+ {% include 'polls/font.html' %}
6
  <title>Signup page</title>
7
  </head>
8
  <body>