97 lines
2.9 KiB
Ruby
97 lines
2.9 KiB
Ruby
module Panel::PersonalProject::Desktop::PersonalProjectsHelper
|
|
def publication_record publication, view
|
|
content_tag :li,
|
|
"item" => "true",
|
|
:class => "list_t_item" do
|
|
marker + \
|
|
content(publication, view) + \
|
|
edit_or_delete(publication)
|
|
end
|
|
end
|
|
|
|
def marker
|
|
content_tag :div,
|
|
:class => "list_item_action" do
|
|
content_tag(:a, "",:href=>"",
|
|
:class => "icon-check-empty",
|
|
"toggle-onclick"=>"icon-check-empty icon-check",
|
|
"ajax-remote"=>"false") + \
|
|
content_tag(:a, "",:href=>"",
|
|
:class => "icon-star-empty",
|
|
"toggle-onclick"=>"icon-star-empty icon-star",
|
|
"ajax-remote"=>"false")
|
|
end
|
|
end
|
|
|
|
def content publication, view
|
|
case view
|
|
when "project_title"
|
|
des = content_tag(:div, publication.project_title,
|
|
:class => "list_t_des")
|
|
when "job_title"
|
|
des = content_tag(:div, publication.job_title,
|
|
:class => "list_t_des")
|
|
when "keywords"
|
|
des = content_tag(:div, publication.keywords,
|
|
:class => "list_t_des")
|
|
when "file"
|
|
des = content_tag(:div, link_publication_file(publication),
|
|
:class => "list_t_des")
|
|
else
|
|
end
|
|
|
|
content_tag(:div, publication.project_title,
|
|
:class => "list_t_title") + des
|
|
|
|
end
|
|
|
|
def edit_or_delete publication
|
|
content_tag :div,
|
|
:class => "list_item_function" do
|
|
content_tag(:a, t("edit"),
|
|
:class => "journal_paper_edit admbg2 admtxt",
|
|
:href => edit_panel_personal_project_desktop_personal_project_path(publication),
|
|
"callback-method" => "editproject",
|
|
"ajax-remote" => "get") + \
|
|
content_tag(:a, t(:delete_),
|
|
"ajax-remote" => "delete",
|
|
"confirm-message" => t("sure?"),
|
|
"callback-method" => "projectDelete",
|
|
:class => "journal_paper_delete admbg2 admtxt",
|
|
:href => panel_personal_project_desktop_personal_project_path(publication))
|
|
end
|
|
end
|
|
|
|
def link_publication_file publication
|
|
publication.project_files.map{|file|
|
|
link_to(image_tag(check_file_type(file.file.url)) + \
|
|
content_tag(:span, file.title, :class => "filetitle"),
|
|
file.file.url,
|
|
:class => "file",
|
|
"target" => "_blank")
|
|
}.inject(:+)
|
|
end
|
|
|
|
def check_file_type file
|
|
if not file.nil?
|
|
file_type = MIME::Types.type_for(file).first.to_s.split("/")[1]
|
|
file_type = "/assets/ft-icons/#{file_type}/#{file_type}-48_32.png"
|
|
else
|
|
file_type = ""
|
|
end
|
|
end
|
|
|
|
def generate_authors_name ids
|
|
author_name = ids.map{|m|
|
|
if m == "0"
|
|
#{:id => 0, :text => current_user.name, :email => current_user.email }
|
|
{:id => 0, :text => current_user.name }
|
|
else
|
|
#{:id => m, :text => ConferenceCoAuthor.find(m).co_author, :email => ConferenceCoAuthor.find(m).email}
|
|
{:id => m, :text => ConferenceCoAuthor.find(m).co_author}
|
|
end
|
|
}
|
|
author_name.to_json
|
|
end
|
|
end
|