storeshelper attachFromUrl

This commit is contained in:
yanxd 2014-01-14 09:29:28 +08:00
parent dadf9da477
commit 85e89f5c09
1 changed files with 30 additions and 0 deletions

View File

@ -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