bookyt_projects 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/app/controllers/activities_controller.rb +6 -4
- data/app/models/activity.rb +12 -10
- data/app/models/bookyt_projects/{employee.rb → person.rb} +1 -1
- data/app/models/work_day.rb +1 -1
- data/app/views/activities/_activity.html.haml +7 -0
- data/app/views/activities/_form.html.haml +3 -3
- data/app/views/activities/_list.html.haml +2 -9
- data/app/views/projects/_form.html.haml +2 -2
- data/app/views/timesheets/index.html.haml +11 -8
- data/config/locales/de.yml +5 -5
- data/db/migrate/20110909075128_create_project_states.rb +9 -0
- data/db/migrate/20110909075220_create_projects.rb +14 -0
- data/db/migrate/20110912071440_create_tasks.rb +14 -0
- data/db/migrate/20111010114218_rename_task_to_activity.rb +5 -0
- data/db/migrate/20111025090501_rename_duration_columns_in_projects_and_activities.rb +10 -0
- data/lib/bookyt_projects/railtie.rb +3 -1
- data/lib/bookyt_projects/version.rb +1 -1
- metadata +13 -7
@@ -6,14 +6,16 @@ class ActivitiesController < AuthorizedController
|
|
6
6
|
if params[:activity]
|
7
7
|
@activity = Activity.new(params[:activity])
|
8
8
|
else
|
9
|
-
@activity = Activity.new(:
|
9
|
+
@activity = Activity.new(:date => Date.today)
|
10
10
|
end
|
11
11
|
|
12
|
-
#
|
13
|
-
@activity.project_id ||= params[:project_id] if params[:project_id]
|
14
|
-
# Educated guessing of defaults
|
12
|
+
# Educated guessing of person
|
15
13
|
@activity.person = current_user.person if current_user
|
16
14
|
|
15
|
+
# Educated guessing of project
|
16
|
+
@activity.project_id ||= params[:project_id] if params[:project_id]
|
17
|
+
@activity.project_id ||= @activity.person.activities.order(:duration_to).last
|
18
|
+
|
17
19
|
new!
|
18
20
|
end
|
19
21
|
|
data/app/models/activity.rb
CHANGED
@@ -1,16 +1,18 @@
|
|
1
1
|
class Activity < ActiveRecord::Base
|
2
|
+
# Associations
|
2
3
|
belongs_to :project
|
3
4
|
belongs_to :person
|
5
|
+
validates :project, :presence => true, :allow_blank => false
|
6
|
+
validates :person, :presence => true, :allow_blank => false
|
4
7
|
|
5
8
|
attr_accessor :minutes, :hours
|
6
9
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
validates :
|
11
|
-
|
12
|
-
validates_numericality_of :
|
13
|
-
validates_numericality_of :minutes, :only_integer => true, :unless => :from
|
10
|
+
# Duration
|
11
|
+
validates_date :date, :allow_nil => false, :allow_blank => false
|
12
|
+
validates :duration_from, :presence => true, :unless => :hours_minutes
|
13
|
+
validates :duration_to, :presence => true, :unless => :hours_minutes
|
14
|
+
validates_numericality_of :hours, :only_integer => true, :unless => :duration_from
|
15
|
+
validates_numericality_of :minutes, :only_integer => true, :unless => :duration_from
|
14
16
|
|
15
17
|
before_save :calculate_hours
|
16
18
|
|
@@ -20,14 +22,14 @@ class Activity < ActiveRecord::Base
|
|
20
22
|
|
21
23
|
def calculate_hours
|
22
24
|
unless hours.empty? or minutes.empty?
|
23
|
-
self.
|
24
|
-
self.
|
25
|
+
self.duration_from = DateTime.now
|
26
|
+
self.duration_to = self.duration_from + hours.to_i.hours + minutes.to_i.minutes
|
25
27
|
end
|
26
28
|
end
|
27
29
|
|
28
30
|
# The duration of the task in minutes
|
29
31
|
def duration
|
30
|
-
minutes = (
|
32
|
+
minutes = (duration_to.to_f - duration_from.to_f).to_i / 60
|
31
33
|
|
32
34
|
minutes < 0 ? 1.day.to_i + minutes : minutes
|
33
35
|
end
|
data/app/models/work_day.rb
CHANGED
@@ -0,0 +1,7 @@
|
|
1
|
+
%tr[activity]
|
2
|
+
%td= activity.person
|
3
|
+
%td= link_to activity.date, activity, {'data-href-container' => 'tr'}
|
4
|
+
%td= t('bookyt.projects.minutes', :duration => activity.duration)
|
5
|
+
%td.action-links
|
6
|
+
= list_link_for(:edit, activity, :remote => true)
|
7
|
+
= list_link_for(:delete, activity)
|
@@ -3,9 +3,9 @@
|
|
3
3
|
= f.input :project, :as => :combobox
|
4
4
|
= f.input :person, :as => :combobox
|
5
5
|
= f.inputs do
|
6
|
-
= f.input :
|
7
|
-
= f.input :
|
8
|
-
= f.input :
|
6
|
+
= f.input :date, :as => :date_field, :required => true
|
7
|
+
= f.input :duration_from, :as => :hour_field
|
8
|
+
= f.input :duration_to, :as => :hour_field
|
9
9
|
= f.input :hours
|
10
10
|
= f.input :minutes
|
11
11
|
= f.inputs do
|
@@ -1,14 +1,7 @@
|
|
1
1
|
%table.list#activities_list
|
2
2
|
%tr
|
3
|
-
- [:person, :
|
3
|
+
- [:person, :date, :duration].each do |attr|
|
4
4
|
%th= t_attr(attr, Activity)
|
5
5
|
%th.action-links
|
6
6
|
|
7
|
-
|
8
|
-
%tr
|
9
|
-
%td= task.person
|
10
|
-
%td= link_to task.when, task, {'data-href-container' => 'tr'}
|
11
|
-
%td= t('bookyt.projects.minutes', :duration => task.duration)
|
12
|
-
%td.action-links
|
13
|
-
= list_link_for(:edit, task)
|
14
|
-
= list_link_for(:delete, task)
|
7
|
+
= render collection
|
@@ -3,8 +3,8 @@
|
|
3
3
|
= f.inputs do
|
4
4
|
= f.input :name, :input_html => {'data-autofocus' => 'true'}
|
5
5
|
= f.input :comment, :input_html => {:rows => 5}
|
6
|
-
= f.input :
|
7
|
-
= f.input :
|
6
|
+
= f.input :duration_from, :as => :date_field
|
7
|
+
= f.input :duration_to, :as => :date_field
|
8
8
|
= f.input :project_state
|
9
9
|
= f.input :client, :as => :combobox
|
10
10
|
= f.buttons do
|
@@ -1,13 +1,16 @@
|
|
1
|
+
.contextual
|
2
|
+
= contextual_link_to :new, Activity
|
3
|
+
|
1
4
|
%h1= t_title
|
2
5
|
|
3
6
|
%table.list
|
4
7
|
%tr
|
5
8
|
%th Datum
|
6
9
|
%th Wochentag
|
7
|
-
%th Soll-Stunden
|
8
|
-
%th Stunden
|
9
|
-
%th Über-/Unterzeit
|
10
|
-
%th Saldo
|
10
|
+
%th.number Soll-Stunden
|
11
|
+
%th.number Stunden
|
12
|
+
%th.number Über-/Unterzeit
|
13
|
+
%th.number Saldo
|
11
14
|
|
12
15
|
- overall_overtime = 0
|
13
16
|
- @work_days.each do |day|
|
@@ -15,7 +18,7 @@
|
|
15
18
|
%tr
|
16
19
|
%td= day.date
|
17
20
|
%td= l(day.date, :format => '%A')
|
18
|
-
%td= day.hours_due
|
19
|
-
%td= day.hours_worked
|
20
|
-
%td= day.overtime
|
21
|
-
%td= overall_overtime
|
21
|
+
%td.number= day.hours_due
|
22
|
+
%td.number= day.hours_worked
|
23
|
+
%td.number= day.overtime
|
24
|
+
%td.number= overall_overtime
|
data/config/locales/de.yml
CHANGED
@@ -9,8 +9,8 @@ de:
|
|
9
9
|
project:
|
10
10
|
name: Bezeichnung
|
11
11
|
comment: Kommentar
|
12
|
-
|
13
|
-
|
12
|
+
duration_from: Begin
|
13
|
+
duration_to: Ende
|
14
14
|
project_state: Status
|
15
15
|
project_state_id: Status
|
16
16
|
client: Kunde
|
@@ -20,9 +20,9 @@ de:
|
|
20
20
|
activity:
|
21
21
|
person: Person
|
22
22
|
person_id: Person
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
date: Datum
|
24
|
+
duration_from: Von
|
25
|
+
duration_to: Bis
|
26
26
|
duration: Dauer
|
27
27
|
hours: Stunden
|
28
28
|
minutes: Minuten
|
@@ -0,0 +1,10 @@
|
|
1
|
+
class RenameDurationColumnsInProjectsAndActivities < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
rename_column :activities, :when, :date
|
4
|
+
rename_column :activities, :from, :duration_from
|
5
|
+
rename_column :activities, :to, :duration_to
|
6
|
+
|
7
|
+
rename_column :projects, :from, :duration_from
|
8
|
+
rename_column :projects, :to, :duration_to
|
9
|
+
end
|
10
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bookyt_projects
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 51
|
5
|
+
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 11
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.11.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Roman Simecek (CyT)
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-10-
|
19
|
+
date: 2011-10-29 00:00:00 +02:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -109,10 +109,11 @@ files:
|
|
109
109
|
- app/controllers/projects_controller.rb
|
110
110
|
- app/controllers/timesheets_controller.rb
|
111
111
|
- app/models/activity.rb
|
112
|
-
- app/models/bookyt_projects/
|
112
|
+
- app/models/bookyt_projects/person.rb
|
113
113
|
- app/models/project.rb
|
114
114
|
- app/models/project_state.rb
|
115
115
|
- app/models/work_day.rb
|
116
|
+
- app/views/activities/_activity.html.haml
|
116
117
|
- app/views/activities/_form.html.haml
|
117
118
|
- app/views/activities/_list.html.haml
|
118
119
|
- app/views/project_states/_form.html.haml
|
@@ -124,6 +125,11 @@ files:
|
|
124
125
|
- config/boot.rb
|
125
126
|
- config/locales/de.yml
|
126
127
|
- config/routes.rb
|
128
|
+
- db/migrate/20110909075128_create_project_states.rb
|
129
|
+
- db/migrate/20110909075220_create_projects.rb
|
130
|
+
- db/migrate/20110912071440_create_tasks.rb
|
131
|
+
- db/migrate/20111010114218_rename_task_to_activity.rb
|
132
|
+
- db/migrate/20111025090501_rename_duration_columns_in_projects_and_activities.rb
|
127
133
|
- lib/bookyt_projects.rb
|
128
134
|
- lib/bookyt_projects/navigation.rb
|
129
135
|
- lib/bookyt_projects/railtie.rb
|
@@ -160,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
160
166
|
requirements: []
|
161
167
|
|
162
168
|
rubyforge_project:
|
163
|
-
rubygems_version: 1.
|
169
|
+
rubygems_version: 1.3.7
|
164
170
|
signing_key:
|
165
171
|
specification_version: 3
|
166
172
|
summary: Project management plugin for bookyt
|