Class: AspaceFormHelper::FormContext::ReadOnlyContext
Constant Summary
PROPERTIES_TO_EXCLUDE_FROM_READ_ONLY_VIEW
Instance Method Summary
collapse
-
#checkbox(name, opts = {}, default = true, force_checked = false) ⇒ Object
-
#label_and_date(name, opts = {}) ⇒ Object
-
#label_and_fourpartid ⇒ Object
-
#label_with_field(name, field_html, opts = {}) ⇒ Object
-
#readonly? ⇒ Boolean
-
#select(name, options, opts = {}) ⇒ Object
-
#textarea(name = nil, value = "", opts = {}) ⇒ Object
-
#textfield(name = nil, value = "", opts = {}) ⇒ Object
#[], #add_tooltip_options, #allowable_types_for, #array_for_textarea, #checkboxes_for_oai_sets, #clean_mixed_content, #combobox, #current_context, #current_id, #custom_report_template_limit_options, #default_for, #define_template, #emit_template, #error_params, #exceptions_for_js, #fields_for, #form_context, #form_top, #h, #help_path_for, #hidden_input, #i18n_for, #id, #id_for, #id_for_javascript, #initialize, #jsonmodel_definition, #label, #label_and_boolean, #label_and_disabled_checkbox, #label_and_merge_select, #label_and_password, #label_and_readonly, #label_and_select, #label_and_textarea, #label_and_textfield, #list_for, #merge_checkbox, #merge_select, #merge_victim_view, #name_to_json_path, #notes_preview, #notes_preview_single, #oai_config_repo_set_codes_field, #oai_config_sponsor_set_names_field, #obj, #parent_context, #password, #path, #possible_options_for, #preserve_newlines, #push, #radio, #read_only_view, #readonly_context, #record_level_merge_controls, #required?, #set_index, #slug_url_field, #templates, #templates_for_js, #textarea_ro, #tooltip, #update_monitor_params
Instance Method Details
#checkbox(name, opts = {}, default = true, force_checked = false) ⇒ Object
962
963
964
965
966
|
# File 'frontend/app/helpers/aspace_form_helper.rb', line 962
def checkbox(name, opts = {}, default = true, force_checked = false)
true_i18n = I18n.t("#{i18n_for(name)}_true", :default => I18n.t('boolean.true'))
false_i18n = I18n.t("#{i18n_for(name)}_false", :default => I18n.t('boolean.false'))
((obj[name] === true) || obj[name] === "true") ? true_i18n : false_i18n
end
|
#label_and_date(name, opts = {}) ⇒ Object
984
985
986
|
# File 'frontend/app/helpers/aspace_form_helper.rb', line 984
def label_and_date(name, opts = {})
label_with_field(name, "#{obj[name]}")
end
|
#label_and_fourpartid ⇒ Object
973
974
975
976
977
978
979
980
981
982
|
# File 'frontend/app/helpers/aspace_form_helper.rb', line 973
def label_and_fourpartid
fourpart_html = "<div class='identifier-display'>"+
"<span class='identifier-display-part'>#{obj["id_0"]}</span>" +
"<span class='identifier-display-part'>#{obj["id_1"]}</span>" +
"<span class='identifier-display-part'>#{obj["id_2"]}</span>" +
"<span class='identifier-display-part'>#{obj["id_3"]}</span>" +
"</div>"
label_with_field("id_0", fourpart_html)
end
|
#label_with_field(name, field_html, opts = {}) ⇒ Object
968
969
970
971
|
# File 'frontend/app/helpers/aspace_form_helper.rb', line 968
def label_with_field(name, field_html, opts = {})
return "" if field_html.blank?
super(name, field_html, opts.merge({:controls_class => "label-only"}))
end
|
#readonly? ⇒ Boolean
924
925
926
|
# File 'frontend/app/helpers/aspace_form_helper.rb', line 924
def readonly?
true
end
|
#select(name, options, opts = {}) ⇒ Object
928
929
930
931
932
933
934
935
936
937
938
939
|
# File 'frontend/app/helpers/aspace_form_helper.rb', line 928
def select(name, options, opts = {})
return nil if obj[name].blank?
match = options.find {|label, value| value == obj[name]}
if match
match[0]
else
I18n.t("#{i18n_for(name)}_#{obj[name]}", :default => obj[name])
end
end
|
#textarea(name = nil, value = "", opts = {}) ⇒ Object
951
952
953
954
955
956
957
958
959
960
|
# File 'frontend/app/helpers/aspace_form_helper.rb', line 951
def textarea(name = nil, value = "", opts = {})
return "" if value.blank?
opts[:escape] = true unless opts[:escape] == false
opts[:base_url] ||= "/"
value = clean_mixed_content(value, opts[:base_url]) if opts[:clean] == true
value = @parent.preserve_newlines(value) if opts[:clean] == true
value = value.to_s if value.is_a? Integer
value = CGI::escapeHTML(value) if opts[:escape]
value.html_safe
end
|
#textfield(name = nil, value = "", opts = {}) ⇒ Object
941
942
943
944
945
946
947
948
949
|
# File 'frontend/app/helpers/aspace_form_helper.rb', line 941
def textfield(name = nil, value = "", opts = {})
return "" if value.blank?
opts[:escape] = true unless opts[:escape] == false
opts[:base_url] ||= "/"
value = clean_mixed_content(value, opts[:base_url]) if opts[:clean] == true
value = @parent.preserve_newlines(value) if opts[:clean] == true
value = CGI::escapeHTML(value) if opts[:escape]
value.html_safe
end
|