YaleSTC/shifts

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

Summary

Maintainability
Test Coverage
<% title "Data Objects" %>
<%= form_tag '/data_objects/index', id: "view_options" do %>
  <div id="selection_menu">

    <div id="group_type">
      <%= select_tag "view_options[group_type]", options_for_select(@group_type_options, @selected_type) %>

    <%#TODO: Change this to UJS style when we get jQuery 1.6 working%>
    <%#= observe_field('view_options_group_type',
        url: { controller: :data_objects,
                  action: :index,
                  layout: false},
        method: :get,
        with: "'group_type=' + escape(value)",
        on: "change") %>
        </div>

    <div id='group_by' style='display:none'>
      <%# empty div for the ajax call to act on %>
    </div>

    <%# TODO: enable non-javascript compatibility %>
    <%#= submit_tag "Update", id: 'submit' %>

  </div>

<% end %>
<br>
<% if DataType.first %>
  <%= render partial: "data_objects" %>
  <br>
  <% if current_user.is_admin_of?(current_department) %>
    <%= link_to "New Data Object", new_data_object_path %>
    <br>
    <%= link_to "New Data Type", new_data_type_path %>
  <% end %>
<% else %>
  You must set up a <%= link_to_if current_user.is_admin_of?(current_department), "data type", new_data_type_path %> before you can create any data objects.
<% end %>