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>



On Thursday, August 2, 2018 at 2:13:21 PM UTC-4, Joe Guerra wrote:
>
> 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.
>
>
> On Thursday, August 2, 2018 at 2:09:01 PM UTC-4, John Sanderbeck wrote:
>>
>> 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
>>
>> On Thursday, August 2, 2018 at 10:06:23 AM UTC-4, Joe Guerra wrote:
>>>
>>> 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.  
>>>
>>>
>>>
>>> On Thursday, August 2, 2018 at 6:38:39 AM UTC-4, John Sanderbeck wrote:
>>>>
>>>> Sorry...  Only been doing RoR code for about a year...  Still 
>>>> learning...
>>>>
>>>> John
>>>>
>>>> On Wednesday, August 1, 2018 at 1:23:45 PM UTC-4, Hassan Schroeder 
>>>> wrote:
>>>>>
>>>>> 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... 
>>>>>
>>>>> -- 
>>>>> Hassan Schroeder ------------------------ hassan.s...@gmail.com 
>>>>> twitter: @hassan 
>>>>> Consulting Availability : Silicon Valley or remote 
>>>>>
>>>>

-- 
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+unsubscr...@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/8cd8569b-7c6f-4b45-b012-64034a728a04%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to