Merge pull request #64 from finnlabs/feature/19154-form-checkbox-matrix-styling

19154 Form checkbox matrix styling
pull/6827/head
ulferts 10 years ago
commit 1ca7fbc6d2
  1. 22
      app/views/meetings/_form.html.erb
  2. 2
      features/support/participant_steps.rb

@ -67,35 +67,35 @@ See doc/COPYRIGHT.md for more details.
<div class="form--field"> <div class="form--field">
<label class="form--label"><%=Meeting.human_attribute_name(:participants) %></label> <label class="form--label"><%=Meeting.human_attribute_name(:participants) %></label>
<div class="form--field-container"> <div class="form--field-container">
<table class="form--table"> <table class="form--matrix">
<thead> <thead>
<tr class="form--table-header-row"> <tr class="form--matrix-header-row">
<th class="form--table-header-row-cell"><%= Meeting.human_attribute_name(:name) %></th> <th class="form--matrix-header-cell"><%= Meeting.human_attribute_name(:name) %></th>
<th class="form--table-header-row-cell"><%= Meeting.human_attribute_name(:participants_invited) %></th> <th class="form--matrix-header-cell"><%= Meeting.human_attribute_name(:participants_invited) %></th>
<th class="form--table-header-row-cell"><%= Meeting.human_attribute_name(:participants_attended) %></th> <th class="form--matrix-header-cell"><%= Meeting.human_attribute_name(:participants_attended) %></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<% @meeting.all_changeable_participants.sort.each do |user| -%> <% @meeting.all_changeable_participants.sort.each do |user| -%>
<%= hidden_field_tag "meeting[participants_attributes][][user_id]", user.id %> <%= hidden_field_tag "meeting[participants_attributes][][user_id]", user.id %>
<tr class="form--table-row"> <tr class="form--matrix-row">
<td><%=h user %></td> <td class="form--matrix-cell"><%=h user %></td>
<% if @meeting.participants.present? && participant = @meeting.participants.detect{|p| p.user_id == user.id} -%> <% if @meeting.participants.present? && participant = @meeting.participants.detect{|p| p.user_id == user.id} -%>
<%= hidden_field_tag "meeting[participants_attributes][][id]", participant.id %> <%= hidden_field_tag "meeting[participants_attributes][][id]", participant.id %>
<td class="form--table-checkbox-cell"> <td class="form--matrix-checkbox-cell">
<%= label_tag "checkbox_invited_#{user.id}", user.name + " " + l(:description_invite), :class => "hidden-for-sighted" %> <%= label_tag "checkbox_invited_#{user.id}", user.name + " " + l(:description_invite), :class => "hidden-for-sighted" %>
<%= styled_check_box_tag "meeting[participants_attributes][][invited]", 1, participant.invited?, :id => "checkbox_invited_#{user.id}" %> <%= styled_check_box_tag "meeting[participants_attributes][][invited]", 1, participant.invited?, :id => "checkbox_invited_#{user.id}" %>
</td> </td>
<td class="form--table-checkbox-cell"> <td class="form--matrix-checkbox-cell">
<%= label_tag "checkbox_attended_#{user.id}", user.name + " " + l(:description_attended), :class => "hidden-for-sighted" %> <%= label_tag "checkbox_attended_#{user.id}", user.name + " " + l(:description_attended), :class => "hidden-for-sighted" %>
<%= styled_check_box_tag "meeting[participants_attributes][][attended]", 1, participant.attended?, :id => "checkbox_attended_#{user.id}" %> <%= styled_check_box_tag "meeting[participants_attributes][][attended]", 1, participant.attended?, :id => "checkbox_attended_#{user.id}" %>
</td> </td>
<% else -%> <% else -%>
<td class="form--table-checkbox-cell"> <td class="form--matrix-checkbox-cell">
<%= label_tag "checkbox_invited_#{user.id}", user.name + " " + l(:description_invite), :class => "hidden-for-sighted" %> <%= label_tag "checkbox_invited_#{user.id}", user.name + " " + l(:description_invite), :class => "hidden-for-sighted" %>
<%= styled_check_box_tag "meeting[participants_attributes][][invited]", value = "1", checked = false, :id => "checkbox_invited_#{user.id}" %> <%= styled_check_box_tag "meeting[participants_attributes][][invited]", value = "1", checked = false, :id => "checkbox_invited_#{user.id}" %>
</td> </td>
<td class="form--table-checkbox-cell"> <td class="form--matrix-checkbox-cell">
<%= label_tag "checkbox_attended_#{user.id}", user.name + " " + l(:description_attended), :class => "hidden-for-sighted" %> <%= label_tag "checkbox_attended_#{user.id}", user.name + " " + l(:description_attended), :class => "hidden-for-sighted" %>
<%= styled_check_box_tag "meeting[participants_attributes][][attended]", value = "1", checked = false, :id => "checkbox_attended_#{user.id}" %> <%= styled_check_box_tag "meeting[participants_attributes][][attended]", value = "1", checked = false, :id => "checkbox_attended_#{user.id}" %>
</td> </td>

@ -21,5 +21,5 @@
Then(/^the user "(.*?)" should( not)? be available as a participant$/) do |login, negative| Then(/^the user "(.*?)" should( not)? be available as a participant$/) do |login, negative|
user = User.find_by_login(login) user = User.find_by_login(login)
step(%{I should#{negative} see "#{user.name}" within "#meeting-form table.form--table"}) step(%{I should#{negative} see "#{user.name}" within "#meeting-form table.form--matrix"})
end end

Loading…
Cancel
Save