estimancy/projestimate

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

Summary

Maintainability
Test Coverage
<div class="tabs">
  <ul>
    <li><a href="#tabs-1"><%= I18n.t(:projestimate_module) %></a></li>
  </ul>

  <div id="tabs-1">
    <table border="0" width="100%">
      <tr>
        <td style="text-align:right;">
          <% if can? :manage, Pemodule %>
            <%= link_to I18n.t('new_pemodule'), new_pemodule_path, :class => 'btn' %>
          <% end %>
        </td>
      </tr>
    </table>

    <table id="table_list_1" class="table tablesorterPager table-striped table-bordered table-condensed">

      <thead>
      <tr>
        <th><%= I18n.t(:name) %></th>
        <th>Alias</th>
        <th><%= I18n.t(:description) %></th>
        <th class="filter-select"><%= I18n.t(:record_status) %></th>
        <th class="action"><%= I18n.t(:actions) %></th>
      </tr>
      </thead>

      <% if @pemodules.empty? %>
          <tr>
            <td colspan="4"><%= I18n.t(:refers_to) %> <%= link_to I18n.t('official_documentation'), load_admin_setting('url_wiki') %> <%= I18n.t(:to_install_module) %> </td>
          </tr>
      <% else %>
          <% @pemodules.each do |pemodule| %>
              <tr class="">
                <td><%= pemodule.title %></td>
                <td><%= pemodule.alias %></td>
                <td><%= pemodule.description %></td>
                <td><%= pemodule.record_status.name unless pemodule.record_status.nil? %> <%= pemodule.show_custom_value %></td>
                <td class="center">
                  <% if can? :manage, Pemodule %>
                      <%= link_to '', edit_pemodule_path(pemodule, :anchor => 'tabs-1'), :class => 'icon-pencil', :title => I18n.t('edit') %>
                      <%= link_to('', {:controller => 'pemodules', :action => 'find_use_pemodule', :pemodule_id => pemodule.id}, :remote => true, :class => 'icon-info', :title => I18n.t('button_find_use')) %>
                      <%= link_to '', pemodule, confirm: I18n.t('are_you_sure'), method: :delete, :class => 'icon-trash', :style => 'color:red', :title => I18n.t('delete') %>
                      <% if is_master_instance? && !pemodule.is_local_record? %>
                          <% if pemodule.is_retired? %>
                              <%= link_to('', "pemodules/#{pemodule.id}/restore_change", confirm: I18n.t('restoring'), :class => 'icon-undo', :style => 'color:orange', :title => I18n.t('restore_title')) %>
                          <% else %>
                              <% unless pemodule.is_defined? %>
                                  <%= link_to('', "pemodules/#{pemodule.id}/validate_change", confirm: I18n.t('validation'), :class => 'icon-ok', :style => 'color:green', :title => I18n.t('validate_title')) %>
                              <% end %>
                          <% end %>
                      <% end %>
                  <% end %>
                </td>
              </tr>
          <% end %>
      <% end %>

      <%= render :partial => 'layouts/footer_table' %>
    </table>

  </div>

</div>