Class: Glib::JsonUi::ViewBuilder::Fields::Upload
- Inherits:
-
AbstractField
- Object
- JsonUiElement
- View
- AbstractField
- Glib::JsonUi::ViewBuilder::Fields::Upload
- Includes:
- FileUploadErrorHandler, Upload
- Defined in:
- app/helpers/glib/json_ui/view_builder/fields.rb
Instance Attribute Summary
Attributes inherited from JsonUiElement
Instance Method Summary collapse
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
463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 |
# File 'app/helpers/glib/json_ui/view_builder/fields.rb', line 463 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) if @prop && context && @multi_progress @multi_progress['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 if @multi_progress @multi_progress['responseMessages'] ||= {} ['200', '403', '401', 'else'].each do |status| key = "glib.multi_upload.responseMessages.#{status}" @multi_progress['responseMessages'][status] = I18n.t(key) if I18n.exists?(key) end json.responseMessages (@multi_progress['responseMessages'] || {}).reverse_merge({ '200' => 'Completed', '403' => 'Forbidden', '401' => 'Session expired', 'else' => 'Failed' }) json.placeholder @placeholder if @placeholder json.hint @hint if @hint json.multiProgressView @multi_progress end end |
#multiProgressView(values) ⇒ Object
459 460 461 |
# File 'app/helpers/glib/json_ui/view_builder/fields.rb', line 459 def multiProgressView(values) @multi_progress = values end |