forked from digitalnatives/redmine_hours
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.rb
More file actions
33 lines (26 loc) · 1.08 KB
/
init.rb
File metadata and controls
33 lines (26 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
require 'redmine'
Time::DATE_FORMATS[:week] = "%Y %b %e"
Time::DATE_FORMATS[:param_date] = "%Y-%m-%d"
Time::DATE_FORMATS[:day] = "%a %e"
Time::DATE_FORMATS[:day_full] = "%Y %b %e, %A"
Time::DATE_FORMATS[:database] = "%a, %d %b %Y"
Rails.configuration.to_prepare do
TimeEntry.class_eval do
named_scope :for_user, lambda { |user| {:conditions => "#{TimeEntry.table_name}.user_id = #{user.id}"}}
named_scope :spent_on, lambda { |date| {:conditions => ["#{TimeEntry.table_name}.spent_on = ?", date]}}
end
Project.class_eval do
def open_issues
self.issues.reject(&:closed?)
end
end
end
Redmine::Plugin.register :redmine_hours do
name 'Redmine Hours Plugin'
author 'Digital Natives'
description 'Redmine Hours is a plugin to fill out your weekly timelog / timesheet easier.'
version '0.1.1'
url 'https://github.com/digitalnatives/redmine_hours'
permission :view_hours, :work_time => :index
menu(:top_menu, :hours, {:controller => "hours", :action => 'index'}, :caption => 'Hours', :after => :my_page, :if => Proc.new{ User.current.logged? }, :param => :user_id)
end