class PersonalResearchesController < ApplicationController def index researchs = Research.sort_for_frontend.page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count) research_list = researchs.collect do |research| member = research.member_profile path = OrbitHelper.url_to_plugin_show(member.to_param, 'member') rescue '#' { "member" => "#{member.name}", "year" => research.year, "publication_date" => (research.publish_date.strftime("%Y.%m") rescue ""), "research_title" => research.research_title, "link_to_show" => OrbitHelper.url_to_show(research.to_param) } end { "researchs" => research_list, "extras" => { "widget-title" => t("module_name.personal_research"), "th_member" => t('users.name'), "th_year" => t('personal_research.year'), "th_publication_date" => t('personal_research.publication_date'), "th_research_title" => t('personal_research.research_title'), "th_detail" => t('detail') }, "total_pages" => researchs.total_pages } end def show params = OrbitHelper.params plugin = Research.where(:is_hidden=>false).find_by(uid: params[:uid].to_s) fields_to_show =[ "year", "research_category", "publish_date", "research_title", "authors", "extracted_chapters", "language", "keywords", "url", "note", "file" ] {"plugin_datas"=>plugin.get_plugin_data(fields_to_show)} # files = research.research_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" => { # "research_title" => research.research_title, # "authors" => research.authors, # "extracted_chapters" => research.extracted_chapters, # "year" => research.year, # "language" => t(research.language), # "publish_date" => (research.publish_date.strftime("%Y.%m") rescue ""), # "keywords" => research.keywords, # "url" => research.url, # "note" => research.note, # "th_research_title" => t("personal_research.research_title"), # "th_authors" => t("personal_research.authors"), # "th_extracted_chapters" => t("personal_research.extracted_chapters"), # "th_year" => t("personal_research.year"), # "th_language" => t("personal_research.language"), # "th_publish_date" => t("personal_research.publication_date"), # "th_keywords" => t("personal_research.keywords"), # "th_url" => t("personal_research.url"), # "th_note" => t("personal_research.note"), # "th_files" => t(:file_) # } # } end end