MiraitSystems/enju_trunk

View on GitHub
app/views/manifestations/_show_creators.html.erb

Summary

Maintainability
Test Coverage
<%- unless manifestation.creates.readable_by(current_user).empty? -%>
  <%- if params[:mode] == 'show_all_creators' -%>
    <%= t('agent.creator') -%>:<%= agents_list(manifestation.creates.readable_by(current_user), {}, manifestation.id, 'create') %>
    <%- if manifestation.creators.readable_by(current_user).size > 5 -%>
      (<a href="#" onclick="$.ajax({data:'authenticity_token=' + encodeURIComponent('<%= form_authenticity_token %>'), success:function(request){$('#creator_list_<%= manifestation.id %>').html(request);}, type:'get', url:'<%= manifestation_path(manifestation, :index_num => manifestation.id, :mode => 'show_creators') %>'}); return false;"><%= t('page.hide') %></a>)
    <%- end -%>
  <%- else -%>
    <%= t('agent.creator') -%>:<%= agents_list(manifestation.creates.readable_by(current_user)[0..2], {}, manifestation.id, 'create') %>
    <%- if manifestation.creators.readable_by(current_user).size > 5 -%>
      (<a href="#" onclick="$.ajax({data:'authenticity_token=' + encodeURIComponent('<%= form_authenticity_token %>'), success:function(request){$('#creator_list_<%= manifestation.id %>').html(request);}, type:'get', url:'<%= manifestation_path(manifestation, :index_num => manifestation.id, :mode => 'show_all_creators') %>'}); return false;"><%= t('page.show_all') %></a>)
    <%- end -%>
  <%- end -%>
<%- end -%>

<%- unless manifestation.realizes.readable_by(current_user).empty? -%>
  <%= t('agent.contributor') -%>:<%= agents_list(manifestation.realizes.readable_by(current_user), {}, manifestation.id, 'realize') %>
<%- end -%>

<%- unless manifestation.produces.readable_by(current_user).empty? -%>
  <%= t('agent.publisher') -%>:<%= agents_list(manifestation.produces.readable_by(current_user), {}, manifestation.id, 'produce') %>
<%- end -%>

<%- if manifestation.pub_date.present? -%>
  (<%= manifestation.pub_date -%>)
<%- end -%>