MiraitSystems/enju_trunk

View on GitHub
app/views/print_labels/_user_list.html.erb

Summary

Maintainability
Test Coverage
<div id="result">
<div style="color: green"><%= flash[:message] -%></div>
<table class="index">
  <tr>
    <th></th>
    <th>
      <%= t('activerecord.attributes.user.username') -%>
      <%= link_to image_tag('icons/arrow_up.png', :size => '16x16', :alt => t('page.asc')), url_for(:action => 'index', :sort_by => 'username', :order => 'asc', :query => @query, :birth_date => @date_of_birth, :address => @address) -%>
      <%= link_to image_tag('icons/arrow_down.png', :size => '16x16', :alt => t('page.desc')), url_for(:action => 'index', :sort_by => 'username', :order => 'desc', :query => @query, :birth_date => @date_of_birth, :address => @address) -%><br />
      <%= t('activerecord.attributes.agent.full_name') -%>
      <%= link_to image_tag('icons/arrow_up.png', :size => '16x16', :alt => t('page.asc')), url_for(:action => 'index', :sort_by => 'full_name', :order => 'asc', :query => @query, :birth_date => @date_of_birth, :address => @address) -%>
      <%= link_to image_tag('icons/arrow_down.png', :size => '16x16', :alt => t('page.desc')), url_for(:action => 'index', :sort_by => 'full_name', :order => 'desc', :query => @query, :birth_date => @date_of_birth, :address => @address) -%>
    </th>

    <th>
      <%= t('activerecord.attributes.user.user_number') -%>
      <%= link_to image_tag('icons/arrow_up.png', :size => '16x16', :alt => t('page.asc')), url_for(:action => 'index', :sort_by => 'user_number', :order => 'asc', :query => @query, :birth_date => @date_of_birth, :address => @address) -%>
      <%= link_to image_tag('icons/arrow_down.png', :size => '16x16', :alt => t('page.desc')), url_for(:action => 'index', :sort_by => 'user_number', :order => 'desc', :query => @query, :birth_date => @date_of_birth, :address => @address) -%>
    </th>
    <th>
      <%= t('activerecord.attributes.agent.telephone_number') -%>
      <%= link_to image_tag('icons/arrow_up.png', :size => '16x16', :alt => t('page.asc')), url_for(:action => 'index', :sort_by => 'telephone_number_1', :order => 'asc', :query => @query, :birth_date => @date_of_birth, :address => @address) -%>
      <%= link_to image_tag('icons/arrow_down.png', :size => '16x16', :alt => t('page.desc')), url_for(:action => 'index', :sort_by => 'telephone_number_1', :order => 'desc', :query => @query, :birth_date => @date_of_birth, :address => @address) -%>
    </th>
    <th>
      <%= t('activerecord.attributes.agent.zip_code_1') -%><br />
      <%= t('activerecord.attributes.agent.address_1') -%>
    </th>
  </tr>

<%- @users.each_with_index do |user, i| -%>
  <tr class="line<%= cycle("0", "1") -%>">
    <td><%= link_to t('family.add'), "javascript:clearMessage(); javascript:addUser('#{user.id}', '#{user.username}', '#{user.agent.full_name}');", :id => "user_#{user.id}" -%></td>
    <td>
      <%= link_to user.username, user -%>
      <br />
      <%- if user.agent -%>
        <%= link_to user.agent.full_name, user -%>
      <%- end -%>
    </td>
    <td><%= user.user_number -%></td>
    <td>
     <%- if user.agent -%>
       <%= user.agent.telephone_number_1 -%>
       <br />
       <%= user.agent.telephone_number_2 -%>
     <%- end -%>
    </td>
    <td>
      <%= user.agent.zip_code_1 if user.agent -%><br />
      <%= user.agent.address_1 if user.agent -%>
    </td>
  </tr>
<%- end -%>
</table>

<br />
<%= paginate(@users) -%>

</div>