bookyt_projects 0.12.0 → 0.13.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 +1 -1
- data/app/controllers/batch_activities_controller.rb +1 -1
- data/app/models/activity.rb +9 -24
- data/app/models/bookyt_projects/person.rb +1 -1
- data/app/views/activities/_activity.html.haml +1 -1
- data/app/views/activities/_form.html.haml +8 -11
- data/app/views/batch_activities/_form.html.haml +3 -3
- data/app/views/projects/_form.html.haml +1 -1
- data/app/views/timesheets/_activities_popover.html.haml +2 -2
- data/app/views/timesheets/_show.html.haml +5 -5
- data/config/locales/bookyt_projects.de.yml +1 -1
- data/db/migrate/20120117070747_rename_comment_columns_to_remarks.rb +15 -0
- data/db/migrate/20120117075541_use_single_duration_field.rb +8 -0
- data/db/migrate/20120117080212_use_decimal_for_activity_duration.rb +8 -0
- data/lib/bookyt_projects/version.rb +1 -1
- metadata +9 -5
@@ -17,7 +17,7 @@ class ActivitiesController < AuthorizedController
|
|
17
17
|
|
18
18
|
# Educated guessing of project
|
19
19
|
@activity.project_id ||= params[:project_id] if params[:project_id]
|
20
|
-
@activity.project_id ||= @activity.person.activities.order(:
|
20
|
+
@activity.project_id ||= @activity.person.activities.order(:date).last
|
21
21
|
|
22
22
|
new!
|
23
23
|
end
|
@@ -14,7 +14,7 @@ class BatchActivitiesController < ApplicationController
|
|
14
14
|
def create
|
15
15
|
date = Date.parse(params[:batch_activities][:date])
|
16
16
|
@activites = params[:activities].collect{|activity_params|
|
17
|
-
Activity.create(activity_params.merge(:date => date
|
17
|
+
Activity.create(activity_params.merge(:date => date))
|
18
18
|
}
|
19
19
|
|
20
20
|
redirect_to activities_path(:by_date => date.to_s(:db))
|
data/app/models/activity.rb
CHANGED
@@ -9,35 +9,20 @@ class Activity < ActiveRecord::Base
|
|
9
9
|
scope :by_date, lambda {|value| where(:date => value)}
|
10
10
|
|
11
11
|
# Duration
|
12
|
-
|
12
|
+
validates :duration, :presence => true, :format => {:with => /[0-9]{1,2}([:.][0-9]{1,2})/}
|
13
13
|
|
14
14
|
validates_date :date, :allow_nil => false, :allow_blank => false
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
def hours_minutes
|
23
|
-
minutes || hours
|
24
|
-
end
|
25
|
-
|
26
|
-
def calculate_hours
|
27
|
-
unless hours.empty? or minutes.empty?
|
28
|
-
self.duration_from = DateTime.now
|
29
|
-
self.duration_to = self.duration_from + hours.to_i.hours + minutes.to_i.minutes
|
15
|
+
|
16
|
+
def duration=(value)
|
17
|
+
if value.match(/:/)
|
18
|
+
hours, minutes = value.split(':')
|
19
|
+
write_attribute(:duration, hours.to_i + BigDecimal.new(minutes) / 60)
|
20
|
+
else
|
21
|
+
write_attribute(:duration, value)
|
30
22
|
end
|
31
23
|
end
|
32
|
-
|
33
|
-
# The duration of the task in minutes
|
34
|
-
def duration
|
35
|
-
minutes = (duration_to.to_f - duration_from.to_f).to_i / 60
|
36
|
-
|
37
|
-
minutes < 0 ? 1.day.to_i + minutes : minutes
|
38
|
-
end
|
39
24
|
|
40
25
|
def to_s
|
41
|
-
"
|
26
|
+
"%s: %0.2fh" % [project.name, duration]
|
42
27
|
end
|
43
28
|
end
|
@@ -1,17 +1,14 @@
|
|
1
1
|
= semantic_form_for @activity do |f|
|
2
2
|
= f.inputs do
|
3
|
-
|
4
|
-
|
3
|
+
.row
|
4
|
+
.span8= f.input :person, :as => :combobox
|
5
|
+
.span8= f.input :project, :as => :combobox
|
6
|
+
.row
|
7
|
+
.span8= f.input :date, :as => :date_field
|
8
|
+
.span8= f.input :duration, :as => :string
|
5
9
|
|
6
|
-
|
7
|
-
|
8
|
-
= f.input :duration_from, :as => :hour_field
|
9
|
-
= f.input :duration_to, :as => :hour_field
|
10
|
-
= f.input :hours
|
11
|
-
= f.input :minutes
|
12
|
-
|
13
|
-
= f.inputs do
|
14
|
-
= f.input :comment
|
10
|
+
.row
|
11
|
+
.span16= f.input :remarks, :input_html => {:rows => 2, :class => 'span12'}
|
15
12
|
|
16
13
|
= f.buttons do
|
17
14
|
= f.commit_button
|
@@ -8,7 +8,7 @@
|
|
8
8
|
%th= t_attr :person, Activity
|
9
9
|
%th= t_attr :project, Activity
|
10
10
|
%th{:style => 'width: 5em'}= t_attr :duration, Activity
|
11
|
-
%th= t_attr :
|
11
|
+
%th= t_attr :remarks, Activity
|
12
12
|
|
13
13
|
%tbody
|
14
14
|
- for activity in @activities
|
@@ -18,8 +18,8 @@
|
|
18
18
|
= link_to activity.person, activity.person
|
19
19
|
= a.hidden_field :person_id
|
20
20
|
%td= a.select :project_id, Project.all.map{|project| [project.to_s, project.id]}, {:prompt => t_select_prompt(Project)}
|
21
|
-
%td= a.text_field :
|
22
|
-
%td= a.text_field :
|
21
|
+
%td= a.text_field :duration
|
22
|
+
%td= a.text_field :remarks
|
23
23
|
|
24
24
|
= f.buttons do
|
25
25
|
= f.commit_button
|
@@ -1,3 +1,3 @@
|
|
1
1
|
- activities.each do |activity|
|
2
|
-
%h4=
|
3
|
-
%p= activity.
|
2
|
+
%h4= activity.to_s
|
3
|
+
%p= activity.remarks
|
@@ -10,11 +10,11 @@
|
|
10
10
|
- overall_overtime += day.overtime
|
11
11
|
- activities = @employee.activities.where(:date => day.date)
|
12
12
|
- tr_params = {:class => work_day_classes(day)}
|
13
|
-
- tr_params.merge!(:rel => 'popover', 'data-content' => h(render 'activities_popover', :activities => activities), 'data-original-title' => 'Aktivitäten', 'data-html' => 'true') unless activities.empty?
|
13
|
+
- tr_params.merge!(:rel => 'popover', 'data-content' => h(render 'timesheets/activities_popover', :activities => activities), 'data-original-title' => 'Aktivitäten', 'data-html' => 'true') unless activities.empty?
|
14
14
|
%tr{tr_params}
|
15
15
|
%td= link_to l(day.date, :format => '%a, %d.%m.%Y'), person_activities_path(@employee, :by_date => day.date.to_s(:db)), 'data-href-container' => 'tr'
|
16
16
|
%td.number
|
17
|
-
%span.strong= "%0.
|
18
|
-
= "(%0.
|
19
|
-
%td.number.overtime.strong= day.overtime
|
20
|
-
%td.number.overall-overtime.strong= overall_overtime
|
17
|
+
%span.strong= "%0.2f" % day.hours_worked
|
18
|
+
= "(%0.2f)" % day.hours_due
|
19
|
+
%td.number.overtime.strong= "%0.2f" % day.overtime
|
20
|
+
%td.number.overall-overtime.strong= "%0.2f" % overall_overtime
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class RenameCommentColumnsToRemarks < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
rename_column :projects, :comment, :remarks
|
4
|
+
rename_column :activities, :comment, :remarks
|
5
|
+
|
6
|
+
change_column :activities, :remarks, :text
|
7
|
+
end
|
8
|
+
|
9
|
+
def down
|
10
|
+
change_column :activities, :remarks, :string
|
11
|
+
|
12
|
+
rename_column :projects, :remarks, :comment
|
13
|
+
rename_column :activities, :remarks, :comment
|
14
|
+
end
|
15
|
+
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:
|
4
|
+
hash: 43
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 13
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.13.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: 2012-01-
|
19
|
+
date: 2012-01-17 00:00:00 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: rails
|
@@ -139,6 +139,9 @@ files:
|
|
139
139
|
- db/migrate/20110912071440_create_tasks.rb
|
140
140
|
- db/migrate/20111010114218_rename_task_to_activity.rb
|
141
141
|
- db/migrate/20111025090501_rename_duration_columns_in_projects_and_activities.rb
|
142
|
+
- db/migrate/20120117070747_rename_comment_columns_to_remarks.rb
|
143
|
+
- db/migrate/20120117075541_use_single_duration_field.rb
|
144
|
+
- db/migrate/20120117080212_use_decimal_for_activity_duration.rb
|
142
145
|
- lib/bookyt_projects.rb
|
143
146
|
- lib/bookyt_projects/navigation.rb
|
144
147
|
- lib/bookyt_projects/railtie.rb
|
@@ -174,9 +177,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
174
177
|
requirements: []
|
175
178
|
|
176
179
|
rubyforge_project:
|
177
|
-
rubygems_version: 1.8.
|
180
|
+
rubygems_version: 1.8.10
|
178
181
|
signing_key:
|
179
182
|
specification_version: 3
|
180
183
|
summary: Project management plugin for bookyt
|
181
184
|
test_files: []
|
182
185
|
|
186
|
+
has_rdoc:
|