* Add view for managing organizations This adds only an index and show action for the internal/organizations page. Eventually we'll flesh this out with features to automate the more mechanical org management tasks. * Use instance variable for search query * Convert multiple expects into one * Add pagination to organizations * Add search spec for organizations * Use size over count
18 lines
413 B
Ruby
18 lines
413 B
Ruby
class Internal::OrganizationsController < Internal::ApplicationController
|
|
layout "internal"
|
|
|
|
def index
|
|
@organizations = Organization.order("name DESC").page(params[:page]).per(50)
|
|
|
|
return if params[:search].blank?
|
|
|
|
@organizations = @organizations.where(
|
|
"name ILIKE ?",
|
|
"%#{params[:search].strip}%",
|
|
)
|
|
end
|
|
|
|
def show
|
|
@organization = Organization.find(params[:id])
|
|
end
|
|
end
|