asia_database/app/controllers/admin/asia_databases_controller.rb

82 lines
2.3 KiB
Ruby

class Admin::AsiaDatabasesController < OrbitAdminController
def index
@asia_academies = AsiaAcademy.all.page(params[:page]).per(10)
end
def render_404
render :file => "#{Rails.root}/app/views/errors/404.html", :layout => false, :status => :not_found, :content_type => 'text/html'
end
def show
begin
uid = params[:id].split('-').last
@asia_academy = AsiaAcademy.find_by(:uid=>uid)
@asia_departs = @asia_academy.asia_departments.page(params[:page]).per(10)
rescue
render_404
end
end
def asia_teachers
begin
uid = params[:id].split('-').last
@asia_depart = AsiaDepartment.find_by(:uid=>uid)
@asia_academy = @asia_depart.asia_academy
@asia_teachers = @asia_depart.asia_teachers.page(params[:page]).per(10)
rescue
render_404
end
end
def asia_projects
begin
uid = params[:id].split('-').last
@asia_teacher = AsiaTeacher.find_by(:uid=>uid)
@asia_depart = @asia_teacher.asia_department
@asia_academy = @asia_teacher.asia_academy
@asia_projects = @asia_teacher.asia_projects.page(params[:page]).per(10)
rescue
render_404
end
end
def asia_papers
begin
uid = params[:id].split('-').last
@asia_teacher = AsiaTeacher.find_by(:uid=>uid)
@asia_depart = @asia_teacher.asia_department
@asia_academy = @asia_teacher.asia_academy
@asia_papers = @asia_teacher.asia_papers.page(params[:page]).per(10)
rescue
render_404
end
end
def asia_patents
begin
uid = params[:id].split('-').last
@asia_teacher = AsiaTeacher.find_by(:uid=>uid)
@asia_depart = @asia_teacher.asia_department
@asia_academy = @asia_teacher.asia_academy
@asia_patents = @asia_teacher.asia_patents.page(params[:page]).per(10)
rescue
render_404
end
end
def asia_tec_transfers
begin
uid = params[:id].split('-').last
@asia_teacher = AsiaTeacher.find_by(:uid=>uid)
@asia_depart = @asia_teacher.asia_department
@asia_academy = @asia_teacher.asia_academy
@asia_tec_transfers = @asia_teacher.asia_tec_transfers.page(params[:page]).per(10)
rescue
render_404
end
end
def asia_exhibitions
begin
uid = params[:id].split('-').last
@asia_teacher = AsiaTeacher.find_by(:uid=>uid)
@asia_depart = @asia_teacher.asia_department
@asia_academy = @asia_teacher.asia_academy
@asia_exhibitions = @asia_teacher.asia_exhibitions.page(params[:page]).per(10)
rescue
render_404
end
end
end