Class: Glib::JsonUi::ViewBuilder::Fields::File
- Inherits:
-
Text
- Object
- JsonUiElement
- View
- AbstractField
- Text
- Glib::JsonUi::ViewBuilder::Fields::File
- Includes:
- 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 inherited from AbstractField
#autoValidate, #context, #default_url_options, #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
#buttonLabels(obj) ⇒ Object
351 352 353 |
# File 'app/helpers/glib/json_ui/view_builder/fields.rb', line 351 def (obj) = ActiveSupport::HashWithIndifferentAccess.new(obj) end |
#created ⇒ Object
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 |
# File 'app/helpers/glib/json_ui/view_builder/fields.rb', line 355 def created ||= ActiveSupport::HashWithIndifferentAccess.new ['change'] ||= I18n.t('glib.change') if I18n.exists?('glib.change') ['upload'] ||= I18n.t('glib.upload') if I18n.exists?('glib.upload') ['delete'] ||= I18n.t('glib.delete') if I18n.exists?('glib.delete') json.set! :buttonLabels, if @prop && context # json.fileTitle context.field_value(@prop).blob&.filename if (value = context.field_value(@prop)).attached? json.fileTitle value.blob.filename json.fileUrl url_for(value) end end super end |
#determine_value(context, prop) ⇒ Object
376 377 378 379 380 |
# File 'app/helpers/glib/json_ui/view_builder/fields.rb', line 376 def determine_value(context, prop) if (value = context.field_value(prop)).attached? value.signed_id || '' end end |