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
action, any, array, badgeable, bool, color, component_name, date, date_time, enum, float, hash, icon, #initialize, int, length, menu, panels_builder, #props, required, singleton_array, string, text, url, views
Constructor Details
This class inherits a constructor from Glib::JsonUi::JsonUiElement
Instance Method Details
#buttonLabels(obj) ⇒ Object
695 696 697 |
# File 'app/helpers/glib/json_ui/view_builder/fields.rb', line 695 def (obj) @buttonLabels = ActiveSupport::HashWithIndifferentAccess.new(obj) end |
#created ⇒ Object
699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 |
# File 'app/helpers/glib/json_ui/view_builder/fields.rb', line 699 def created @buttonLabels ||= ActiveSupport::HashWithIndifferentAccess.new @buttonLabels['change'] ||= I18n.t('glib.change') if I18n.exists?('glib.change') @buttonLabels['upload'] ||= I18n.t('glib.upload') if I18n.exists?('glib.upload') @buttonLabels['delete'] ||= I18n.t('glib.delete') if I18n.exists?('glib.delete') json.set! :buttonLabels, @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
720 721 722 723 724 |
# File 'app/helpers/glib/json_ui/view_builder/fields.rb', line 720 def determine_value(context, prop) if (value = context.field_value(prop)).attached? value.signed_id || '' end end |