git-svn-id: http://redmine.rubyforge.org/svn/trunk@32 e93f8b46-1217-0410-a6f0-8f06a7374b81

This commit is contained in:
Jean-Philippe Lang 2006-10-15 14:33:04 +00:00
parent 4a1cfb3df9
commit e4d4a12c6a
11 changed files with 86 additions and 10 deletions

View File

@ -239,6 +239,30 @@ class ProjectsController < ApplicationController
:filename => 'export.csv')
end
def move_issues
@issues = @project.issues.find(params[:issue_ids]) if params[:issue_ids]
redirect_to :action => 'list_issues', :id => @project and return unless @issues
@projects = []
# find projects to which the user is allowed to move the issue
@logged_in_user.memberships.each {|m| @projects << m.project if Permission.allowed_to_role("projects/move_issues", m.role_id)}
# issue can be moved to any tracker
@trackers = Tracker.find(:all)
if request.post? and params[:new_project_id] and params[:new_tracker_id]
new_project = Project.find(params[:new_project_id])
new_tracker = Tracker.find(params[:new_tracker_id])
@issues.each { |i|
# category is project dependent
i.category = nil unless i.project_id == new_project.id
# move the issue
i.project = new_project
i.tracker = new_tracker
i.save
}
flash[:notice] = l(:notice_successful_update)
redirect_to :action => 'list_issues', :id => @project
end
end
# Add a news to @project
def add_news
@news = News.new(:project => @project)

View File

@ -41,7 +41,7 @@ class Issue < ActiveRecord::Base
end
def validate
if self.due_date.nil? && !@attributes['due_date'].empty?
if self.due_date.nil? && @attributes['due_date'] && !@attributes['due_date'].empty?
errors.add :due_date, :activerecord_error_not_a_date
end
end

View File

@ -35,6 +35,14 @@
&nbsp;&nbsp;
<% end %>
<% if authorize_for('projects', 'move_issues') %>
<%= start_form_tag ({:controller => 'projects', :action => 'move_issues', :id => @project} ) %>
<%= hidden_field_tag "issue_ids[]", @issue.id %>
<%= submit_tag l(:button_move) %>
<%= end_form_tag %>
&nbsp;&nbsp;
<% end %>
<% if authorize_for('issues', 'destroy') %>
<%= start_form_tag ({:controller => 'issues', :action => 'destroy', :id => @issue} ) %>
<%= submit_tag l(:button_delete) %>

View File

@ -8,7 +8,7 @@
<p><%= f.select :priority_id, (@priorities.collect {|p| [p.name, p.id]}), :required => true %></p>
<p><%= f.select :assigned_to_id, (@issue.project.members.collect {|m| [m.name, m.user_id]}), :include_blank => true %></p>
<p><%= f.select :category_id, (@project.issue_categories.collect {|c| [c.name, c.id]}) %></p>
<p><%= f.select :category_id, (@project.issue_categories.collect {|c| [c.name, c.id]}), :include_blank => true %></p>
<p><%= f.text_field :subject, :size => 80, :required => true %></p>
<p><%= f.text_area :description, :cols => 60, :rows => 10, :required => true %></p>
<p><%= f.text_field :due_date, :size => 10 %><%= calendar_for('issue_due_date') %></p>

View File

@ -22,11 +22,15 @@
</tr>
</table>
&nbsp;
<%= start_form_tag ({:controller => 'projects', :action => 'move_issues', :id => @project}, :id => 'issues_form' ) %>
<table class="listTableContent">
<tr><td colspan="7" align="right">
<small><%= link_to l(:label_export_csv), :action => 'export_issues_csv', :id => @project.id %></small>
</td></tr>
<tr class="ListHead">
<tr>
<td colspan="6" align="left"><small><%= check_all_links 'issues_form' %></small></td>
<td colspan="2" align="right"><small><%= link_to l(:label_export_csv), :action => 'export_issues_csv', :id => @project.id %></small></td>
</tr>
<tr class="ListHead">
<td></td>
<%= sort_header_tag('issues.id', :caption => '#') %>
<%= sort_header_tag('issue_statuses.name', :caption => l(:field_status)) %>
<%= sort_header_tag('issues.tracker_id', :caption => l(:field_tracker)) %>
@ -37,6 +41,7 @@
</tr>
<% for issue in @issues %>
<tr bgcolor="#<%= issue.status.html_color %>">
<td width="15"><%= check_box_tag "issue_ids[]", issue.id %></td>
<td align="center"><%= link_to issue.long_id, :controller => 'issues', :action => 'show', :id => issue %></td>
<td align="center"><%= issue.status.name %></td>
<td align="center"><%= issue.tracker.name %></td>
@ -50,4 +55,6 @@
<p>
<%= pagination_links_full @issue_pages %>
[ <%= @issue_pages.current.first_item %> - <%= @issue_pages.current.last_item %> / <%= @issue_count %> ]
</p>
</p>
<%= submit_tag l(:button_move) %>
<%= end_form_tag %>

