OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
openproject/app/views/common/list_attachments.json.erb

20 lines
902 B

<%#-- copyright
OpenProject is a project management system.
Copyright (C) 2012-2013 the OpenProject Team
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 3.
See doc/COPYRIGHT.rdoc for more details.
++#%>
<%= attachments.select { |a| a.readable? and a.visible? }
.map { |a| { :content_type => CGI::escape_html(a.content_type),
:filename => CGI::escape_html(a.filename),
:description => CGI::escape_html(a.description),
:url => url_for(:controller => '/attachments', :action => 'show', :id => a, :filename => a.filename),
:is_image => !!a.image? # doing the !! as image? for whatever reason returns null or a number
}
}.to_json.html_safe %>