Skip to content

Instantly share code, notes, and snippets.

@esparkman
Created September 28, 2010 18:27
Show Gist options
  • Select an option

  • Save esparkman/601494 to your computer and use it in GitHub Desktop.

Select an option

Save esparkman/601494 to your computer and use it in GitHub Desktop.
<h1>Employee Queue</h1>
<%= form_tag client_people_path(@client), :method => :get do %>
<p>
<%= text_field_tag :search, params[:search] %>
<%= submit_tag "Search", :name => nil %>
</p>
<% end %>
<div class="logs">
<table>
<tr>
<th scope="col">Policyholder Name</th>
<th scope="col">Employee ID</th>
<th scope="col">Open/Pending Tickets</th>
<th scope="col">Number of Tickets</th>
<th scope="col">Actions</th>
</tr>
<% for person in @client.people %>
<tr>
<td><%= link_to person.full_name, client_person_path(person.client_id, person) %></td>
<td><%= person.employee_id %></td>
<td></td>
<td><%= person.calls.count %></td>
<td><%= link_to 'Edit', edit_client_person_path(person.client_id, person) %> |
<%= link_to 'Destroy', person, :confirm => 'Are you sure?', :method => :delete %></td>
</tr>
<% end %>
</table>
</div>
<%= will_paginate @people %>
<br />
class ClientsController < ApplicationController
# GET /clients
# GET /clients.xml
def index
@clients = Client.all
# @clients = Client.search params[:search]
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @clients }
end
end
# GET /clients/1
# GET /clients/1.xml
def show
@people = ThinkingSphinx.search params[:search], :page => params[:page], :per_page => 10
@client = Client.find(params[:id])
# @client = Client.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @client }
end
end
# GET /clients/new
# GET /clients/new.xml
def new
@client = Client.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @client }
end
end
# GET /clients/1/edit
def edit
@client = Client.find(params[:id])
end
# POST /clients
# POST /clients.xml
def create
@client = Client.new(params[:client])
respond_to do |format|
if @client.save
format.html { redirect_to(@client, :notice => 'Client was successfully created.') }
format.xml { render :xml => @client, :status => :created, :location => @client }
else
format.html { render :action => "new" }
format.xml { render :xml => @client.errors, :status => :unprocessable_entity }
end
end
end
# PUT /clients/1
# PUT /clients/1.xml
def update
@client = Client.find(params[:id])
respond_to do |format|
if @client.update_attributes(params[:client])
format.html { redirect_to(@client, :notice => 'Client was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @client.errors, :status => :unprocessable_entity }
end
end
end
# DELETE /clients/1
# DELETE /clients/1.xml
def destroy
@client = Client.find(params[:id])
@client.destroy
respond_to do |format|
format.html { redirect_to(client_person_path) }
format.xml { head :ok }
end
end
end
<p id="notice"><%= notice %></p>
<p>
<b>Name:</b>
<%= link_to @client.name, client_path(@client) %>
</p>
<%= render 'queue' %>
<%= link_to 'Add Policyholder', new_client_person_path(@client) %> |
<%= link_to 'Edit', edit_client_path(@client) %> |
<%= link_to 'Back', clients_path %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment