Feature #9726 » REDMINE_TIMELOG_MEMORY_PLUGIN.diff
vendor/plugins/redmine_time_log_memory/test/test_helper.rb (revision 21) | ||
---|---|---|
1 |
# Load the normal Rails helper |
|
2 |
require File.expand_path(File.dirname(__FILE__) + '/../../../../test/test_helper') |
|
3 |
|
|
4 |
# Ensure that we are using the temporary fixture path |
|
5 |
Engines::Testing.set_fixture_path |
vendor/plugins/redmine_time_log_memory/lang/en.yml (revision 21) | ||
---|---|---|
1 |
# English strings go here |
|
2 |
my_label: "My label" |
vendor/plugins/redmine_time_log_memory/README.rdoc (revision 21) | ||
---|---|---|
1 |
= time_log_memory |
|
2 |
|
|
3 |
Description goes here |
vendor/plugins/redmine_time_log_memory/config/locales/en.yml (revision 21) | ||
---|---|---|
1 |
# English strings go here for Rails i18n |
|
2 |
en: |
|
3 |
my_label: "My label" |
vendor/plugins/redmine_time_log_memory/init.rb (revision 21) | ||
---|---|---|
1 |
require 'redmine' |
|
2 |
|
|
3 |
Redmine::Plugin.register :redmine_time_log_memory do |
|
4 |
name 'Redmine Time Log Memory plugin' |
|
5 |
author 'Max Haventon' |
|
6 |
description 'This plugin will get the default values for new Time Logs from the last Time Log for this user/issue' |
|
7 |
version '0.0.1' |
|
8 |
end |
|
9 |
|
|
10 |
require 'redmine_time_log_memory/hooks/controller_timelog_edit_before_save_hook' |
vendor/plugins/redmine_time_log_memory/lib/redmine_time_log_memory/hooks/controller_timelog_edit_before_save_hook.rb (revision 21) | ||
---|---|---|
1 |
module RedmineTimeLogMemory |
|
2 |
module Hooks |
|
3 |
class ControllerTimelogEditBeforeSaveHook < Redmine::Hook::ViewListener |
|
4 |
def controller_timelog_edit_before_save(context={}) |
|
5 |
return '' unless context[:time_entry].activity_id.nil? |
|
6 |
|
|
7 |
most_recent_time_entry = TimeEntry.last(:conditions => {:issue_id=>context[:time_entry].issue.id, :user_id=>User.current.id}) |
|
8 |
|
|
9 |
if !most_recent_time_entry.nil? |
|
10 |
context[:time_entry].activity_id = most_recent_time_entry.activity_id |
|
11 |
|
|
12 |
most_recent_time_entry.custom_field_values.each do |defaultValue| |
|
13 |
context[:time_entry].custom_field_values.each do |currentValue| |
|
14 |
|
|
15 |
if defaultValue.custom_field_id === currentValue.custom_field_id |
|
16 |
currentValue.value = defaultValue.value unless !currentValue.value.blank? |
|
17 |
break |
|
18 |
end |
|
19 |
|
|
20 |
end |
|
21 |
end |
|
22 |
end |
|
23 |
end |
|
24 |
end |
|
25 |
end |
|
26 |
end |
- « Previous
- 1
- 2
- Next »