Skip to content

Commit

Permalink
Put hint into tooltip on info icon. Fixed field groups for custom fie…
Browse files Browse the repository at this point in the history
…lds that don't belong to a group
  • Loading branch information
ndbroadbent committed Nov 24, 2011
1 parent 0002579 commit 49bfbc3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
3 changes: 2 additions & 1 deletion app/models/fields/field.rb
Expand Up @@ -50,7 +50,7 @@ def input_options
input_html = {:maxlength => attributes[:maxlength]}

attributes.select { |k,v|
%w(as collection disabled hint label placeholder required).include?(k)
%w(as collection disabled label placeholder required).include?(k)
}.symbolize_keys.merge(:input_html => input_html)
end

Expand All @@ -65,3 +65,4 @@ def klass
klass_name.constantize
end
end

14 changes: 7 additions & 7 deletions app/views/fields/_group.html.haml
Expand Up @@ -8,11 +8,11 @@
%table
- fields.sort_by(&:position).in_groups_of(2) do |group|
%tr
%td
- if (field = group[0])
= f.input field.name, field.input_options
%td
= spacer
%td
- if (field = group[1])
- group.compact.each_with_index do |field, i|
%td
- if field.hint
= image_tag "info_tiny.png", :title => field.hint, :class => "tooltip-icon"
= f.input field.name, field.input_options
- if i == 0
%td= spacer

4 changes: 2 additions & 2 deletions app/views/fields/_groups.html.haml
Expand Up @@ -4,8 +4,7 @@

#field_groups
- f.object.class.custom_fields.group_by(&:field_group_id).each do |field_group_id, fields|

- field_group = FieldGroup.find(field_group_id)
- field_group = field_group_id ? FieldGroup.find(field_group_id) : FieldGroup.new(:name => "Custom Fields")
- tag = f.object.tags.detect { |tag| tag.id == field_group.tag_id }
- field_groups[tag.name.downcase] = "#{field_group.key}_container" if tag

Expand All @@ -16,3 +15,4 @@
crm.set_tag_list_event('#{controller_name}', '#{asset}', '#{params[:id]}');
loadedFieldGroups = $H(#{field_groups.to_json});
}

0 comments on commit 49bfbc3

Please sign in to comment.