Skip to content

Commit

Permalink
Renamed show_contact_sections and partialized some templates.
Browse files Browse the repository at this point in the history
  • Loading branch information
steveyken committed Oct 27, 2012
1 parent ceced81 commit 6a79a7d
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion app/views/contacts/_contact.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
- if contacts_outline == "full"
%dt{ :style => "padding: 2px 0px 0px 0px" }
- if can?(:read, contact)
= render :partial => "/contacts/show_contact_sections", :locals => {:contact => contact}
= render :partial => "contacts/sections", :locals => {:contact => contact}
- @comment = Comment.new
= render "comments/new", :commentable => contact
= render :partial => "shared/timeline", :collection => (contact.comments + contact.emails).sort { |x, y| y.created_at <=> x.created_at }
13 changes: 13 additions & 0 deletions app/views/contacts/_section_custom_fields.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
- contact.field_groups.each do |field_group|
- if (fields = field_group.fields.without_pairs).any?
%div[field_group]
- collapsed = session[dom_id(field_group, :contact_show)].nil?
= section dom_id(field_group, :contact_show), collapsed, field_group.label_i18n, t('show_tag_info_small', :tag => field_group.label_i18n)
.show_fields
%div{ hidden_if(collapsed).merge(:id => dom_id(field_group, :contact_show)) }
%table.asset_attributes
- groups = fields.in_groups_of(2, false)
- groups.each_with_index do |group, i|
%tr
- group.each do |field|
= col(field.label, field.render_value(contact), (i == groups.size - 1) ? :last : nil)
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,3 @@
= col(t(:assigned_to), assigned_to_user ? link_to(assigned_to_user.name, url_for(assigned_to_user)) : "")
%tr
= col(t(:tags), contact.tag_list.map{|tag| content_tag(:span, tag, :class => "fbtag")}.join(' '), :last)


- contact.field_groups.each do |field_group|
- if (fields = field_group.fields.without_pairs).any?
%div[field_group]
- collapsed = session[dom_id(field_group, :contact_show)].nil?
= section dom_id(field_group, :contact_show), collapsed, field_group.label_i18n, t('show_tag_info_small', :tag => field_group.label_i18n)
.show_fields
%div{ hidden_if(collapsed).merge(:id => dom_id(field_group, :contact_show)) }
%table.asset_attributes
- groups = fields.in_groups_of(2, false)
- groups.each_with_index do |group, i|
%tr
- group.each do |field|
= col(field.label, field.render_value(contact), (i == groups.size - 1) ? :last : nil)

= render :partial => 'contacts/extra_section', :locals => {:contact => contact}
4 changes: 4 additions & 0 deletions app/views/contacts/_sections.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

= render :partial => "contacts/section_general", :locals => {:contact => contact}
= render :partial => "contacts/section_custom_fields", :locals => {:contact => contact}
= render :partial => "contacts/extra_section", :locals => {:contact => contact}
2 changes: 1 addition & 1 deletion app/views/contacts/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

%div#edit_contact{ hidden }

= render :partial => "show_contact_sections", :locals => { :contact => @contact }
= render :partial => "contacts/sections", :locals => { :contact => @contact }

= render "comments/new", :commentable => @contact
= render :partial => "shared/timeline", :collection => @timeline
Expand Down

0 comments on commit 6a79a7d

Please sign in to comment.