From 79cbe8d199c3b6ad30e912164fd1294ad9a8acff Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 21 Oct 2006 16:07:34 +0000 Subject: [PATCH] issues/add_note added git-svn-id: http://redmine.rubyforge.org/svn/trunk@36 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- redmine/app/controllers/issues_controller.rb | 15 +++++++++++++++ redmine/app/views/issues/show.rhtml | 13 +++++++++++-- redmine/db/migrate/003_issue_add_note.rb | 9 +++++++++ redmine/lang/de.yml | 1 + redmine/lang/en.yml | 1 + redmine/lang/es.yml | 1 + redmine/lang/fr.yml | 1 + 7 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 redmine/db/migrate/003_issue_add_note.rb diff --git a/redmine/app/controllers/issues_controller.rb b/redmine/app/controllers/issues_controller.rb index 9452995fb..effd3145e 100644 --- a/redmine/app/controllers/issues_controller.rb +++ b/redmine/app/controllers/issues_controller.rb @@ -47,6 +47,21 @@ class IssuesController < ApplicationController end end end + + def add_note + unless params[:history][:notes].empty? + @history = @issue.histories.build(params[:history]) + @history.author_id = self.logged_in_user.id if self.logged_in_user + @history.status = @issue.status + if @history.save + flash[:notice] = l(:notice_successful_update) + redirect_to :action => 'show', :id => @issue + return + end + end + show + render :action => 'show' + end def change_status @history = @issue.histories.build(params[:history]) diff --git a/redmine/app/views/issues/show.rhtml b/redmine/app/views/issues/show.rhtml index 1258a050c..3c1a0ed98 100644 --- a/redmine/app/views/issues/show.rhtml +++ b/redmine/app/views/issues/show.rhtml @@ -49,9 +49,18 @@ <%= end_form_tag %>    <% end %> - +<% if authorize_for('issues', 'add_note') %> +
+

<%= l(:label_add_note) %>

+ <%= start_form_tag ({:controller => 'issues', :action => 'add_note', :id => @issue}, :class => "tabular" ) %> +

+ <%= text_area 'history', 'notes', :cols => 60, :rows => 10 %>

+ <%= submit_tag l(:button_add) %> + <%= end_form_tag %> +
+<% end %>
@@ -64,7 +73,7 @@ <%= history.status.name %> <% if history.notes? %> -
<%= history.notes %> + <%= simple_format auto_link history.notes %> <% end %> <% end %> diff --git a/redmine/db/migrate/003_issue_add_note.rb b/redmine/db/migrate/003_issue_add_note.rb new file mode 100644 index 000000000..9f20039b0 --- /dev/null +++ b/redmine/db/migrate/003_issue_add_note.rb @@ -0,0 +1,9 @@ +class IssueAddNote < ActiveRecord::Migration + def self.up + Permission.create :controller => "issues", :action => "add_note", :description => "label_add_note", :sort => 1057, :mail_option => 1, :mail_enabled => 0 + end + + def self.down + Permission.find(:first, :conditions => ["controller=? and action=?", 'issues', 'add_note']).destroy + end +end diff --git a/redmine/lang/de.yml b/redmine/lang/de.yml index aea0de94f..f2dcf8994 100644 --- a/redmine/lang/de.yml +++ b/redmine/lang/de.yml @@ -241,6 +241,7 @@ label_next: Weiter label_previous: Zurück label_used_by: Benutzt von #label_details: Details... +#label_add_note: Add a note button_login: Einloggen button_submit: Einreichen diff --git a/redmine/lang/en.yml b/redmine/lang/en.yml index f412b0bc3..b02038ea9 100644 --- a/redmine/lang/en.yml +++ b/redmine/lang/en.yml @@ -241,6 +241,7 @@ label_next: Next label_previous: Previous label_used_by: Used by label_details: Details... +label_add_note: Add a note button_login: Login button_submit: Submit diff --git a/redmine/lang/es.yml b/redmine/lang/es.yml index a2543eca8..5b2f69e07 100644 --- a/redmine/lang/es.yml +++ b/redmine/lang/es.yml @@ -241,6 +241,7 @@ label_next: Próximo label_previous: Precedente label_used_by: Utilizado por #label_details: Details... +#label_add_note: Add a note button_login: Conexión button_submit: Someter diff --git a/redmine/lang/fr.yml b/redmine/lang/fr.yml index 22a625ca3..c5071a2c5 100644 --- a/redmine/lang/fr.yml +++ b/redmine/lang/fr.yml @@ -241,6 +241,7 @@ label_next: Suivant label_previous: Précédent label_used_by: Utilisé par label_details: Détails... +label_add_note: Ajouter une note button_login: Connexion button_submit: Soumettre -- 2.39.5