From 85e89f5c09f53ae391f900bfe90a6baa312648db Mon Sep 17 00:00:00 2001 From: yanxd Date: Tue, 14 Jan 2014 09:29:28 +0800 Subject: [PATCH] storeshelper attachFromUrl --- app/helpers/stores_helper.rb | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 app/helpers/stores_helper.rb diff --git a/app/helpers/stores_helper.rb b/app/helpers/stores_helper.rb new file mode 100644 index 000000000..025ae0bbb --- /dev/null +++ b/app/helpers/stores_helper.rb @@ -0,0 +1,30 @@ +module StoresHelper + def attachFromUrl attachment + container = attachment.container + case container.to_s + when 'Message' + board_message_path(container.board, container) + when 'Issue' + issue_path(container) + when 'Document' + document_path container + when 'HomeworkAttach' + bid_path(container.bid) + when 'Memo' + forum_memo_path(container.forum, container) + when 'News' + news_path(container) + when 'Project' + project_files_path(container) + when 'Version' + # version_path(container) + project_files_path(container.project) + when 'WikiPage' + project_wiki_path(container.project) + when 'Bid' + bid_path(container) + else + logger.error "StoresHelper#attachUrl unkown type ==> #{container}" + end + end +end