Skip to content

Commit 4647ea4

Browse files
committed
Added labels, sessions persist
1 parent 379c578 commit 4647ea4

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

client/src/components/add-student/AddStudent.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,16 @@ export default class AddStudent extends Component {
140140
<hr />
141141
<div className="row py-3">
142142
<div className="col">
143-
<input type="text" ref={this.firstNameEl} className="form-control form-control-sm" placeholder="First name" required />
143+
<label htmlFor="FirstName">First Name</label>
144+
<input type="text" ref={this.firstNameEl} id="FirstName" className="form-control form-control-sm" placeholder="First name" required />
144145
</div>
145146
<div className="col">
146-
<input type="text" ref={this.middleNameEl} className="form-control form-control-sm" placeholder="Middle name" />
147+
<label htmlFor="MiddleName">Middle Name</label>
148+
<input type="text" ref={this.middleNameEl} id="MiddleName" className="form-control form-control-sm" placeholder="Middle name" />
147149
</div>
148150
<div className="col">
149-
<input type="text" ref={this.lastNameEl} className="form-control form-control-sm" placeholder="Last name" required />
151+
<label htmlFor="LastName">Last Name</label>
152+
<input type="text" ref={this.lastNameEl} id='LastName' className="form-control form-control-sm" placeholder="Last name" required />
150153
</div>
151154
</div>
152155
<div className="row">
@@ -166,9 +169,7 @@ export default class AddStudent extends Component {
166169
</div>
167170
</div>
168171
</div>
169-
170172
</div>
171-
172173
<hr />
173174
<div className="row">
174175
<div className="form-group col">
@@ -206,18 +207,18 @@ export default class AddStudent extends Component {
206207
<label htmlFor="InputSchool">School</label>
207208
<input type="text" ref={this.schoolEl} className="form-control form-control-sm" id="InputSchool" placeholder="School" required />
208209
<hr/>
209-
<div>
210-
<h5>Last Year Marks / Grades</h5>
211-
</div>
212210
<div className="form-group row">
213211
<div className="col-md-4">
214-
<input type="text" className="form-control form-control-sm" ref={this.physicsEl} id="InputPhysics" placeholder="Physics" required />
212+
<label htmlFor="Physics">Physics</label>
213+
<input type="text" className="form-control form-control-sm" id='Physics' ref={this.physicsEl} id="InputPhysics" placeholder="Physics" required />
215214
</div>
216215
<div className="col-md-4">
217-
<input type="text" className="form-control form-control-sm" ref={this.englishEl} id="InputEnglish" placeholder="English" required />
216+
<label htmlFor="English">English</label>
217+
<input type="text" className="form-control form-control-sm" id='English' ref={this.englishEl} id="InputEnglish" placeholder="English" required />
218218
</div>
219219
<div className="col-md-4">
220-
<input type="text" className="form-control form-control-sm" ref={this.mathsEl} id="InputMaths" placeholder="Maths" required />
220+
<label htmlFor="Maths">Maths</label>
221+
<input type="text" className="form-control form-control-sm" id= 'Maths' ref={this.mathsEl} id="InputMaths" placeholder="Maths" required />
221222
</div>
222223
</div>
223224
<hr />

client/src/components/student-list/EditStudent.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,15 @@ const EditStudent = (props)=> {
119119
</div>
120120
<div className="container text-align-center p-3">
121121
<div className="container w-75 text-align-center">
122-
<div className="container" style={{ textAlign: 'center', fontSize: '25px' }}>Add New Student</div>
122+
<div className="container" style={{ textAlign: 'center', fontSize: '25px' }}>Edit Student Data</div>
123123
<form className="py-3" onSubmit={handleUpdateSubmit}>
124124
<hr />
125125
<div className="row py-3">
126126
<div className="col">
127127
<input type="text" ref={firstNameEl} defaultValue={fName} className="form-control form-control-sm" placeholder="First name" required />
128128
</div>
129129
<div className="col">
130-
<input type="text" ref={middleNameEl} defaultValue={mName} className="form-control form-control-sm" placeholder="Middle name" />
130+
<input type="text" ref={middleNameEl} defaultValue={mName} className="form-control form-control-sm" placeholder="Middle name" required/>
131131
</div>
132132
<div className="col">
133133
<input type="text" ref={lastNameEl} defaultValue={lName} className="form-control form-control-sm" placeholder="Last name" required />
@@ -207,7 +207,7 @@ const EditStudent = (props)=> {
207207
</div>
208208
<div className="form-group col">
209209
<label htmlFor="InputFees">Total Fees</label>
210-
<input type="number" className="form-control form-control-sm" ref={feesEl} defaultValue={fees} id="InputFees" placeholder="Total Fees" />
210+
<input type="number" className="form-control form-control-sm" ref={feesEl} defaultValue={fees} id="InputFees" placeholder="Total Fees" required/>
211211
</div>
212212
</div>
213213
<hr />

server.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ const sess = {
3737
secret: SECRET,
3838
resave: false,
3939
saveUninitialized: false,
40+
cookie: {
41+
maxAge: 1000*60*60*24*7
42+
}
4043
}
4144

4245
//use sessions for tracking login

0 commit comments

Comments
 (0)