estimancy/projestimate

View on GitHub
app/views/pe_attributes/index.erb

Summary

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

  <div id="tabs-1">
    <table border="0" width="100%">
      <tr>
        <td style="text-align:right;">
          <%= link_to I18n.t('new_pe_attribute'), new_pe_attribute_path, :class => 'btn' %>
        </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(:attributes_type) %></th>
        <th class="filter-select filter" style="width: 93px"><%= I18n.t(:record_status) %></th>
        <th class="action"><%= I18n.t(:actions) %></th>
      </tr>
      </thead>

      <tbody>

      <% if @attributes.empty? %>
          <p style="text-align:center;"> <%= I18n.t('empty') %></p>
      <% else %>
          <% @attributes.each do |attribute| %>
              <tr>
                <td><%= attribute.name %></td>
                <td><%= attribute.alias %></td>
                <td><%= attribute.description %></td>
                <td><%= attribute.attr_type.humanize %></td>
                <td><%= attribute.record_status.name unless attribute.record_status.nil? %> <%= attribute.show_custom_value %></td>
                <td class="center" style="min-width: 105px;">
                  <%= link_to '', edit_pe_attribute_path(attribute), :class => 'icon-pencil', :title => I18n.t('edit') %>
                  <%= link_to('', {:controller => 'pe_attributes', :action => 'find_use_attribute', :pe_attribute_id => attribute.id}, :remote => true, "data-pe_attribute_id" => attribute.id, :class => 'icon-info', :id => 'find_use_pe_attribute', :title => I18n.t('button_find_use')) %>
                  <%= link_to '', attribute, confirm: I18n.t('are_you_sure'), method: :delete, :class => 'icon-trash', :style => 'color:red', :title => I18n.t('delete') %>

                  <% if is_master_instance? && !attribute.is_local_record? %>
                      <% if attribute.is_retired? %>
                          <%= link_to('', "pe_attributes/#{attribute.id}/restore_change", confirm: I18n.t('restoring'),:class => 'icon-undo', :style => 'color:orange', :title => I18n.t('restore_title')) %>
                      <% else %>
                          <% unless attribute.is_defined? %>
                              <%= link_to('', "pe_attributes/#{attribute.id}/validate_change", confirm: I18n.t('validation'),:class => 'icon-ok', :style => 'color:green', :title => I18n.t('validate_title')) %>
                          <% end %>
                      <% end %>
                  <% end %>
                </td>
              </tr>
          <% end %>
          </tbody>

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

          </tr>

      <% end %>
      </table>

    <div class="show_modules_using_attribute">
      <%#= raw render :partial => 'pe_attributes/find_use_attribute_modules' %>
    </div>

  </div>
</div>