Module: Glib::JsonUi::Default

Included in:
PageHelper::Page, ViewBuilder::Fields::MultiUpload
Defined in:
app/helpers/glib/json_ui/default.rb

Instance Method Summary collapse

Instance Method Details

#default_accepts(value) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/helpers/glib/json_ui/default.rb', line 4

def default_accepts(value)
  default_max_size_error = {
    body: I18n.t('glib.accepts.max_file_size_error.body', default: nil) || 'Files exceed the maximum size',
    button: I18n.t('glib.accepts.max_file_size_error.button', default: nil) || 'Dismiss'
  }
  default_max_length_error = {
    body: I18n.t('glib.accepts.max_file_length_error.body', default: nil) || 'Files exceed the maximum limit per upload',
    button: I18n.t('glib.accepts.max_file_length_error.button', default: nil) || 'Dismiss'
  }

  {
    fileType: value[:fileType],
    maxFileSize: value[:maxFileSize] || 10000,
    maxFileLength: value[:maxFileLength] || 10,
    maxFileSizeErrorText: value[:maxFileSizeErrorText] || default_max_size_error,
    maxFileLengthErrorText: value[:maxFileLengthErrorText] || default_max_length_error
  }
end