View File

@ -0,0 +1,24 @@
<h2><%=l(:button_move)%></h2>
<%= start_form_tag({:action => 'move_issues', :id => @project}, :class => "tabular") %>
<div class="box">
<p><label><%= l(:label_issue_plural) %>:</label>
<% for issue in @issues %>
<b><%= link_to issue.long_id, :controller => 'issues', :action => 'show', :id => issue %></b> - <%= issue.subject %>
<%= hidden_field_tag "issue_ids[]", issue.id %><br />
<% end %>
<i>(<%= @issues.length%> <%= lwr(:label_issue, @issues.length)%>)</i></p>
&nbsp;
<!--[form:issue]-->
<p><label for="new_project_id"><%=l(:field_project)%></label>
<%= select_tag "new_project_id", options_from_collection_for_select(@projects, "id", "name", @project.id) %></p>
<p><label for="new_tracker_id"><%=l(:field_tracker)%></label>
<%= select_tag "new_tracker_id", options_from_collection_for_select(@trackers, "id", "name") %></p>
</div>
<%= submit_tag l(:button_move) %>
<%= end_form_tag %>

View File

@ -0,0 +1,9 @@
class IssueMove < ActiveRecord::Migration
def self.up
Permission.create :controller => "projects", :action => "move_issues", :description => "button_move", :sort => 1061, :mail_option => 1, :mail_enabled => 0
end
def self.down
Permission.find(:first, :conditions => ["controller=? and action=?", 'projects', 'move_issues']).destroy
end
end

View File

@ -259,6 +259,7 @@ button_unlock: Entriegeln
button_download: Fernzuladen
button_list: Aufzulisten
button_view: Siehe
button_move: Bewegen
text_select_mail_notifications: Aktionen für die Mailbenachrichtigung aktiviert werden soll.
text_regexp_info: eg. ^[A-Z0-9]+$

View File

@ -35,8 +35,8 @@ activerecord_error_not_a_date: is not a valid date
general_fmt_age: %d yr
general_fmt_age_plural: %d yrs
general_fmt_date: %%b %%d, %%Y (%%a)
general_fmt_datetime: %%b %%d, %%Y (%%a), %%I:%%M %%p
general_fmt_date: %%m/%%d/%%Y
general_fmt_datetime: %%m/%%d/%%Y %%I:%%M %%p
general_fmt_datetime_short: %%b %%d, %%I:%%M %%p
general_fmt_time: %%I:%%M %%p
general_text_No: 'No'
@ -84,7 +84,7 @@ field_regexp: Regular expression
field_min_length: Minimum length
field_max_length: Maximum length
field_value: Value
field_category: Catogory
field_category: Category
field_title: Title
field_project: Project
field_issue: Issue
@ -259,6 +259,7 @@ button_unlock: Unlock
button_download: Download
button_list: List
button_view: View
button_move: Move
text_select_mail_notifications: Select actions for which mail notifications should be sent.
text_regexp_info: eg. ^[A-Z0-9]+$

View File

@ -259,6 +259,7 @@ button_unlock: Desbloquear
button_download: Telecargar
button_list: Listar
button_view: Ver
button_move: Mover
text_select_mail_notifications: Seleccionar las actividades que necesitan la activación de la notificación por mail.
text_regexp_info: eg. ^[A-Z0-9]+$

View File

@ -259,6 +259,7 @@ button_unlock: Déverrouiller
button_download: Télécharger
button_list: Lister
button_view: Voir
button_move: Déplacer
text_select_mail_notifications: Sélectionner les actions pour lesquelles la notification par mail doit être activée.
text_regexp_info: ex. ^[A-Z0-9]+$