_profile.rhtml 1.33 KB
<tr>
  <td colspan='2'>

    <% plugins_tabs = @plugins.map(:profile_tabs).
      map { |tab| {:title => tab[:title], :id => tab[:id], :content => instance_eval(&tab[:content]), :start => tab[:title]} }%>

    <% tabs = plugins_tabs.select { |tab| tab[:start] } %>

    <% if logged_in? && current_person.follows?(@profile) %>
      <% tabs << {:title => _('Wall'), :id => 'profile-wall', :content => (render :partial => 'profile_wall')} %>
    <% end %>

    <% if @profile.organization? %>
      <% tabs << {:title => _('What\'s new'), :id => 'profile-network', :content => (render :partial => 'profile_network')} %>
      <% tabs << {:title => _('Profile'), :id => 'organization-profile', :content => (render :partial => 'organization_profile')} %>
    <% elsif @profile.person? %>
      <% if logged_in? && current_person.follows?(@profile) %>
        <% tabs << {:title => _('Network'), :id => 'profile-network', :content => (render :partial => 'profile_network')} %>
      <% end %>

      <% tabs << {:title => _('Activity'), :id => 'profile-activity', :content => (render :partial => 'profile_activity')} %>
      <% tabs << {:title => _('Profile'), :id => 'person-profile', :content => (render :partial => 'person_profile')} %>
    <% end %>

    <% tabs += plugins_tabs.select { |tab| !tab[:start] } %>

    <%= render_tabs(tabs) %>

  </td>
</tr>