module FileManagersHelper def fa_icon(icon_name, text="") "#{text}".html_safe end def generate_breadcrumb breadcrumb_contents = "" url_infos = [ { type: "key", key: "all", trans: I18n.t(:all) } ] if @module_key != 'all' url_infos << { type: "key", key: @module_key, trans: @module_title } end if @recycle_bin || (@upload_item && @upload_item.is_trash) url_infos << { type: "recycle", key: (@upload_item ? @upload_item.module : nil), trans: I18n.t("file_manager.recycle_bin") } end if @file filename = @upload_item.filename version = @upload_item.version if @upload_item.is_trash && @upload_item.file_manager_trash.record_only filename += " (version #{version})" end url_infos << { type: "file", trans: filename } end last_idx = url_infos.count - 1 url_infos.each_with_index do |info, i| if i == last_idx breadcrumb_contents += info[:trans] else if info[:type] == 'recycle' breadcrumb_contents += "#{info[:trans]}" else breadcrumb_contents += "#{info[:trans]}" end breadcrumb_contents += "/" end end breadcrumb_contents.html_safe end end