diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-01-04 13:03:34 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-01-04 13:03:34 +0000 |
commit | c9d4d3a2be3da849343c2737b753a547d0adc875 (patch) | |
tree | 4f8a47f3d82706d4930edba49ec8a272650988bf /app | |
parent | 31178553f33063f2ee259d9b13fef63568f11318 (diff) | |
download | redmine-c9d4d3a2be3da849343c2737b753a547d0adc875.tar.gz redmine-c9d4d3a2be3da849343c2737b753a547d0adc875.zip |
Merged r2209 to r2211 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.8-stable@2229 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/attachments_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/projects_controller.rb | 5 | ||||
-rw-r--r-- | app/models/mail_handler.rb | 11 | ||||
-rw-r--r-- | app/views/layouts/_project_selector.rhtml | 4 |
4 files changed, 19 insertions, 5 deletions
diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 2851f91a6..c10834c11 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -35,7 +35,9 @@ class AttachmentsController < ApplicationController end def download - @attachment.increment_download if @attachment.container.is_a?(Version) + if @attachment.container.is_a?(Version) || @attachment.container.is_a?(Project) + @attachment.increment_download + end # images are sent inline send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename), diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 8fd79533f..0f0805262 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -84,6 +84,11 @@ class ProjectsController < ApplicationController # Show @project def show + if params[:jump] + # try to redirect to the requested menu item + redirect_to_project_menu_item(@project, params[:jump]) && return + end + @members_by_role = @project.members.find(:all, :include => [:user, :role], :order => 'position').group_by {|m| m.role} @subprojects = @project.children.find(:all, :conditions => Project.visible_by(User.current)) @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC") diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb index 268b56497..402c46127 100644 --- a/app/models/mail_handler.rb +++ b/app/models/mail_handler.rb @@ -90,6 +90,13 @@ class MailHandler < ActionMailer::Base end issue.subject = email.subject.chomp.toutf8 issue.description = plain_text_body + # custom fields + issue.custom_field_values = issue.available_custom_fields.inject({}) do |h, c| + if value = get_keyword(c.name, :override => true) + h[c.id] = value + end + h + end issue.save! add_attachments(issue) logger.info "MailHandler: issue ##{issue.id} created by #{user}" if logger && logger.info @@ -155,8 +162,8 @@ class MailHandler < ActionMailer::Base end end - def get_keyword(attr) - if @@handler_options[:allow_override].include?(attr.to_s) && plain_text_body =~ /^#{attr}:[ \t]*(.+)$/i + def get_keyword(attr, options={}) + if (options[:override] || @@handler_options[:allow_override].include?(attr.to_s)) && plain_text_body =~ /^#{attr}:[ \t]*(.+)$/i $1.strip elsif !@@handler_options[:issue][attr].blank? @@handler_options[:issue][attr] diff --git a/app/views/layouts/_project_selector.rhtml b/app/views/layouts/_project_selector.rhtml index 7a2803534..d8e2a72c9 100644 --- a/app/views/layouts/_project_selector.rhtml +++ b/app/views/layouts/_project_selector.rhtml @@ -3,10 +3,10 @@ <option selected="selected"><%= l(:label_jump_to_a_project) %></option> <option disabled="disabled">---</option> <% user_projects_by_root.keys.sort.each do |root| %> - <%= content_tag('option', h(root.name), :value => url_for(:controller => 'projects', :action => 'show', :id => root)) %> + <%= content_tag('option', h(root.name), :value => url_for(:controller => 'projects', :action => 'show', :id => root, :jump => current_menu_item)) %> <% user_projects_by_root[root].sort.each do |project| %> <% next if project == root %> - <%= content_tag('option', ('» ' + h(project.name)), :value => url_for(:controller => 'projects', :action => 'show', :id => project)) %> + <%= content_tag('option', ('» ' + h(project.name)), :value => url_for(:controller => 'projects', :action => 'show', :id => project, :jump => current_menu_item)) %> <% end %> <% end %> </select> |