Module: UploadsHelper

Defined in:
app/helpers/uploads_helper.rb

Instance Method Summary collapse

Instance Method Details

#input_accept_string ⇒ Object



16
17
18
19
20
21
# File 'app/helpers/uploads_helper.rb', line 16

def input_accept_string
  safe_join [
    uploadable_file_extensions.map { Mime::EXTENSION_LOOKUP[it].to_s },
    uploadable_file_extensions.map { ".#{it}" }
  ].uniq.flatten, ","
end

#library_select_title(l) ⇒ Object



2
3
4
5
6
7
8
9
10
# File 'app/helpers/uploads_helper.rb', line 2

def library_select_title(l)
  title = [l.name]
  if current_user&.is_administrator? && l.free_space
    title << translate("models.new.free_space",
      available: number_to_human_size(l.free_space),
      precision: 2)
  end
  title.join(" ")
end

#uploadable_file_extensions ⇒ Object



12
13
14
# File 'app/helpers/uploads_helper.rb', line 12

def uploadable_file_extensions
  MediaType.indexable_extensions
end