30 lines
1.2 KiB
Plaintext
30 lines
1.2 KiB
Plaintext
<%
|
|
extend Redmine::Pagination
|
|
source_id_cond = @contact.is_company ? Contact.visible.where(:company => @contact.first_name).map(&:id) << @contact.id : @contact.id
|
|
@note = Note.new(:created_on => Time.now)
|
|
|
|
scope = Note.where({:source_id => source_id_cond, :source_type => 'Contact'}).includes(:attachments).order("#{Note.table_name}.created_on DESC")
|
|
@notes_pages = Redmine::Pagination::Paginator.new(scope.count, 20, params['page'])
|
|
@notes = scope.limit(20).offset(@notes_pages.offset)
|
|
%>
|
|
<% if authorize_for(:notes, :create) %>
|
|
<div class="add-note hide-when-print">
|
|
<%= render :partial => 'notes/add', :locals => {:note_source => @contact} %>
|
|
</div>
|
|
<% end %>
|
|
|
|
<% if @contact.is_public? || authorize_for(:notes, :show) %>
|
|
<div id="comments">
|
|
<div id="notes">
|
|
<%= render :partial => 'notes/note_item', :collection => @notes, :locals => {:show_info => @contact.is_company, :note_source => @contact} %>
|
|
<span class="pagination"> <%= pagination_links_full @notes_pages %> </span>
|
|
</div>
|
|
</div>
|
|
|
|
<% other_formats_links do |f| %>
|
|
<% filtered_params = params.respond_to?(:to_unsafe_hash) ? params.to_unsafe_hash : params %>
|
|
<%= f.link_to 'Atom', :url => filtered_params.merge(:key => User.current.rss_key) %>
|
|
<% end %>
|
|
|
|
<% end %>
|