class PersonalLabsController < ApplicationController def index labs = Lab.where(:is_hidden=>false).all lab_list = labs.collect do |lab| { "year" => lab.year, "lab_title" => lab.lab_title, "location" => lab.location, "member" => lab.member_profile.name, "link_to_show" => OrbitHelper.url_to_show(lab.to_param) } end { "labs" => lab_list, "extras" => { "widget-title" => t("module_name.personal_lab"), "th_year" => t('personal_lab.year'), "th_lab_title" => t('module_name.personal_lab'), "th_location" => t('personal_lab.location'), "th_member" => t('users.name'), "th_detail" => t('detail') } } end def show params = OrbitHelper.params lab = Lab.where(:is_hidden=>false).find_by(uid: params[:uid]) files = lab.lab_files.map do |file| { "file_url" => file.file.url, "file_title" => (file.title.blank? ? File.basename(file.file.path) : file.title), "file_ext" => File.extname(file.file.path).sub('.',''), "file_description" => file.description } end { "files"=>files, "data"=>{ "lab_title" => lab.lab_title, "location" => lab.location, "participating_professor" => lab.participating_professor, "participating_student" => lab.participating_student, "year" => lab.year, "keywords" => lab.keywords, "extension_no" => lab.extension_no, "research_direction" => lab.research_direction, "facility" => lab.facility, "url" => lab.url, "note" => lab.note, "th_lab_title" => t('personal_lab.lab_title'), "th_location" => t('personal_lab.location'), "th_participating_professor" => t('personal_lab.participating_professor'), "th_participating_student" => t('personal_lab.participating_student'), "th_year" => t('personal_lab.year'), "th_keywords" => t('personal_lab.keywords'), "th_extension_no" => t('personal_lab.extension_no'), "th_research_direction" => t('personal_lab.research_direction'), "th_facility" => t('personal_lab.facility'), "th_url" => t('personal_lab.url'), "th_note" => t('personal_lab.note'), "td_files" => t(:file_) } } end end