MiraitSystems/enju_trunk

View on GitHub
app/views/unablelist/index.html.erb

Summary

Maintainability
Test Coverage
<script>
  function push_submit(format) {
    var o = document.getElementById('form');
    if(format == 'pdf')
      o.action = "<%= unablelist_path(:format => 'pdf') %>";
    else if(format == 'tsv')
      o.action = "<%= unablelist_path(:format => 'tsv') %>";
    else
      o.action = "<%= unablelist_path %>";
    o.submit();
  }
</script>

<div id="content_detail" class="ui-corner-all">
<h1 class="title"><%= t('page.listing', :model => t('activerecord.models.unablelist')) -%></h1>
<div id="content_list">

<%= form_for :unablelist, :html => {:method => 'get', :id => 'form'} do -%>
  <div style="color: red"><%= flash[:message] -%></div>
  <p>
    <%= hidden_field_tag :sort_by,     params[:sort_by] %>
    <%= hidden_field_tag :library,     params[:library]     if params[:library] %>
    <%= hidden_field_tag :role,        params[:role]        if params[:role] %>
    <%= hidden_field_tag :agent_type, params[:agent_type] if params[:agent_type] %>
    <%= submit_tag t('page.output_pdf', :model => t('page.listing', :model => t('activerecord.models.unablelist'))), :onclick => "push_submit('pdf');" %>
    <%= submit_tag t('page.output_tsv', :model => t('page.listing', :model => t('activerecord.models.unablelist'))), :onclick => "push_submit('tsv');" %>
    <br />
  </p>
<%- end -%>

<table class="index">
  <tr>
    <th>
      <%= t('activerecord.attributes.user.library') -%>
      <%= link_to image_tag('icons/arrow_up.png', :size => '16x16', :alt => t('page.asc'), :title => t('tooltip.asc')), url_for(params.merge(:sort_by => 'library', :order => 'asc')) -%>
      <%= link_to image_tag('icons/arrow_down.png', :size => '16x16', :alt => t('page.desc'), :title => t('tooltip.desc')), url_for(params.merge(:sort_by => 'library', :order => 'desc')) -%>
    </th>
    <th>
      <%= t('activerecord.attributes.user.user_number') %>
      <%= link_to image_tag('icons/arrow_up.png', :size => '16x16', :alt => t('page.asc'), :title => t('tooltip.asc')), url_for(params.merge(:sort_by => 'user_number', :order => 'asc')) -%>
      <%= link_to image_tag('icons/arrow_down.png', :size => '16x16', :alt => t('page.desc'), :title => t('tooltip.desc')), url_for(params.merge(:sort_by => 'user_number', :order => 'desc')) -%>
    </th>
    <th><%= t('activerecord.attributes.agent.full_name') %></th>
    <th><%= t('activerecord.attributes.agent.telephone_number_1') %></th>
    <%- if false -%>
      <th><%= t('activerecord.attributes.agent.extelephone_number_1') %></th>
      <th><%= t('activerecord.attributes.agent.fax_number_1') %></th>
    <%- end -%>
    <%- if SystemConfiguration.get('use_birth_day') -%>
      <th><%= t('activerecord.attributes.agent.date_of_birth') %></th> 
    <%- end -%>
    <th><%= t('activerecord.attributes.user.email') %></th>
  </tr>
    <%- @users.each do |user| -%>
      <tr class="line<%= cycle("0", "1") -%>">
        <td><%= link_to user.library.display_name, user.library -%></td>
        <td><%= link_to user.user_number if user.user_number -%></td>
        <td><%= link_to user.try(:agent).try(:full_name), user -%></td>
        <td><%= user.try(:agent).try(:telephone_number_1) -%></td>
        <%- if false -%>
          <td><%= user.try(:agent).try(:extelephone_number_1) -%></td>
          <td><%= user.try(:agent).try(:fax_number_1) -%></td>
        <%- end -%>
        <%- if SystemConfiguration.get('use_birth_day') -%>
          <td><%= l(user.agent.date_of_birth, :format => :only_date) if user.try(:agent).try(:date_of_birth) -%></td>
        <%- end -%>
        <td><%= user.email -%></td>
      </tr>
    <%- end -%>
</table>
<br />
<%= paginate(@users) -%>
</div>
</div>

<div id="submenu" class="ui-corner-all">
  <h3><%= link_to h("#{t('page.total')}: #{@users.total_entries}"), unablelist_path %></h3>
  <% if @users && (@users.total_entries > 0) %>
    <%= render 'users/all_facet' %>
  <% end %>
  <br />
  <ul>
    <li><%= link_to t('page.listing', :model => t('activerecord.models.user')), users_path -%></li>
  </ul>
</div>