+
+ def render_editable_attribute(object, attr, attrvalue=nil, htmloptions={})
+ attrvalue = object.send(attr) if attrvalue.nil?
+ return attrvalue if !object.attribute_editable? attr
+
+ input_type = 'text'
+ case object.class.attribute_info[attr.to_sym].andand[:type]
+ when 'text'
+ input_type = 'textarea'
+ when 'datetime'
+ input_type = 'date'
+ else
+ input_type = 'text'
+ end
+
+ attrvalue = attrvalue.to_json if attrvalue.is_a? Hash or attrvalue.is_a? Array
+
+ link_to attrvalue.to_s, '#', {
+ "data-emptytext" => "none",
+ "data-placement" => "bottom",
+ "data-type" => input_type,
+ "data-url" => url_for(action: "update", id: object.uuid, controller: object.class.to_s.pluralize.underscore),
+ "data-title" => "Update #{attr.gsub '_', ' '}",
+ "data-name" => attr,
+ "data-pk" => "{id: \"#{object.uuid}\", key: \"#{object.class.to_s.underscore}\"}",
+ :class => "editable"
+ }.merge(htmloptions)
+ end