Need guidance on an inline editing design

58 views
Skip to first unread message

John Sanderbeck

unread,
Aug 1, 2018, 1:49:12 AM8/1/18
to Ruby on Rails: Talk
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

David Merrick

unread,
Aug 1, 2018, 3:35:06 AM8/1/18
to Ruby on Rails: Talk
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


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ef7e07f6-dd10-4123-9b75-e0e522a3c26b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Dave Merrick

Daves Web Designs

Website http://www.daveswebdesigns.co.nz

Email merri...@gmail.com

Ph   03 216 2053

Cell 027 3089 169

John Sanderbeck

unread,
Aug 1, 2018, 5:55:24 AM8/1/18
to Ruby on Rails: Talk
Is there a way I could do all students at once?

John


On Wednesday, August 1, 2018 at 3:35:06 AM UTC-4, David Merrick wrote:
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

On Wed, Aug 1, 2018 at 9:34 AM, John Sanderbeck <band...@gmail.com> 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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.

Ralph Shnelvar

unread,
Aug 1, 2018, 5:55:41 AM8/1/18
to John Sanderbeck
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
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to

To post to this group, send email to

To view this discussion on the web visit

John Sanderbeck

unread,
Aug 1, 2018, 10:16:19 AM8/1/18
to Ruby on Rails: Talk
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

John Sanderbeck

unread,
Aug 1, 2018, 10:18:13 AM8/1/18
to Ruby on Rails: Talk
And if not, could I have a filter?  We use Filterrific in most of the application...

John

Joe Guerra

unread,
Aug 1, 2018, 10:25:06 AM8/1/18
to rubyonra...@googlegroups.com
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.

To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/5e0a9dbf-4a56-45c1-8edf-d82c969c6330%40googlegroups.com.

Joe Guerra

unread,
Aug 1, 2018, 10:34:43 AM8/1/18
to rubyonra...@googlegroups.com
or you can put a drop-down list with the attendance options in the list.

Hassan Schroeder

unread,
Aug 1, 2018, 11:07:41 AM8/1/18
to rubyonrails-talk
On Wed, Aug 1, 2018 at 7:16 AM, John Sanderbeck <band...@gmail.com> wrote:
> It will typically be a single class however the main secretary may go in to
> check attendance and she will see the entire school.

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 :-)

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

Have fun!

--
Hassan Schroeder ------------------------ hassan.s...@gmail.com
twitter: @hassan
Consulting Availability : Silicon Valley or remote

John Sanderbeck

unread,
Aug 1, 2018, 12:06:01 PM8/1/18
to Ruby on Rails: Talk
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

Hassan Schroeder

unread,
Aug 1, 2018, 1:23:45 PM8/1/18
to rubyonrails-talk
On Wed, Aug 1, 2018 at 9:06 AM, John Sanderbeck <band...@gmail.com> wrote:

> 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...

John Sanderbeck

unread,
Aug 2, 2018, 6:38:39 AM8/2/18
to Ruby on Rails: Talk
Sorry...  Only been doing RoR code for about a year...  Still learning...

John

Joe Guerra

unread,
Aug 2, 2018, 10:06:23 AM8/2/18
to Ruby on Rails: Talk
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.  

John Sanderbeck

unread,
Aug 2, 2018, 2:09:01 PM8/2/18
to Ruby on Rails: Talk
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...  :-)

John

Joe Guerra

unread,
Aug 2, 2018, 2:13:21 PM8/2/18
to Ruby on Rails: Talk
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).


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

It's still a work in progress.

John Sanderbeck

unread,
Aug 4, 2018, 8:23:46 AM8/4/18
to Ruby on Rails: Talk
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
<div class="page-title">Doing Attendance for <%= global_district_name %> - <%= global_building_name %> for <%= Date.current.strftime("%b %-d, %Y") %></div>
<%= form_tag submit_attendance_attendances_path, method: :put do %>
  <%= render(partial:'do_attendance_list') %>
  <div class="form-submit-buttons">
    <%= submit_tag 'Submit Attendance', class: 'btn btn-success' %>
    <%= link_to 'Cancel', attendances_path, class: 'btn btn-danger' %>
  </div>
<% end %>

This is the list section of the form
<div id="filterrific_results">
  <table class="pretty-table table-hover">
    <thead>
      <tr>
        <th>Student</th>
        <th colspan="4">Attendance</th>
      </tr>
    </thead>
    <tbody>
      <% @attendances.each do |attendance| %>
        <tr>
          <td><%= attendance.student.full_name %></td>
          <td>
            <div class="btn-group">
              <% AttendanceStatus.all.each do |a| %>
                  <div class="btn">
                    <%= radio_button_tag "attendance[" + attendance.id.to_s + "]", a.id, (a.id == attendance.attendance_status) %>
                    <%= label_tag a.status_name.titleize %>
                  </div>
              <% end %>
            </div>
          </td>
        </tr>
      <% end %>
    </tbody>
  </table>
  <%= page_entries_info @attendances %>
  <%= paginate @attendances, :remote => 'true' %>
</div>

John Sanderbeck

unread,
Aug 7, 2018, 6:32:07 AM8/7/18
to Ruby on Rails: Talk
Got it but I think I want to do it with Ajax instead...   :-)

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

John

John Sanderbeck

unread,
Aug 14, 2018, 5:50:15 PM8/14/18
to Ruby on Rails: Talk
Thank you everyone for the help...  After I stepped back and looked at this again it was simple...  Your guidance did help though...

John
Reply all
Reply to author
Forward
0 new messages