% if project.present? && project.versions.any? %> <% download = DownloadButton.find_by_project_id(project.id) %> <% unless download && download.disabled? %> <% if controller.class.name == 'ProjectsController' || controller.class.name == 'ActivitiesController' || controller.class.name == 'WikiController' %>
<%= download_button(project, download) %>
<% elsif controller.class.name == 'VersionsController' %> <% if params[:action] && params[:action] == 'show' %> <% if version = Version.find_by_id(params[:id]) %> <% end %> <% else %><%= download_button(project, download) %>
<% end %> <% end %> <% end %> <% end %>