Permalink
Browse files

mostly working now except for searchs on users

  • Loading branch information...
1 parent 6b90284 commit 9b58cface137403c7cff7e0078887515d9b1e5cc @rnhurt committed Dec 4, 2008
@@ -7,7 +7,7 @@ def index
respond_to do |format|
format.html
- format.js { render :partial => "users/user_list", :locals => { :users => @students } }
+ format.js { render :partial => "users/user_list" , :locals => { :user_type => "student", :users => @students }}
end
end
@@ -1,6 +1,6 @@
class TeacherAssistantsController < ApplicationController
- # GET /teacher_assistants
- # GET /teacher_assistants.xml
+ layout "standard"
+
def index
@teacher_assistants = TeacherAssistant.search(params[:search], params[:page])
@types = User.find_user_types(:all)
View
@@ -10,7 +10,7 @@ class User < ActiveRecord::Base
## Search for a user (will_paginate)
def self.search(search, page)
- paginate :per_page => 10, :page => page,
+ paginate :per_page => 15, :page => page,
:conditions => ['first_name like ? or last_name like ?', "%#{search}%", "%#{search}%"],
:order => 'first_name',
:include => :site
@@ -11,7 +11,7 @@
<%= stylesheet_link_tag 'tables' %>
<%#= stylesheet_link_tag 'buttons' %>
<%= stylesheet_link_tag 'menu' %>
- <%= javascript_include_tag 'prototype' %>
+ <%= javascript_include_tag :defaults %>
</head>
<body>
@@ -7,6 +7,6 @@
</div>
<br />
-<h1>BLAH</h1>
+
<%#= link_to 'New Student', new_student_path %>
@@ -1,18 +1,12 @@
-<h1>Listing teacher_assistants</h1>
-
-<table>
- <tr>
- </tr>
-
-<% for teacher_assistant in @teacher_assistants %>
- <tr>
- <td><%= link_to 'Show', teacher_assistant %></td>
- <td><%= link_to 'Edit', edit_teacher_assistant_path(teacher_assistant) %></td>
- <td><%= link_to 'Destroy', teacher_assistant, :confirm => 'Are you sure?', :method => :delete %></td>
- </tr>
+<% content_for :left do %>
+ <%= render :partial => 'users/user_types' %>
<% end %>
-</table>
+
+<div id="users">
+ <%= render :partial => "users/user_list", :locals => { :users => @teacher_assistants } %>
+</div>
<br />
-<%= link_to 'New teacher_assistant', new_teacher_assistant_path %>
+<%#= link_to 'New Teacher Assistant', new_teacher_assistant_path %>
+
@@ -1,42 +1,35 @@
-<%- ## Is this a student
-student = true # if users[1].class.to_s == "Student"
--%>
-
-<span class="paginate">
-<%#= will_paginate users %>
-</span>
+<% user_type = "student" %>
<table id="users" class="master">
<thead>
<th>ID</th>
- <%- form_for users.class.to_s, :html => { :method => :get } do -%>
- <th>Name<%= text_field_tag :search, params[:search], :class => "search" %></th>
- <%- end -%>
+ <% form_for users.class.to_s, :html => { :method => :get } do |s| %>
+ <th>Name <%= text_field_tag :search, params[:search], :class => "search" %></th>
+ <% end %>
<th>Email Address</th>
<th>Campus</th>
- <%- if student -%><th>Class Of</th><%- end -%>
+ <th>Class Of</th>
</thead>
<tfoot>
<th>ID</th>
<th>Name</th>
<th>Email Address</th>
<th>Campus</th>
- <%- if student -%><th>Class Of</th><%- end -%>
+ <% if user_type == "student" %><th>Class Of</th><% end %>
</tfoot>
<tbody>
- <%- for u in users -%>
+ <% for u in users %>
<tr class="<%= cycle('odd', 'even') %>" onclick="<%#= link_to(u.full_name, u) %>"/>
- <%#= link_to_function(u.full_name, u) %>
- <td><%=h u.short_name %></td>
- <td><%#= link_to(u.full_name, u) %></td>
- <td><%=h u.email %></td>
- <td><%=h u.site.name %></td>
- <%- if student -%>
- <td><%=h u.class_of %></td>
- <%- end -%>
+ <%= content_tag :td, u.short_name %>
+ <%= content_tag :td, link_to_function(u.full_name, u) %>
+ <%= content_tag :td, u.email %>
+ <%= content_tag :td, u.site.name %>
+ <% if user_type == "student" %>
+ <%= content_tag :td, u.class_of %>
+ <% end %>
</tr>
- <%- end -%>
+ <% end %>
</tbody>
</table>
@@ -1,12 +1,15 @@
+
<table id="types" class="master">
<thead>
<th>Type</th>
</thead>
<tbody>
<% @types.each { |key, value| -%>
<tr class="<%= cycle('odd', 'even') %>" onclick="<%= remote_function(:update => 'users', :method => :get, :url => { :controller => key }) %>"/>
- <td><%= link_to_remote value.name, {:update => 'users', :method => :get, :url => { :controller => key }},
- :href => url_for(:controller => key) %> <%#= debug link_path %>
+ <td>
+ <%= link_to_remote value.name,
+ {:update => 'users', :method => :get, :url => { :controller => key }},
+ :href => url_for(:controller => key) %>
</td>
</tr>
<% } -%>

0 comments on commit 9b58cfa

Please sign in to comment.