estimancy/projestimate

View on GitHub
app/views/organizations/organizationals_params.html.erb

Summary

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

  <div id="tabs-1">
    <% if can? :create_organizations, Organization %>
      <div style="float: right">
        <%= link_to I18n.t('new_organization'), new_organization_path, :class => 'btn' %>
        <%= link_to I18n.t('new_organization_from_image'), new_organization_from_image_path(action_name: "new_organization_from_image"), :class => 'btn' %>
      </div>
    <% end %>

    <table id="table_list_1" class="table tablesorterPager table-striped table-bordered table-condensed">
      <thead>
        <tr>
          <th><%= I18n.t(:name) %></th>
          <% if current_user.super_admin? %>
            <th><%= I18n.t(:is_image_organization) %></th>
          <% end %>
          <th><%= I18n.t(:description) %></th>
          <th class="action"><%= I18n.t(:actions) %></th>
        </tr>
      </thead>
      <tbody>
        <% @organizations.each do |i| %>
          <tr>
            <td>
              <% if i.is_image_organization %>
                <%= i.name %>
              <% else %>
                <%= link_to i.name, organization_estimations_path(i) %>
              <% end %>
            </td>
            <% if current_user.super_admin? %>
              <td class="center">
                <%= i.is_image_organization ? I18n.t("simple_form.yes") : I18n.t("simple_form.no") %>
              </td>
            <% end %>

            <td><%= i.description %></td>
            <td class="center">
              <% if can? :show_organizations, Organization %>
                  <%= link_to '', edit_organization_path(i), :class => 'icon icon-pencil', :title => I18n.t('edit') %>

                  <% if can? :manage, Organization %>
                    <%= link_to '', export_organization_path(i), :class => 'icon icon-signout', :title => I18n.t('export'), method: "POST" %>
                    <!--The duplicate organization and the create from image organization are now using the same function -->
                    <%#= link_to '', create_organization_from_image_path(organization_id: i.id, action_name: "copy_organization"), :class => 'icon icon-copy', :title => I18n.t('button_duplicate_organization') %>
                    <%= link_to '', create_organization_from_image_path(organization_id: i.id, action_name: "copy_organization"),  { remote: true, class: "icon icon-copy", 'data-toggle' =>  "modal", 'data-target' => '#modal-window'}  %>
                    <%= link_to('', confirm_organization_deletion_path(i.id), :class => 'icon icon-trash', :title => I18n.t('delete'))  %>
                  <% end %>
              <% end %>
            </td>
          </tr>
        <% end %>
        <%= render :partial => 'layouts/footer_table' %>
      </tbody>
    </table>
  </div>

  <!--<div id="display_animation_ajax_loader" style="display: none">-->
    <!--<p>Veuillez patienter, la copie de l'organisation est en cours...</p>-->
    <!--<p><%#= image_tag "green-animation-ajax-loader.gif", :id => "loading-indicator" %></p>-->
  <!--</div>-->

  <div id="modal-window" class="modal hide fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <%= render partial: "display_animation_ajax_loader" %>
  </div>
</div>