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, #button_with_tooltip, #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
990
991
992
993
994
|
# File 'frontend/app/helpers/aspace_form_helper.rb', line 990
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
1012
1013
1014
|
# File 'frontend/app/helpers/aspace_form_helper.rb', line 1012
def label_and_date(name, opts = {})
label_with_field(name, "#{obj[name]}")
end
|
#label_and_fourpartid ⇒ Object
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
|
# File 'frontend/app/helpers/aspace_form_helper.rb', line 1001
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
996
997
998
999
|
# File 'frontend/app/helpers/aspace_form_helper.rb', line 996
def label_with_field(name, field_html, opts = {})
return "" if field_html.blank?
super(name, field_html, opts.merge({:controls_class => ""}))
end
|
#readonly? ⇒ Boolean
952
953
954
|
# File 'frontend/app/helpers/aspace_form_helper.rb', line 952
def readonly?
true
end
|
#select(name, options, opts = {}) ⇒ Object
956
957
958
959
960
961
962
963
964
965
966
967
|
# File 'frontend/app/helpers/aspace_form_helper.rb', line 956
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
979
980
981
982
983
984
985
986
987
988
|
# File 'frontend/app/helpers/aspace_form_helper.rb', line 979
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
969
970
971
972
973
974
975
976
977
|
# File 'frontend/app/helpers/aspace_form_helper.rb', line 969
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
|