socialforge/app/helpers/stores_helper.rb

31 lines
742 B
Ruby
Raw Normal View History

2014-01-14 09:29:28 +08:00
module StoresHelper
def attachFromUrl attachment
container = attachment.container
2014-01-14 09:43:53 +08:00
case container.class.to_s
2014-01-14 09:29:28 +08:00
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
2014-01-14 09:43:53 +08:00
'#'#logger.error "StoresHelper#attachUrl unkown type ==> #{container}"
2014-01-14 09:29:28 +08:00
end
end
end