Revision 1297:0a574315af3e .svn/pristine/2a

View differences:

.svn/pristine/2a/2a2a8eb00afb134f0884b2c4a0fe9a62cc43712a.svn-base
1
# This file is used by Rack-based servers to start the application.
2

  
3
require ::File.expand_path('../config/environment',  __FILE__)
4
run RedmineApp::Application
.svn/pristine/2a/2ad19a5d216db9900f8c479e9b99d1592793dd37.svn-base
1
# Redmine - project management software
2
# Copyright (C) 2006-2012  Jean-Philippe Lang
3
#
4
# This program is free software; you can redistribute it and/or
5
# modify it under the terms of the GNU General Public License
6
# as published by the Free Software Foundation; either version 2
7
# of the License, or (at your option) any later version.
8
#
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17

  
18
module Redmine
19
  module Acts
20
    module Event
21
      def self.included(base)
22
        base.extend ClassMethods
23
      end
24

  
25
      module ClassMethods
26
        def acts_as_event(options = {})
27
          return if self.included_modules.include?(Redmine::Acts::Event::InstanceMethods)
28
          default_options = { :datetime => :created_on,
29
                              :title => :title,
30
                              :description => :description,
31
                              :author => :author,
32
                              :url => {:controller => 'welcome'},
33
                              :type => self.name.underscore.dasherize }
34

  
35
          cattr_accessor :event_options
36
          self.event_options = default_options.merge(options)
37
          send :include, Redmine::Acts::Event::InstanceMethods
38
        end
39
      end
40

  
41
      module InstanceMethods
42
        def self.included(base)
43
          base.extend ClassMethods
44
        end
45

  
46
        %w(datetime title description author type).each do |attr|
47
          src = <<-END_SRC
48
            def event_#{attr}
49
              option = event_options[:#{attr}]
50
              if option.is_a?(Proc)
51
                option.call(self)
52
              elsif option.is_a?(Symbol)
53
                send(option)
54
              else
55
                option
56
              end
57
            end
58
          END_SRC
59
          class_eval src, __FILE__, __LINE__
60
        end
61

  
62
        def event_date
63
          event_datetime.to_date
64
        end
65

  
66
        def event_url(options = {})
67
          option = event_options[:url]
68
          if option.is_a?(Proc)
69
            option.call(self).merge(options)
70
          elsif option.is_a?(Hash)
71
            option.merge(options)
72
          elsif option.is_a?(Symbol)
73
            send(option).merge(options)
74
          else
75
            option
76
          end
77
        end
78

  
79
        # Returns the mail adresses of users that should be notified
80
        def recipients
81
          notified = project.notified_users
82
          notified.reject! {|user| !visible?(user)}
83
          notified.collect(&:mail)
84
        end
85

  
86
        module ClassMethods
87
        end
88
      end
89
    end
90
  end
91
end
.svn/pristine/2a/2adb9560bc07d7847c894a43ae505527519cc349.svn-base
1
class AddWorkflowsRuleFields < ActiveRecord::Migration
2
  def up
3
    add_column :workflows, :field_name, :string, :limit => 30
4
    add_column :workflows, :rule, :string, :limit => 30
5
  end
6

  
7
  def down
8
    remove_column :workflows, :field_name
9
    remove_column :workflows, :rule
10
  end
11
end

Also available in: Unified diff