Need guidance on an inline editing design

What I am trying to do is in my application is add Student Attendance for the day.

What I would like to have is a form that a teacher goes to every morning on their computer or iPad with the list of his/her students and he/she just has a list of option buttons beside each student with the student’s attendance for that day. They just tap the option that is correct by each student…

The options will typically be Present, Absent, Half-Day District, Half-Day CTC, Full-Day District…

Has anyone done something like this I can look at the code or do you have suggestions on how I can do this…

I’ve been googling and watching videos and nothing does what I am looking for…

John Sanderbeck

Hi The database would supply the students details.

The form would consist of the

ist row Student details checkbox for each

Present, Absent, Half-Day District, Half-Day CTC, Full-Day District.

2nd row Submit button

Once the submit button is clicked those details would entered into the database

and the next Student in the Database would be presented

Cheers Dave

Is there a way I could do all students at once?

John

Re: [Rails] Need guidance on an inline editing design
John,

This is an add-on to David Merrick’s answer.

Since this is for a school class, it’s unlikely to have more than, say, 50 students.

Your database query could bring in up to 50 students and then you could build a view with something like the following pseudo-code

<% students.each do |student| %>

  /* build a line or lines identifying the student and radio buttons indicating attendance */

<% end %>

/* submit button */

Of course, if you have more than 50 (or whatever) students, the logic becomes a bit more complicated - but not by much.

I think this would be preferred over a one-student-per-screen approach.

Ralph

Tuesday, July 31, 2018, 3:34:23 PM, you wrote:

What I am trying to do is in my application is add Student Attendance for the day.

What I would like to have is a form that a teacher goes to every morning on their computer or iPad with the list of his/her students and he/she just has a list of option buttons beside each student with the student’s attendance for that day. They just tap the option that is correct by each student…

The options will typically be Present, Absent, Half-Day District, Half-Day CTC, Full-Day District…

Has anyone done something like this I can look at the code or do you have suggestions on how I can do this…

I’ve been googling and watching videos and nothing does what I am looking for…

John Sanderbeck

It will typically be a single class however the main secretary may go in to check attendance and she will see the entire school. This won’t hurt me as we only have 125 kids, but a larger school could have an issue… Would Pagination still work in this scenario?

John

And if not, could I have a filter? We use Filterrific in most of the application…

John

Doesn’t seem like a very hard app to put together.

Why not just load all the students at once (if they are about 50 of them) (or you can say paginate them at 20 records).

I would use radio buttons, instead of check boxes.

or you can put a drop-down list with the attendance options in the list.

Is the "main secretary" *viewing* or *editing* the data?

If it's only viewing you can consider that a completely different use
case to provide for (and it might be presenting a list, a chart/graph,
a search-by-name, etc.).

Also, consider what should happen when the teacher has recorded
attendance and an "absent" student walks in late :slight_smile:

That said, you're describing a pretty basic form/CRUD pattern, so it
shouldn't be too difficult to implement.

Have fun!

She may be editing…

Ok, Taking the suggestions from above I think I have the form figured out but where I am having an issue is with the radio buttons…

How do I define a set of radio buttons unique to each student with a set of options from an AttendanceStatus table? I would also like to show them as actual buttons with bootstrap if possible…

John

How do I define a set of radio buttons unique to each student

You'll need to include an identifier with each set of button names
(student id or something).

with a set of options from an AttendanceStatus table?

If they're unlikely to change frequently or ever I'd just hardcode
them into the app. (You could always change that later.)

I would also like to show them as actual buttons with bootstrap if possible...

Dunno -- bootstrap is just CSS right? I mean, we're talking about
"actual buttons" to start with...

Sorry… Only been doing RoR code for about a year… Still learning…

John

Have you put your code up on github?

I can give you a hand, I’m also learning rails, and run out of ideas / projects to work on.

It’s part of a larger project so let me see if I can split the attendance portion out… We use BitBucket because we are cheap… :slight_smile:

John

ok great. I’ve started a little project. Very easy took me about 1/2 hr so far.

It’s an online quiz app, great for schools (or testing one’s knowledge).

https://github.com/merlin2049er/onlinequiz

basically, it’s a multiple choice database, add questions, and it retrieves the questions in random order.

It’s still a work in progress.

Ok, I’m close on the form… Just can’t figure out how to pass back a hash or array that I can use to write the records… This is what I have in my form…

Basically I autocreate an attendance record each morning for all students with a :attendance_status of nil… This list shows each student with a radio button of each AttendanceStatus they could possibly have.

I need to somehow join the Attendance record with the list so when it comes in I can update the ones that have an attendance status selected for them.

This is the do_attendance.html.erb form

Doing Attendance for <%= global_district_name %> - <%= global_building_name %> for <%= Date.current.strftime("%b %-d, %Y") %>

<%= form_tag submit_attendance_attendances_path, method: :put do %>

<%= render(partial:‘do_attendance_list’) %>

<%= submit_tag ‘Submit Attendance’, class: ‘btn btn-success’ %>

<%= link_to ‘Cancel’, attendances_path, class: ‘btn btn-danger’ %>

<% end %>

This is the list section of the form

<% @attendances.each do |attendance| %>

<% end %>

Student Attendance
<%= attendance.student.full_name %>

<% AttendanceStatus.all.each do |a| %>

<%= radio_button_tag “attendance[” + attendance.id.to_s + “]”, a.id, (a.id == attendance.attendance_status) %>

<%= label_tag a.status_name.titleize %>

<% end %>

<%= page_entries_info @attendances %>

<%= paginate @attendances, :remote => ‘true’ %>

Got it but I think I want to do it with Ajax instead… :slight_smile:

One Click = 1 update… Would be cleaner for the teachers…

John

Thank you everyone for the help… After I stepped back and looked at this again it was simple… Your guidance did help though…

John