From e4d4a12c6a8a5507600b50e08c96da99789490ec Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 15 Oct 2006 14:33:04 +0000 Subject: [PATCH] git-svn-id: http://redmine.rubyforge.org/svn/trunk@32 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- .../app/controllers/projects_controller.rb | 24 +++++++++++++++++++ redmine/app/models/issue.rb | 2 +- redmine/app/views/issues/show.rhtml | 8 +++++++ redmine/app/views/projects/add_issue.rhtml | 2 +- redmine/app/views/projects/list_issues.rhtml | 17 +++++++++---- redmine/app/views/projects/move_issues.rhtml | 24 +++++++++++++++++++ redmine/db/migrate/002_issue_move.rb | 9 +++++++ redmine/lang/de.yml | 1 + redmine/lang/en.yml | 7 +++--- redmine/lang/es.yml | 1 + redmine/lang/fr.yml | 1 + 11 files changed, 86 insertions(+), 10 deletions(-) create mode 100644 redmine/app/views/projects/move_issues.rhtml create mode 100644 redmine/db/migrate/002_issue_move.rb diff --git a/redmine/app/controllers/projects_controller.rb b/redmine/app/controllers/projects_controller.rb index 802573054..8343c7a5f 100644 --- a/redmine/app/controllers/projects_controller.rb +++ b/redmine/app/controllers/projects_controller.rb @@ -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) diff --git a/redmine/app/models/issue.rb b/redmine/app/models/issue.rb index 7b48182c7..489dad885 100644 --- a/redmine/app/models/issue.rb +++ b/redmine/app/models/issue.rb @@ -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 diff --git a/redmine/app/views/issues/show.rhtml b/redmine/app/views/issues/show.rhtml index fc48e47a1..1258a050c 100644 --- a/redmine/app/views/issues/show.rhtml +++ b/redmine/app/views/issues/show.rhtml @@ -35,6 +35,14 @@    <% 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 %> +    +<% end %> + <% if authorize_for('issues', 'destroy') %> <%= start_form_tag ({:controller => 'issues', :action => 'destroy', :id => @issue} ) %> <%= submit_tag l(:button_delete) %> diff --git a/redmine/app/views/projects/add_issue.rhtml b/redmine/app/views/projects/add_issue.rhtml index f12542b43..11e61d6b3 100644 --- a/redmine/app/views/projects/add_issue.rhtml +++ b/redmine/app/views/projects/add_issue.rhtml @@ -8,7 +8,7 @@

<%= f.select :priority_id, (@priorities.collect {|p| [p.name, p.id]}), :required => true %>

<%= f.select :assigned_to_id, (@issue.project.members.collect {|m| [m.name, m.user_id]}), :include_blank => true %>

-

<%= f.select :category_id, (@project.issue_categories.collect {|c| [c.name, c.id]}) %>

+

<%= f.select :category_id, (@project.issue_categories.collect {|c| [c.name, c.id]}), :include_blank => true %>

<%= f.text_field :subject, :size => 80, :required => true %>

<%= f.text_area :description, :cols => 60, :rows => 10, :required => true %>

<%= f.text_field :due_date, :size => 10 %><%= calendar_for('issue_due_date') %>

diff --git a/redmine/app/views/projects/list_issues.rhtml b/redmine/app/views/projects/list_issues.rhtml index d18799acf..7a924b134 100644 --- a/redmine/app/views/projects/list_issues.rhtml +++ b/redmine/app/views/projects/list_issues.rhtml @@ -22,11 +22,15 @@   + +<%= start_form_tag ({:controller => 'projects', :action => 'move_issues', :id => @project}, :id => 'issues_form' ) %> - - + + + + + + <%= 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 @@ <% for issue in @issues %> + @@ -50,4 +55,6 @@

<%= pagination_links_full @issue_pages %> [ <%= @issue_pages.current.first_item %> - <%= @issue_pages.current.last_item %> / <%= @issue_count %> ] -

\ No newline at end of file +

+<%= submit_tag l(:button_move) %> +<%= end_form_tag %> \ No newline at end of file diff --git a/redmine/app/views/projects/move_issues.rhtml b/redmine/app/views/projects/move_issues.rhtml new file mode 100644 index 000000000..380d47fd5 --- /dev/null +++ b/redmine/app/views/projects/move_issues.rhtml @@ -0,0 +1,24 @@ +

<%=l(:button_move)%>

+ + +<%= start_form_tag({:action => 'move_issues', :id => @project}, :class => "tabular") %> + +
+

+<% for issue in @issues %> + <%= link_to issue.long_id, :controller => 'issues', :action => 'show', :id => issue %> - <%= issue.subject %> + <%= hidden_field_tag "issue_ids[]", issue.id %>
+<% end %> +(<%= @issues.length%> <%= lwr(:label_issue, @issues.length)%>)

+ +  + + +

+<%= select_tag "new_project_id", options_from_collection_for_select(@projects, "id", "name", @project.id) %>

+ +

+<%= select_tag "new_tracker_id", options_from_collection_for_select(@trackers, "id", "name") %>

+
+<%= submit_tag l(:button_move) %> +<%= end_form_tag %> diff --git a/redmine/db/migrate/002_issue_move.rb b/redmine/db/migrate/002_issue_move.rb new file mode 100644 index 000000000..61b8cd443 --- /dev/null +++ b/redmine/db/migrate/002_issue_move.rb @@ -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 diff --git a/redmine/lang/de.yml b/redmine/lang/de.yml index e7f44842d..c39d71035 100644 --- a/redmine/lang/de.yml +++ b/redmine/lang/de.yml @@ -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]+$ diff --git a/redmine/lang/en.yml b/redmine/lang/en.yml index c1dc27243..d4ef52b28 100644 --- a/redmine/lang/en.yml +++ b/redmine/lang/en.yml @@ -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]+$ diff --git a/redmine/lang/es.yml b/redmine/lang/es.yml index d4a9edb84..acc71eca1 100644 --- a/redmine/lang/es.yml +++ b/redmine/lang/es.yml @@ -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]+$ diff --git a/redmine/lang/fr.yml b/redmine/lang/fr.yml index 8f04dc5eb..866f79af6 100644 --- a/redmine/lang/fr.yml +++ b/redmine/lang/fr.yml @@ -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]+$ -- 2.39.5
- <%= link_to l(:label_export_csv), :action => 'export_issues_csv', :id => @project.id %> -
<%= check_all_links 'issues_form' %><%= link_to l(:label_export_csv), :action => 'export_issues_csv', :id => @project.id %>
<%= check_box_tag "issue_ids[]", issue.id %> <%= link_to issue.long_id, :controller => 'issues', :action => 'show', :id => issue %> <%= issue.status.name %> <%= issue.tracker.name %>