-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAddJournal.html
More file actions
191 lines (168 loc) · 5.47 KB
/
Copy pathAddJournal.html
File metadata and controls
191 lines (168 loc) · 5.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<!doctype html>
<html ng-app="addJournalApp">
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.5/angular.min.js"></script>
<!-- Include jQuery Mobile stylesheets -->
<link rel="stylesheet" href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
<!-- Include the jQuery library -->
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<!-- Include the jQuery Mobile library -->
<script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js">
</script>
<script>
var happiness = 0;
var hunger = 0;
angular.module('addJournalApp', [])
.controller('AddJournalController', function() {
var c = this;
c.data = [];
if (localStorage.journals) {
c.data.journals = JSON.parse(localStorage.getItem('journals'));
} else {
c.data.journals = [];
}
c.addJournal = function() {
var journal = {};
journal.note = c.note;
journal.privatejournal = $("#private_toggle").prop("checked");
journal.happiness = $("#range_hapiness").val();
journal.hunger = $("#range_hunger").val();
journal.date = new Date();
c.data.journals.push(journal);
localStorage.setItem('journals', JSON.stringify(c.data.journals));
window.location = 'Journals.html';
}
c.back = function() {
window.location = 'Journals.html';
};
});
</script>
<style>
body {
background-color: #F1F1F1;
}
.title_div {
position: relative;
display: flex;
align-items: center;
background-color: white;
padding: 10px;
width: 400px;
margin: auto;
}
.cancel_text {
position: absolute;
left: 10px;
width: 70px;
}
.title_text {
display: flex;
margin: 0 auto;
align-self: center;
}
.note_text_area {
padding: 10px;
margin-top: 20px;
background-color: white;
border: 1px solid #E9E9E9;
width: 400px;
margin: auto;
}
.text_input_label {
margin: 10px 0px;
}
.text_input {
width: 100%;
border-style: none !important;
autogrow: none !important;
height: 240px !important;
}
.space_between {
display: flex;
justify-content: space-between;
align-items: center;
right: 50;
width: 400px;
}
.inline_div {
display: inline-block
}
.ui-flipswitch {
width: 66px !important;
border-radius: 34px !important;
}
.ui-flipswitch-active {
width: 50px !important;
background-color: #41B2AA !important;
}
.ui-flipswitch-off {
display: none !important;
}
.ui-slider-input {
display: none !important;
}
.ui-slider-track {
margin: 0 15px 0 15px !important;
}
.ui-btn-active {
background: #41B2AA !important;
}
.ui-slider-track .ui-btn.ui-slider-handle {
border-radius: 34px !important;
background: #41B2AA !important;
color: white !important;
}
.submit_area {
margin-top: 20px;
padding: 10px;
background-color: #41B2AA;
color: white;
text-align: center;
font-size: 150%;
position: fixed;
bottom: 0;
width: 400px;
overflow: hidden;
left: 50%;
transform: translateX(-50%);
}
</style>
</head>
<body>
<div ng-controller="AddJournalController as c">
<div class="title_div">
<div class="cancel_text" ng-click="c.back()"><img src = "images/remove.png" height = "15px" width = "15px"/>
</div>
<div class="title_text"><b>CREATE JOURNAL</b>
</div>
</div>
<div class="note_text_area">
<label class="text_input_label"><b>TODAY I'M FEELING...</b></label>
<textarea class="text_input" rows="5" ng-model="c.note"></textarea>
</div>
<div class="note_text_area space_between">
<div><label>Private</label></div>
<div><input type="checkbox" data-role="flipswitch" id="private_toggle" ></></div>
</div>
<div class="note_text_area">
<div>
<label>Happiness</label>
</div>
<div class="">
<input id="range_hapiness" type="range" min="0" max="10" step="1" value="5" data-highlight="true" data-show-value="true">
</div>
<div>
<label>Hunger</label>
</div>
<div class="">
<input id="range_hunger" type="range" min="0" max="10" step="1" value="5" data-highlight="true" data-show-value="true">
</div>
</div>
<div ng-click="c.addJournal()" class="submit_area">
<span>Submit</span>
</div>
</div>
</body>
</html>