module FolderHelper def folder_link(options={}) folder = options[:folder] active = "" if options[:active] active = "icon-white" end folder.parent.empty? ? name = folder.name : name = folder.parent.gsub(/\./,'#') + "#" + folder.name if folder.isInbox? name_shown = "" + t(:inbox_name,:scope => :folder) elsif folder.isSent? name_shown = "" + t(:sent_name,:scope => :folder) elsif folder.isDrafts? name_shown = "" + t(:drafts_name,:scope => :folder) elsif folder.isTrash? name_shown = "" +t(:trash_name,:scope => :folder) else name_shown = "" + folder.name.capitalize end if folder.isTrash? if not folder.total.zero? name_shown += " " #name_shown += raw link_to(t(:emptybin,:scope=>:folder),folders_emptybin_path) #name_shown += ')' end else if !folder.unseen.zero? name_shown += ' (' + folder.unseen.to_s + ')' end end link_to name_shown.html_safe, folders_select_path(:id => name) end def pretty_folder_name(folder) if folder.nil? t(:no_selected,:scope=>:folder) else if folder.isInbox? t(:inbox_name,:scope => :folder) elsif folder.isSent? t(:sent_name,:scope => :folder) elsif folder.isDrafts? t(:drafts_name,:scope => :folder) elsif folder.isTrash? t(:trash_name,:scope => :folder) else folder.name.capitalize end end end def select_for_folders(name,id,collection,label,choice,blank) html = "" html << "
" html << "" html << simple_select_for_folders(name,id,collection,choice,blank) html << "
" end def simple_select_for_folders(name,id,collection,choice,blank) html = "" html << select(name , id, options_from_collection_for_select(collection, 'id', 'full_name', choice),{ :include_blank => (blank == true ? true : false)}) html end end