# File lib/active_ldap/helper.rb, line 8 8: def ldap_attribute_description_gettext(attribute) 9: Base.human_attribute_description(attribute) 10: end
# File lib/active_ldap/helper.rb, line 3 3: def ldap_attribute_name_gettext(attribute) 4: Base.human_attribute_name(attribute) 5: end
# File lib/active_ldap/helper.rb, line 33 33: def ldap_field(type, object_name, method, options={}) 34: case type 35: when "radio_button", "check_box", "text_area" 36: form_method = type 37: else 38: form_method = "#{type}_field" 39: end 40: 41: object = options[:object] 42: if object.nil? 43: normalized_object_name = object_name.to_s.sub(/\[\](\])?$/, "\\1") 44: object = instance_variable_get("@#{normalized_object_name}") 45: end 46: values = object.nil? ? nil : object[method, true] 47: values = [nil] if values.blank? 48: required_ldap_options = options.delete(:ldap_options) || [] 49: required_ldap_options.each do |required_ldap_option| 50: found = false 51: values.each do |value| 52: next unless value.is_a?(Hash) 53: if Hash.to_a[0].to_s == required_ldap_option.to_s 54: found = true 55: break 56: end 57: end 58: values << {required_ldap_option => ""} unless found 59: end 60: 61: fields = [] 62: collect_values = Proc.new do |value, ldap_options| 63: case value 64: when Hash 65: value.each do |k, v| 66: collect_values.call(v, ldap_options + [k]) 67: end 68: when Array 69: value.each do |v| 70: collect_values.call(v, ldap_options) 71: end 72: else 73: id = "#{object_name}_#{method}" 74: name = "#{object_name}[#{method}][]" 75: ldap_options.collect.each do |ldap_option| 76: id << "_#{ldap_option}" 77: name << "[#{ldap_option}][]" 78: end 79: ldap_value_options = {:id => id, :name => name, :value => value} 80: field = send(form_method, object_name, method, 81: ldap_value_options.merge(options)) 82: if block_given? 83: field = yield(field, {:options => ldap_options, :value => value}) 84: end 85: fields << field unless field.blank? 86: end 87: end 88: collect_values.call(values, []) 89: fields.join("\n") 90: end
# File lib/active_ldap/helper.rb, line 18 18: def ldap_object_class_description_gettext(object_class) 19: Base.human_object_class_description(object_class) 20: end
# File lib/active_ldap/helper.rb, line 13 13: def ldap_object_class_name_gettext(object_class) 14: Base.human_object_class_name(object_class) 15: end
# File lib/active_ldap/helper.rb, line 28 28: def ldap_syntax_description_gettext(syntax) 29: Base.human_syntax_description(syntax) 30: end
# File lib/active_ldap/helper.rb, line 23 23: def ldap_syntax_name_gettext(syntax) 24: Base.human_syntax_name(syntax) 25: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.