Class: Glib::JsonUi::ViewBuilder::Fields::MultiUpload
- Inherits:
-
AbstractField
- Object
- JsonUiElement
- View
- AbstractField
- Glib::JsonUi::ViewBuilder::Fields::MultiUpload
- Includes:
- Default, FileUploadErrorHandler, Upload
- Defined in:
- app/helpers/glib/json_ui/view_builder/fields.rb
Overview
deprecated
Instance Attribute Summary
Attributes inherited from JsonUiElement
Instance Method Summary collapse
Methods included from Default
Methods inherited from AbstractField
#autoValidate, #context, #default_url_options, #determine_value, #disableDirtyCheck, #hint, #hint_args, #label, #label_args, #name, #placeholder, #placeholder_args, #prop, #validation, #value
Methods inherited from View
Methods inherited from JsonUiElement
Constructor Details
This class inherits a constructor from Glib::JsonUi::JsonUiElement
Instance Method Details
#created ⇒ Object
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 |
# File 'app/helpers/glib/json_ui/view_builder/fields.rb', line 418 def created super file_upload_error_handler_on_create @placeholder ||= I18n.t('glib.multi_upload.placeholder', default: nil) @hint ||= I18n.t('glib.multi_upload.hint', default: nil) ['200', '403', '401', 'else'].each do |status| key = "glib.multi_upload.responseMessages.#{status}" @responseMessages[status] = I18n.t(key) if I18n.exists?(key) end json.responseMessages (@responseMessages || {}).reverse_merge({ '200' => 'Completed', '403' => 'Forbidden', '401' => 'Session expired', 'else' => 'Failed' }) json.placeholder @placeholder if @placeholder json.hint @hint if @hint if @prop && context # association = form.nested_associations.last # context = association || form @files ||= context.field_value(@prop, collect_ids: false).to_a.map { |file| { name: file.blob&.filename, signed_id: file.signed_id, url: url_for(file) } } end json.files @files if @files.present? end |
#files(values) ⇒ Object
410 411 412 |
# File 'app/helpers/glib/json_ui/view_builder/fields.rb', line 410 def files(values) @files = values end |
#responseMessages(values) ⇒ Object
414 415 416 |
# File 'app/helpers/glib/json_ui/view_builder/fields.rb', line 414 def responseMessages(values) @responseMessages = values end |