Index: app/controllers/projects_controller.rb =================================================================== --- app/controllers/projects_controller.rb (revision 1704) +++ app/controllers/projects_controller.rb (working copy) @@ -187,13 +187,14 @@ end def add_file + @versions = @project.versions.sort + @versions_empty = @versions.empty? if request.post? @version = @project.versions.find_by_id(params[:version_id]) attachments = attach_files(@version, params[:attachments]) Mailer.deliver_attachments_added(attachments) if !attachments.empty? && Setting.notified_events.include?('file_added') redirect_to :controller => 'projects', :action => 'list_files', :id => @project end - @versions = @project.versions.sort end def list_files Index: app/views/projects/_no_versions.rhtml =================================================================== --- app/views/projects/_no_versions.rhtml (revision 0) +++ app/views/projects/_no_versions.rhtml (revision 0) @@ -0,0 +1,3 @@ +
+ <%= simple_format(l(:text_no_project_versions)) %> +
Index: app/views/projects/add_file.rhtml =================================================================== --- app/views/projects/add_file.rhtml (revision 1704) +++ app/views/projects/add_file.rhtml (working copy) @@ -1,5 +1,7 @@

<%=l(:label_attachment_new)%>

+<%= render :partial => 'no_versions' if @versions_empty %> + <%= error_messages_for 'attachment' %>
<% form_tag({ :action => 'add_file', :id => @project }, :multipart => true, :class => "tabular") do %> Index: lang/en.yml =================================================================== --- lang/en.yml (revision 1704) +++ lang/en.yml (working copy) @@ -593,6 +593,7 @@ text_issue_category_reassign_to: Reassign issues to this category text_user_mail_option: "For unselected projects, you will only receive notifications about things you watch or you're involved in (eg. issues you're the author or assignee)." text_no_configuration_data: "Roles, trackers, issue statuses and workflow have not been configured yet.\nIt is highly recommended to load the default configuration. You will be able to modify it once loaded." +text_no_project_versions: "Versions have not been configured for this project.\nYou must create at least one version for this project before you can attach files." text_load_default_configuration: Load the default configuration text_status_changed_by_changeset: Applied in changeset %s. text_issues_destroy_confirmation: 'Are you sure you want to delete the selected issue(s) ?'