Email notification subject in Redmine format

This commit is contained in:
Karel Picman 2016-02-22 15:11:30 +01:00
parent 2dad76503f
commit c55fbe8dfa
4 changed files with 45 additions and 5 deletions

View File

@ -2,7 +2,7 @@
#
# Redmine plugin for Document Management System "Features"
#
# Copyright (C) 2011-15 Karel Pičman <karel.picman@kontron.com>
# Copyright (C) 2011-16 Karel Pičman <karel.picman@kontron.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@ -223,6 +223,7 @@ class DmsfWorkflowsController < ApplicationController
@dmsf_workflow = DmsfWorkflow.new
@dmsf_workflow.name = params[:dmsf_workflow][:name]
@dmsf_workflow.project_id = @project.id if @project
@dmsf_workflow.author = User.current
@dmsf_workflow.save
end
end

View File

@ -30,6 +30,7 @@ class DmsfMailer < Mailer
redmine_headers 'Project' => project.identifier if project
@files = files
@project = project
message_id project
set_language_if_valid user.language
mail :to => user.mail,
:subject => "[#{@project.name} - #{l(:menu_dmsf)}] #{l(:text_email_doc_updated_subject)}"
@ -42,6 +43,7 @@ class DmsfMailer < Mailer
redmine_headers 'Project' => project.identifier if project
@files = files
@project = project
message_id project
set_language_if_valid user.language
mail :to => user.mail,
:subject => "[#{@project.name} - #{l(:menu_dmsf)}] #{l(:text_email_doc_deleted_subject)}"
@ -70,6 +72,7 @@ class DmsfMailer < Mailer
end
set_language_if_valid user.language
@user = user
message_id workflow
@workflow = workflow
@revision = revision
@text1 = l(text1_id, :name => workflow.name, :filename => revision.file.name, :notice => notice)

View File

@ -2,7 +2,7 @@
#
# Redmine plugin for Document Management System "Features"
#
# Copyright (C) 2011-15 Karel Picman <karel.picman@kontron.com>
# Copyright (C) 2011-16 Karel Pičman <karel.picman@kontron.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@ -21,6 +21,7 @@
class DmsfWorkflow < ActiveRecord::Base
has_many :dmsf_workflow_steps, -> { order 'step ASC, operator DESC' }, :dependent => :destroy
belongs_to :author, :class_name => 'User'
scope :sorted, lambda { order('name ASC') }
scope :global, lambda { where('project_id IS NULL') }
@ -245,6 +246,7 @@ class DmsfWorkflow < ActiveRecord::Base
new_wf = self.dup
new_wf.name = name if name
new_wf.project_id = project ? project.id : nil
new_wf.author = User.current
if new_wf.save
self.dmsf_workflow_steps.each do |step|
step.copy_to(new_wf)

View File

@ -0,0 +1,34 @@
# encoding: utf-8
#
# Redmine plugin for Document Management System "Features"
#
# Copyright (C) 2011-16 Karel Pičman <karel.picman@kontron.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class ApprovalWorkflowStdFields < ActiveRecord::Migration
def self.up
add_column :dmsf_workflows, :updated_on, :timestamp
add_column :dmsf_workflows, :created_on, :datetime
add_column :dmsf_workflows, :author_id, :integer
DmsfWorkflow.update_all 'updated_on = now(), created_on = now(), author_id = (select id from users where admin = 1 limit 1)'
end
def self.down
remove_column :dmsf_workflows, :updated_on
remove_column :dmsf_workflows, :created_on
remove_column :dmsf_workflows, :author_id
end
end