@@ -64,24 +64,23 @@ <h2>Settings</h2>
64
64
< p > Email:</ p >
65
65
< input type ="text " id = "email " name ="email " value ="{{ session[ "user "]["email"] }}">
66
66
< br >
67
+ < p > Temperature Unit:</ p >
68
+ < select id ="temp_unit ">
69
+ < option value ="celsius "> C</ option >
70
+ < option value ="fahrenheit "> F</ option >
71
+ </ select >
72
+ < br >
67
73
< p > News site:</ p >
68
74
< input type ="text " id = "news_site " name ="news_site " value ="{{ session[ "user "]["news_site"] }}">
69
75
< p > Please put in your password to submit the settings:</ p >
70
76
< input type ="password " id ="password " name ="password " placeholder ="Password ">
71
77
< input type ="hidden " id ="username " name ="username " value ="{{ session[ "username "] }}">
72
78
< br >
73
- < br >
74
- < select name ="country " class ="countries " id ="countryId ">
75
- < option value =""> Select Country</ option >
76
- </ select >
79
+ < input type ="text " name ="country " class ="countries " id ="countryId " value ="{{ session[ "user "]["country"] }}">
77
80
< br >
78
- < select name ="state " class ="states " id ="stateId ">
79
- < option value =""> Select State</ option >
80
- </ select >
81
+ < input type ="text " class ="states " id ="stateId " value ="{{ session[ "user "]["state"] }}">
81
82
< br >
82
- < select name ="city " class ="cities " id ="cityId ">
83
- < option value =""> Select City</ option >
84
- </ select >
83
+ < input type ="text " class ="cities " id ="cityId " value ="{{ session[ "user "]["city"] }}">
85
84
< input id ="goButton " type ="submit " onclick ="submitSettings(); ">
86
85
</ form >
87
86
< div id ="loader ">
@@ -117,13 +116,15 @@ <h2>Settings</h2>
117
116
email = document . getElementById ( "email" ) . value ;
118
117
username = document . getElementById ( "username" ) . value ;
119
118
password = document . getElementById ( "password" ) . value ;
120
- city = document . getElementById ( "cityId" ) . value ;
119
+ city = document . getElementById ( "cityId" ) . value ;
121
120
country = document . getElementById ( "countryId" ) . value ;
122
121
state = document . getElementById ( "stateId" ) . value ;
122
+ temp_unit = document . getElementById ( "temp_unit" ) . value ;
123
123
var http = new XMLHttpRequest ( ) ;
124
124
var url = "/api/settings" ;
125
125
var params = "first_name=" + first_name + "&" + "last_name=" + last_name + "&" + "email=" + email + "&" + "username=" +
126
- username + "&" + "password=" + password + "&city=" + city + "&country=" + country + "&state=" + state ;
126
+ username + "&" + "password=" + password + "&city=" + city + "&country=" + country + "&state=" + state +
127
+ "&temp_unit=" + temp_unit ;
127
128
http . open ( "POST" , url , true ) ;
128
129
//Send the proper header information along with the request
129
130
http . setRequestHeader ( "Content-type" , "application/x-www-form-urlencoded" ) ;
0 commit comments