backlog 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +10 -0
- data/Rakefile +2 -1
- data/app/controllers/application.rb +55 -8
- data/app/controllers/groups_controller.rb +62 -0
- data/app/controllers/periods_controller.rb +13 -55
- data/app/controllers/tasks_controller.rb +9 -5
- data/app/controllers/works_controller.rb +43 -6
- data/app/helpers/application_helper.rb +20 -2
- data/app/helpers/groups_helper.rb +2 -0
- data/app/models/backlog.rb +19 -10
- data/app/models/estimate.rb +2 -1
- data/app/models/group.rb +11 -0
- data/app/models/party.rb +3 -0
- data/app/models/period.rb +43 -6
- data/app/models/task.rb +27 -14
- data/app/models/user.rb +37 -8
- data/app/models/work.rb +4 -6
- data/app/views/backlogs/_name_list.rhtml +5 -0
- data/app/views/backlogs/show.rhtml +4 -4
- data/app/views/groups/_form.rhtml +7 -0
- data/app/views/groups/edit.rhtml +31 -0
- data/app/views/groups/list.rhtml +27 -0
- data/app/views/groups/new.rhtml +8 -0
- data/app/views/layouts/wide.rhtml +2 -2
- data/app/views/periods/_burn_down_chart.rhtml +1 -1
- data/app/views/periods/_form.rhtml +13 -9
- data/app/views/periods/_show_active.rhtml +6 -12
- data/app/views/periods/_title.rhtml +4 -5
- data/app/views/periods/edit.rhtml +1 -1
- data/app/views/periods/new.rhtml +1 -1
- data/app/views/periods/show.rhtml +10 -6
- data/app/views/tasks/_backlog_header.rhtml +22 -0
- data/app/views/tasks/_description_list.rhtml +5 -0
- data/app/views/tasks/_form.rhtml +26 -7
- data/app/views/tasks/_task.rhtml +4 -4
- data/app/views/tasks/edit.rhtml +2 -3
- data/app/views/tasks/list_started.rhtml +1 -0
- data/app/views/tasks/new.rhtml +2 -2
- data/app/views/works/_buttons.rhtml +3 -0
- data/app/views/works/_form.rhtml +15 -10
- data/app/views/works/daily_work_sheet.rhtml +30 -18
- data/app/views/works/edit.rhtml +4 -4
- data/app/views/works/list.rhtml +2 -2
- data/app/views/works/new.rhtml +3 -2
- data/app/views/works/weekly_work_sheet.rhtml +2 -2
- data/bin/backlog +2 -0
- data/bin/backlog_init.d_kubosch_production +27 -0
- data/bin/copy_production2development.rb +33 -0
- data/config/database.yml +13 -7
- data/config/deploy_kubosch.rb +1 -0
- data/config/environment.rb +2 -0
- data/config/environments/development_mysql.rb +27 -0
- data/config/environments/kubosch_production_mysql.rb +21 -0
- data/config/routes.rb +1 -1
- data/db/migrate/{001_tasks.rb → 001_create_tasks.rb} +1 -1
- data/db/migrate/{002_backlogs.rb → 002_create_backlogs.rb} +2 -2
- data/db/migrate/003_add_estimation_points.rb +1 -1
- data/db/migrate/004_add_period.rb +2 -2
- data/db/migrate/013_create_estimates.rb +1 -1
- data/db/migrate/015_add_user_option.rb +9 -5
- data/db/migrate/017_insert_datek_projects.rb +13 -10
- data/db/migrate/018_create_groups.rb +115 -0
- data/db/schema.rb +72 -12
- data/lang/en.yaml +7 -0
- data/lang/no.yaml +7 -0
- data/lib/big_decimal_yaml_fix.rb +27 -0
- data/lib/class_table_inheritance.rb +163 -0
- data/lib/tasks/backup.rake +92 -0
- data/public/images/person.org.png +0 -0
- data/public/images/person.png +0 -0
- data/public/stylesheets/backlog.css +3 -1
- data/public/stylesheets/mwrt002.css +1 -1
- data/test/fixtures/groups.yml +6 -0
- data/test/fixtures/parties.yml +31 -0
- data/test/fixtures/periods.yml +2 -2
- data/test/fixtures/tasks.yml +2 -0
- data/test/fixtures/users.yml +6 -6
- data/test/functional/backlogs_controller_test.rb +1 -1
- data/test/functional/groups_controller_test.rb +120 -0
- data/test/functional/periods_controller_test.rb +1 -1
- data/test/functional/tasks_controller_test.rb +16 -1
- data/test/functional/user_controller_test.rb +8 -2
- data/test/test_helper.rb +5 -0
- data/test/unit/big_decimal_yaml_fix_test.rb +14 -0
- data/test/unit/estimate_test.rb +1 -1
- data/test/unit/group_test.rb +10 -0
- data/test/unit/user_test.rb +56 -44
- data/tmp/sessions/ruby_sess.22dec3e9df47fb4e +0 -0
- data/tmp/sessions/ruby_sess.8037e0ab58cbcf1a +0 -0
- data/vendor/plugins/activerecord_foreign_key_extensions/lib/active_record_extensions.rb +35 -0
- data/vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.rhtml.bak +1 -0
- data/vendor/rails/{actionwebservice/lib/action_web_service/templates/scaffolds/layout.rhtml → railties/configs/empty.log} +0 -0
- metadata +36 -105
- data/backlog.gemspec +0 -21
- data/vendor/rails/actionwebservice/CHANGELOG +0 -265
- data/vendor/rails/actionwebservice/MIT-LICENSE +0 -21
- data/vendor/rails/actionwebservice/README +0 -364
- data/vendor/rails/actionwebservice/Rakefile +0 -171
- data/vendor/rails/actionwebservice/TODO +0 -32
- data/vendor/rails/actionwebservice/examples/googlesearch/README +0 -143
- data/vendor/rails/actionwebservice/examples/googlesearch/autoloading/google_search_api.rb +0 -50
- data/vendor/rails/actionwebservice/examples/googlesearch/autoloading/google_search_controller.rb +0 -57
- data/vendor/rails/actionwebservice/examples/googlesearch/delegated/google_search_service.rb +0 -108
- data/vendor/rails/actionwebservice/examples/googlesearch/delegated/search_controller.rb +0 -7
- data/vendor/rails/actionwebservice/examples/googlesearch/direct/google_search_api.rb +0 -50
- data/vendor/rails/actionwebservice/examples/googlesearch/direct/search_controller.rb +0 -58
- data/vendor/rails/actionwebservice/examples/metaWeblog/README +0 -17
- data/vendor/rails/actionwebservice/examples/metaWeblog/apis/blogger_api.rb +0 -60
- data/vendor/rails/actionwebservice/examples/metaWeblog/apis/blogger_service.rb +0 -34
- data/vendor/rails/actionwebservice/examples/metaWeblog/apis/meta_weblog_api.rb +0 -67
- data/vendor/rails/actionwebservice/examples/metaWeblog/apis/meta_weblog_service.rb +0 -48
- data/vendor/rails/actionwebservice/examples/metaWeblog/controllers/xmlrpc_controller.rb +0 -16
- data/vendor/rails/actionwebservice/install.rb +0 -30
- data/vendor/rails/actionwebservice/lib/action_web_service.rb +0 -66
- data/vendor/rails/actionwebservice/lib/action_web_service/api.rb +0 -301
- data/vendor/rails/actionwebservice/lib/action_web_service/base.rb +0 -42
- data/vendor/rails/actionwebservice/lib/action_web_service/casting.rb +0 -138
- data/vendor/rails/actionwebservice/lib/action_web_service/client.rb +0 -3
- data/vendor/rails/actionwebservice/lib/action_web_service/client/base.rb +0 -28
- data/vendor/rails/actionwebservice/lib/action_web_service/client/soap_client.rb +0 -113
- data/vendor/rails/actionwebservice/lib/action_web_service/client/xmlrpc_client.rb +0 -58
- data/vendor/rails/actionwebservice/lib/action_web_service/container.rb +0 -3
- data/vendor/rails/actionwebservice/lib/action_web_service/container/action_controller_container.rb +0 -93
- data/vendor/rails/actionwebservice/lib/action_web_service/container/delegated_container.rb +0 -86
- data/vendor/rails/actionwebservice/lib/action_web_service/container/direct_container.rb +0 -69
- data/vendor/rails/actionwebservice/lib/action_web_service/dispatcher.rb +0 -2
- data/vendor/rails/actionwebservice/lib/action_web_service/dispatcher/abstract.rb +0 -207
- data/vendor/rails/actionwebservice/lib/action_web_service/dispatcher/action_controller_dispatcher.rb +0 -379
- data/vendor/rails/actionwebservice/lib/action_web_service/invocation.rb +0 -202
- data/vendor/rails/actionwebservice/lib/action_web_service/protocol.rb +0 -4
- data/vendor/rails/actionwebservice/lib/action_web_service/protocol/abstract.rb +0 -112
- data/vendor/rails/actionwebservice/lib/action_web_service/protocol/discovery.rb +0 -37
- data/vendor/rails/actionwebservice/lib/action_web_service/protocol/soap_protocol.rb +0 -176
- data/vendor/rails/actionwebservice/lib/action_web_service/protocol/soap_protocol/marshaler.rb +0 -235
- data/vendor/rails/actionwebservice/lib/action_web_service/protocol/xmlrpc_protocol.rb +0 -122
- data/vendor/rails/actionwebservice/lib/action_web_service/scaffolding.rb +0 -283
- data/vendor/rails/actionwebservice/lib/action_web_service/struct.rb +0 -68
- data/vendor/rails/actionwebservice/lib/action_web_service/support/class_inheritable_options.rb +0 -26
- data/vendor/rails/actionwebservice/lib/action_web_service/support/signature_types.rb +0 -226
- data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/layout.erb +0 -65
- data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/methods.erb +0 -6
- data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/methods.rhtml +0 -0
- data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/parameters.erb +0 -29
- data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/parameters.rhtml +0 -0
- data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/result.erb +0 -30
- data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/result.rhtml +0 -0
- data/vendor/rails/actionwebservice/lib/action_web_service/test_invoke.rb +0 -110
- data/vendor/rails/actionwebservice/lib/action_web_service/version.rb +0 -9
- data/vendor/rails/actionwebservice/setup.rb +0 -1379
- data/vendor/rails/actionwebservice/test/abstract_client.rb +0 -183
- data/vendor/rails/actionwebservice/test/abstract_dispatcher.rb +0 -551
- data/vendor/rails/actionwebservice/test/abstract_unit.rb +0 -45
- data/vendor/rails/actionwebservice/test/api_test.rb +0 -102
- data/vendor/rails/actionwebservice/test/apis/auto_load_api.rb +0 -3
- data/vendor/rails/actionwebservice/test/apis/broken_auto_load_api.rb +0 -2
- data/vendor/rails/actionwebservice/test/base_test.rb +0 -42
- data/vendor/rails/actionwebservice/test/casting_test.rb +0 -86
- data/vendor/rails/actionwebservice/test/client_soap_test.rb +0 -153
- data/vendor/rails/actionwebservice/test/client_xmlrpc_test.rb +0 -152
- data/vendor/rails/actionwebservice/test/container_test.rb +0 -73
- data/vendor/rails/actionwebservice/test/dispatcher_action_controller_soap_test.rb +0 -137
- data/vendor/rails/actionwebservice/test/dispatcher_action_controller_xmlrpc_test.rb +0 -59
- data/vendor/rails/actionwebservice/test/fixtures/db_definitions/mysql.sql +0 -8
- data/vendor/rails/actionwebservice/test/fixtures/users.yml +0 -12
- data/vendor/rails/actionwebservice/test/gencov +0 -3
- data/vendor/rails/actionwebservice/test/invocation_test.rb +0 -185
- data/vendor/rails/actionwebservice/test/run +0 -6
- data/vendor/rails/actionwebservice/test/scaffolded_controller_test.rb +0 -146
- data/vendor/rails/actionwebservice/test/struct_test.rb +0 -52
- data/vendor/rails/actionwebservice/test/test_invoke_test.rb +0 -112
data/db/schema.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# migrations feature of ActiveRecord to incrementally modify your database, and
|
3
3
|
# then regenerate this schema definition.
|
4
4
|
|
5
|
-
ActiveRecord::Schema.define(:version =>
|
5
|
+
ActiveRecord::Schema.define(:version => 18) do
|
6
6
|
|
7
7
|
create_table "backlogs", :force => true do |t|
|
8
8
|
t.string "name", :limit => 64, :null => false
|
@@ -22,13 +22,30 @@ ActiveRecord::Schema.define(:version => 17) do
|
|
22
22
|
t.integer "user_id"
|
23
23
|
end
|
24
24
|
|
25
|
+
create_table "groups", :primary_key => "party_id", :force => true do |t|
|
26
|
+
t.string "name", :null => false
|
27
|
+
end
|
28
|
+
|
29
|
+
create_table "groups_users", :id => false, :force => true do |t|
|
30
|
+
t.integer "group_id", :null => false
|
31
|
+
t.integer "user_id", :null => false
|
32
|
+
end
|
33
|
+
|
34
|
+
add_index "groups_users", ["group_id", "user_id"], :name => "index_groups_users_on_group_id_and_user_id", :unique => true
|
35
|
+
|
36
|
+
create_table "parties", :force => true do |t|
|
37
|
+
t.string "type"
|
38
|
+
end
|
39
|
+
|
25
40
|
create_table "periods", :force => true do |t|
|
26
|
-
t.integer "
|
27
|
-
t.
|
28
|
-
t.date "
|
29
|
-
t.
|
41
|
+
t.integer "position", :null => false
|
42
|
+
t.date "start_on", :null => false
|
43
|
+
t.date "end_on", :null => false
|
44
|
+
t.integer "party_id"
|
30
45
|
end
|
31
46
|
|
47
|
+
add_index "periods", ["position", "party_id"], :name => "index_periods_on_party_id_and_position", :unique => true
|
48
|
+
|
32
49
|
create_table "tasks", :force => true do |t|
|
33
50
|
t.integer "position"
|
34
51
|
t.string "description", :limit => 80, :null => false
|
@@ -40,9 +57,10 @@ ActiveRecord::Schema.define(:version => 17) do
|
|
40
57
|
t.string "resolution", :limit => 16
|
41
58
|
t.integer "previous_task_id"
|
42
59
|
t.string "customer", :limit => 64
|
60
|
+
t.integer "backlog_id"
|
43
61
|
end
|
44
62
|
|
45
|
-
create_table "users", :force => true do |t|
|
63
|
+
create_table "users", :primary_key => "party_id", :force => true do |t|
|
46
64
|
t.string "login", :limit => 80, :null => false
|
47
65
|
t.string "salted_password", :limit => 40, :null => false
|
48
66
|
t.string "email", :limit => 60, :null => false
|
@@ -66,27 +84,69 @@ ActiveRecord::Schema.define(:version => 17) do
|
|
66
84
|
end
|
67
85
|
|
68
86
|
add_foreign_key_constraint "estimates", "task_id", "tasks", "id", :name => "estimates_task_id_fkey", :on_update => nil, :on_delete => nil
|
69
|
-
add_foreign_key_constraint "estimates", "user_id", "users", "
|
87
|
+
add_foreign_key_constraint "estimates", "user_id", "users", "party_id", :name => "estimates_user_id_fkey", :on_update => nil, :on_delete => nil
|
88
|
+
add_foreign_key_constraint "estimates", "task_id", "tasks", "id", :name => "estimates_task_id_fkey1", :on_update => nil, :on_delete => nil
|
89
|
+
add_foreign_key_constraint "estimates", "user_id", "users", "party_id", :name => "estimates_user_id_fkey1", :on_update => nil, :on_delete => nil
|
90
|
+
|
91
|
+
add_foreign_key_constraint "groups", "party_id", "parties", "id", :name => "groups_party_id_fkey", :on_update => nil, :on_delete => nil
|
92
|
+
add_foreign_key_constraint "groups", "party_id", "parties", "id", :name => "groups_party_id_fkey1", :on_update => nil, :on_delete => nil
|
93
|
+
|
94
|
+
add_foreign_key_constraint "groups_users", "group_id", "groups", "party_id", :name => "groups_users_group_id_fkey", :on_update => nil, :on_delete => nil
|
95
|
+
add_foreign_key_constraint "groups_users", "user_id", "users", "party_id", :name => "groups_users_user_id_fkey", :on_update => nil, :on_delete => nil
|
96
|
+
add_foreign_key_constraint "groups_users", "group_id", "groups", "party_id", :name => "groups_users_group_id_fkey1", :on_update => nil, :on_delete => nil
|
97
|
+
add_foreign_key_constraint "groups_users", "user_id", "users", "party_id", :name => "groups_users_user_id_fkey1", :on_update => nil, :on_delete => nil
|
70
98
|
|
71
|
-
add_foreign_key_constraint "periods", "
|
99
|
+
add_foreign_key_constraint "periods", "party_id", "parties", "id", :name => "periods_party_id_fkey", :on_update => nil, :on_delete => nil
|
100
|
+
add_foreign_key_constraint "periods", "party_id", "parties", "id", :name => "periods_party_id_fkey1", :on_update => nil, :on_delete => nil
|
72
101
|
|
73
102
|
add_foreign_key_constraint "tasks", "period_id", "periods", "id", :name => "tasks_period_id_fkey", :on_update => nil, :on_delete => nil
|
74
103
|
add_foreign_key_constraint "tasks", "parent_id", "tasks", "id", :name => "tasks_parent_id_fkey", :on_update => nil, :on_delete => nil
|
75
104
|
add_foreign_key_constraint "tasks", "previous_task_id", "tasks", "id", :name => "tasks_previous_task_id_fkey", :on_update => nil, :on_delete => nil
|
105
|
+
add_foreign_key_constraint "tasks", "backlog_id", "backlogs", "id", :name => "tasks_backlog_id_fkey", :on_update => nil, :on_delete => nil
|
106
|
+
add_foreign_key_constraint "tasks", "period_id", "periods", "id", :name => "tasks_period_id_fkey1", :on_update => nil, :on_delete => nil
|
107
|
+
add_foreign_key_constraint "tasks", "parent_id", "tasks", "id", :name => "tasks_parent_id_fkey1", :on_update => nil, :on_delete => nil
|
108
|
+
add_foreign_key_constraint "tasks", "previous_task_id", "tasks", "id", :name => "tasks_previous_task_id_fkey1", :on_update => nil, :on_delete => nil
|
109
|
+
add_foreign_key_constraint "tasks", "backlog_id", "backlogs", "id", :name => "tasks_backlog_id_fkey1", :on_update => nil, :on_delete => nil
|
110
|
+
|
111
|
+
add_foreign_key_constraint "users", "party_id", "parties", "id", :name => "users_party_id_fkey", :on_update => nil, :on_delete => nil
|
112
|
+
add_foreign_key_constraint "users", "party_id", "parties", "id", :name => "users_party_id_fkey1", :on_update => nil, :on_delete => nil
|
76
113
|
|
77
114
|
add_foreign_key_constraint "works", "task_id", "tasks", "id", :name => "works_task_id_fkey", :on_update => nil, :on_delete => nil
|
78
|
-
add_foreign_key_constraint "works", "user_id", "users", "
|
115
|
+
add_foreign_key_constraint "works", "user_id", "users", "party_id", :name => "works_user_id_fkey", :on_update => nil, :on_delete => nil
|
116
|
+
add_foreign_key_constraint "works", "task_id", "tasks", "id", :name => "works_task_id_fkey1", :on_update => nil, :on_delete => nil
|
117
|
+
add_foreign_key_constraint "works", "user_id", "users", "party_id", :name => "works_user_id_fkey1", :on_update => nil, :on_delete => nil
|
79
118
|
|
80
119
|
add_foreign_key "estimates", ["task_id"], "tasks", ["id"]
|
81
|
-
add_foreign_key "estimates", ["user_id"], "users", ["
|
120
|
+
add_foreign_key "estimates", ["user_id"], "users", ["party_id"]
|
121
|
+
add_foreign_key "estimates", ["task_id"], "tasks", ["id"]
|
122
|
+
add_foreign_key "estimates", ["user_id"], "users", ["party_id"]
|
123
|
+
|
124
|
+
add_foreign_key "groups", ["party_id"], "parties", ["id"]
|
125
|
+
add_foreign_key "groups", ["party_id"], "parties", ["id"]
|
82
126
|
|
83
|
-
add_foreign_key "
|
127
|
+
add_foreign_key "groups_users", ["group_id"], "groups", ["party_id"]
|
128
|
+
add_foreign_key "groups_users", ["user_id"], "users", ["party_id"]
|
129
|
+
add_foreign_key "groups_users", ["group_id"], "groups", ["party_id"]
|
130
|
+
add_foreign_key "groups_users", ["user_id"], "users", ["party_id"]
|
131
|
+
|
132
|
+
add_foreign_key "periods", ["party_id"], "parties", ["id"]
|
133
|
+
add_foreign_key "periods", ["party_id"], "parties", ["id"]
|
84
134
|
|
85
135
|
add_foreign_key "tasks", ["period_id"], "periods", ["id"]
|
86
136
|
add_foreign_key "tasks", ["parent_id"], "tasks", ["id"]
|
87
137
|
add_foreign_key "tasks", ["previous_task_id"], "tasks", ["id"]
|
138
|
+
add_foreign_key "tasks", ["backlog_id"], "backlogs", ["id"]
|
139
|
+
add_foreign_key "tasks", ["period_id"], "periods", ["id"]
|
140
|
+
add_foreign_key "tasks", ["parent_id"], "tasks", ["id"]
|
141
|
+
add_foreign_key "tasks", ["previous_task_id"], "tasks", ["id"]
|
142
|
+
add_foreign_key "tasks", ["backlog_id"], "backlogs", ["id"]
|
88
143
|
|
144
|
+
add_foreign_key "users", ["party_id"], "parties", ["id"]
|
145
|
+
add_foreign_key "users", ["party_id"], "parties", ["id"]
|
146
|
+
|
147
|
+
add_foreign_key "works", ["task_id"], "tasks", ["id"]
|
148
|
+
add_foreign_key "works", ["user_id"], "users", ["party_id"]
|
89
149
|
add_foreign_key "works", ["task_id"], "tasks", ["id"]
|
90
|
-
add_foreign_key "works", ["user_id"], "users", ["
|
150
|
+
add_foreign_key "works", ["user_id"], "users", ["party_id"]
|
91
151
|
|
92
152
|
end
|
data/lang/en.yaml
CHANGED
@@ -24,14 +24,19 @@ enable_subtasks: Enable Subtasks
|
|
24
24
|
enable_users: Enable users
|
25
25
|
end_on: End on
|
26
26
|
end_work: Stop
|
27
|
+
estimate: Estimate
|
27
28
|
friday: Friday
|
29
|
+
group: Group
|
28
30
|
home: Home
|
31
|
+
hours: Hours
|
29
32
|
invoice: Invoice
|
30
33
|
invoice_short: Inv.
|
31
34
|
left: Left
|
32
35
|
listing_works: Recorded work
|
33
36
|
log_in: Log in
|
37
|
+
log_out: Log out
|
34
38
|
main_backlog: Main Backlog
|
39
|
+
members: Members
|
35
40
|
monday: Monday
|
36
41
|
move_to_bottom: Move task to bottom of list
|
37
42
|
move_to_next_period: Move task to next period
|
@@ -53,6 +58,7 @@ resolution: Resolution
|
|
53
58
|
right: Right
|
54
59
|
saturday: Saturday
|
55
60
|
save: Save
|
61
|
+
select: Select
|
56
62
|
shortcuts: Shortcuts
|
57
63
|
specify: Specify
|
58
64
|
start: Start
|
@@ -73,3 +79,4 @@ up: Up
|
|
73
79
|
user: User
|
74
80
|
wednesday: Wednesday
|
75
81
|
week: Week
|
82
|
+
work: Work
|
data/lang/no.yaml
CHANGED
@@ -24,14 +24,19 @@ enable_subtasks: Tillat underoppgaver
|
|
24
24
|
enable_users: Tillat brukere
|
25
25
|
end_on: Avslutt på
|
26
26
|
end_work: Stopp
|
27
|
+
estimate: Estimat
|
27
28
|
friday: Fredag
|
29
|
+
group: Gruppe
|
28
30
|
home: Hjem
|
31
|
+
hours: Timer
|
29
32
|
invoice: Fakturerbart
|
30
33
|
invoice_short: Fakt
|
31
34
|
left: Venstre
|
32
35
|
listing_works: Registrert arbeid
|
33
36
|
log_in: Log inn
|
37
|
+
log_out: Log ut
|
34
38
|
main_backlog: Hovedliste
|
39
|
+
members: Medlemmer
|
35
40
|
monday: Mandag
|
36
41
|
move_to_bottom: Flytt oppgaven til slutten av listen
|
37
42
|
move_to_next_period: Flytt oppgaven til nexte periode
|
@@ -53,6 +58,7 @@ resolution: Avslutningsmåte
|
|
53
58
|
right: Høyre
|
54
59
|
saturday: Lørdag
|
55
60
|
save: Lagre
|
61
|
+
select: Velg
|
56
62
|
shortcuts: Knapper
|
57
63
|
specify: Spesifisèr
|
58
64
|
start: Start
|
@@ -72,3 +78,4 @@ up: Opp
|
|
72
78
|
user: Bruker
|
73
79
|
wednesday: Onsdag
|
74
80
|
week: Uke
|
81
|
+
work: Arbeid
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'bigdecimal'
|
3
|
+
require 'rubygems'
|
4
|
+
require 'active_support'
|
5
|
+
|
6
|
+
class BigDecimal
|
7
|
+
yaml_as "tag:yaml.org,2002:float"
|
8
|
+
def to_yaml( opts = {} )
|
9
|
+
YAML::quick_emit( nil, opts ) do |out|
|
10
|
+
# This emits the number without any scientific notation.
|
11
|
+
# I prefer it to using self.to_f.to_s, which would loose precision.
|
12
|
+
#
|
13
|
+
# Note that YAML allows that when reconsituting floats
|
14
|
+
# to native types, some precision may get lost.
|
15
|
+
# There is no full precision real YAML tag that I am aware of.
|
16
|
+
str = self.to_s
|
17
|
+
if str == "Infinity"
|
18
|
+
str = ".Inf"
|
19
|
+
elsif str == "-Infinity"
|
20
|
+
str = "-.Inf"
|
21
|
+
elsif str == "NaN"
|
22
|
+
str = ".NaN"
|
23
|
+
end
|
24
|
+
out.scalar( "tag:yaml.org,2002:float", str, :plain )
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,163 @@
|
|
1
|
+
class ActiveRecord::Base
|
2
|
+
class_inheritable_array :default_eager_loading
|
3
|
+
|
4
|
+
class << self
|
5
|
+
alias_method :has_one_without_cti, :has_one
|
6
|
+
|
7
|
+
def find_with_default_eager_loading(*params)
|
8
|
+
if default_eager_loading
|
9
|
+
if params.last.is_a?(Hash)
|
10
|
+
opts = params.last
|
11
|
+
else
|
12
|
+
opts = {}
|
13
|
+
params.push(opts)
|
14
|
+
end
|
15
|
+
opts[:include] ||= []
|
16
|
+
opts[:include] = [opts[:include]] unless opts[:include].is_a?(Array)
|
17
|
+
opts[:include] += default_eager_loading
|
18
|
+
end
|
19
|
+
find_without_default_eager_loading(*params)
|
20
|
+
end
|
21
|
+
|
22
|
+
alias_method_chain :find, :default_eager_loading
|
23
|
+
|
24
|
+
def class_table_inheritance(options = {})
|
25
|
+
table_name = options[:subclass_table] || name.demodulize.tableize
|
26
|
+
primary_key_name = options[:subclass_foreign_key] || "#{superclass.name.demodulize.underscore}_id"
|
27
|
+
|
28
|
+
has_extra_columns_from(
|
29
|
+
:table => table_name, :foreign_key => primary_key_name,
|
30
|
+
:proxy_class_name => 'ExtraColumns',
|
31
|
+
:proxy_class_belongs_to => self.name,
|
32
|
+
:delegate_new_associations => true,
|
33
|
+
:save_before_superclass_callbacks => true
|
34
|
+
)
|
35
|
+
end
|
36
|
+
|
37
|
+
def has_extra_columns_from(options, &block)
|
38
|
+
table_name = options[:table]
|
39
|
+
primary_key_name = options[:foreign_key] || "#{name.demodulize.underscore}_id"
|
40
|
+
|
41
|
+
proxy_class_name = options[:proxy_class_name] || "ExtraColumnsFor#{table_name.camelize}"
|
42
|
+
proxy_class_namespace = (options[:proxy_class_namespace] || name).constantize
|
43
|
+
proxy_symbol = "extra_columns_for_#{table_name}".to_sym
|
44
|
+
|
45
|
+
proxy_class = proxy_class_namespace.const_get(proxy_class_name) rescue nil
|
46
|
+
unless proxy_class
|
47
|
+
proxy_class = proxy_class_namespace.const_set(proxy_class_name, Class.new(ActiveRecord::Base))
|
48
|
+
proxy_class.class_eval do
|
49
|
+
set_table_name table_name
|
50
|
+
set_primary_key primary_key_name
|
51
|
+
def self.reloadable?; false; end
|
52
|
+
end
|
53
|
+
proxy_class.class_eval(&block) if block_given?
|
54
|
+
end
|
55
|
+
|
56
|
+
has_one_without_cti proxy_symbol, :class_name => proxy_class.name, :foreign_key => primary_key_name, :dependent => true
|
57
|
+
|
58
|
+
if options[:save_before_superclass_callbacks] || true
|
59
|
+
# We need the after_save filter for this association to run /before/ any other after_save's already registered on a superclass,
|
60
|
+
# and before any after_creates or after_updates. This calls for some hackery:
|
61
|
+
proxy_save_callback = @inheritable_attributes[:after_save].pop
|
62
|
+
@inheritable_attributes[:after_create] ||= []
|
63
|
+
@inheritable_attributes[:after_create].unshift(proxy_save_callback)
|
64
|
+
@inheritable_attributes[:after_update] ||= []
|
65
|
+
@inheritable_attributes[:after_update].unshift(proxy_save_callback)
|
66
|
+
end
|
67
|
+
|
68
|
+
# adds this to the class-inheritable array of default eager loads:
|
69
|
+
self.default_eager_loading = [proxy_symbol] unless options[:default_eager_loading] == false
|
70
|
+
|
71
|
+
class_eval <<-EOV
|
72
|
+
alias_method :#{proxy_symbol}_old, :#{proxy_symbol}
|
73
|
+
def #{proxy_symbol}
|
74
|
+
#{proxy_symbol}_old or self.#{proxy_symbol} = #{proxy_class.name}.new
|
75
|
+
end
|
76
|
+
def save(*args)
|
77
|
+
self.#{proxy_symbol} ||= #{proxy_class.name}.new
|
78
|
+
super
|
79
|
+
end
|
80
|
+
# this doesn't happen automatically on update, so we'll make it:
|
81
|
+
after_update {|record| record.#{proxy_symbol}.save }
|
82
|
+
|
83
|
+
alias_method :write_attribute_super, :write_attribute
|
84
|
+
def write_attribute(attr_name, attr_value)
|
85
|
+
if self.class.columns.find {|c| c.name == attr_name}
|
86
|
+
write_attribute_super(attr_name, attr_value)
|
87
|
+
else
|
88
|
+
self.#{proxy_symbol}.write_attribute(attr_name, attr_value)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
alias_method :old_attributes, :attributes
|
93
|
+
def attributes
|
94
|
+
all_attributes = old_attributes.update(self.#{proxy_symbol}.attributes)
|
95
|
+
all_attributes.delete(#{proxy_class_name}.primary_key) if self.class.primary_key != #{proxy_class_name}.primary_key
|
96
|
+
all_attributes
|
97
|
+
end
|
98
|
+
|
99
|
+
class << self
|
100
|
+
alias_method :method_missing_super, :method_missing
|
101
|
+
def method_missing(method_symbol, *parameters)
|
102
|
+
if method_symbol.to_s =~ /^find_by_(.+)/
|
103
|
+
attributes = $1.split('_and_')
|
104
|
+
super_attributes = attributes & columns.map {|c| c.name}
|
105
|
+
sub_attributes = attributes - super_attributes
|
106
|
+
if super_attributes.size > 0
|
107
|
+
# TODO (uwe): Only use super attributes first
|
108
|
+
# then filter by sub_attributes
|
109
|
+
method_missing_super(method_symbol, parameters)
|
110
|
+
else
|
111
|
+
#{proxy_class_name}.method_missing(method_symbol, parameters)
|
112
|
+
end
|
113
|
+
else
|
114
|
+
method_missing_super(method_symbol, parameters)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
EOV
|
119
|
+
|
120
|
+
delegate_methods = proxy_class.column_names
|
121
|
+
delegate_methods += proxy_class.column_names.map {|name| "#{name}=".to_sym }
|
122
|
+
delegate_methods += proxy_class.column_names.map {|name| "#{name}?".to_sym }
|
123
|
+
proxy_class.reflect_on_all_associations.each do |reflection|
|
124
|
+
delegate_methods += case reflection.macro
|
125
|
+
when :has_many, :has_and_belongs_to_many
|
126
|
+
[reflection.name, "#{reflection.name}=".to_sym, "#{reflection.name.to_s.singularize}_ids=".to_sym]
|
127
|
+
when :has_one
|
128
|
+
[reflection.name, "#{reflection.name}=".to_sym, "build_#{reflection.name}".to_sym, "create_#{reflection.name}".to_sym]
|
129
|
+
when :belongs_to
|
130
|
+
[reflection.name, "#{reflection.name}=".to_sym, "#{reflection.name}?".to_sym, "build_#{reflection.name}".to_sym, "create_#{reflection.name}".to_sym]
|
131
|
+
end
|
132
|
+
end
|
133
|
+
delegate *(delegate_methods << {:to => proxy_symbol})
|
134
|
+
|
135
|
+
proxy_class.belongs_to(:base, :class_name => options[:proxy_class_belongs_to], :foreign_key => primary_key_name) if options[:proxy_class_belongs_to]
|
136
|
+
|
137
|
+
if options[:delegate_new_associations]
|
138
|
+
class_eval <<-EOV
|
139
|
+
# associations on this subclass get added to the proxy class, and then the relevant methods delegated to the proxy object
|
140
|
+
def self.belongs_to(name, *params)
|
141
|
+
ExtraColumns.belongs_to(name, *params)
|
142
|
+
delegate name, "\#{name}=".to_sym, "\#{name}?".to_sym, "build_\#{name}".to_sym, "create_\#{name}".to_sym, :to => :#{proxy_symbol}
|
143
|
+
end
|
144
|
+
|
145
|
+
def self.has_one(name, *params)
|
146
|
+
ExtraColumns.has_one(name, *params)
|
147
|
+
delegate name, "\#{name}=".to_sym, "build_\#{name}".to_sym, "create_\#{name}".to_sym, :to => :#{proxy_symbol}
|
148
|
+
end
|
149
|
+
|
150
|
+
def self.has_many(name, *params)
|
151
|
+
ExtraColumns.has_many(name, *params)
|
152
|
+
delegate name, "\#{name}=".to_sym, "\#{name.to_s.singularize}_ids=".to_sym, :to => :#{proxy_symbol}
|
153
|
+
end
|
154
|
+
|
155
|
+
def self.has_and_belongs_to_many(name, *params)
|
156
|
+
ExtraColumns.has_and_belongs_to_many(name, *params)
|
157
|
+
delegate name, "\#{name}=".to_sym, "\#{name.to_s.singularize}_ids=".to_sym, :to => :#{proxy_symbol}
|
158
|
+
end
|
159
|
+
EOV
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
# Original file by Tobias Luetke, found on
|
2
|
+
# http://blog.leetsoft.com/2006/5/29/easy-migration-between-databases
|
3
|
+
#
|
4
|
+
# set_sequences task by tnb@thenakedbrain.com
|
5
|
+
#
|
6
|
+
namespace :db do
|
7
|
+
namespace :backup do
|
8
|
+
|
9
|
+
def entity_table?(table_name)
|
10
|
+
columns = ActiveRecord::Base.connection.columns(table_name).map{|column|column.name}
|
11
|
+
columns.include?('id') || columns.include?('party_id')
|
12
|
+
end
|
13
|
+
|
14
|
+
def interesting_tables
|
15
|
+
tables = ActiveRecord::Base.connection.tables.sort.reject do |tbl|
|
16
|
+
['schema_info', 'sessions', 'logged_exceptions'].include?(tbl)
|
17
|
+
end
|
18
|
+
tables.select do |tbl|
|
19
|
+
entity_table?(tbl)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def load_table tbl, loaded_tables
|
24
|
+
return if loaded_tables.include? tbl
|
25
|
+
loaded_tables << tbl
|
26
|
+
klass = tbl.classify.constantize
|
27
|
+
klass.foreign_keys.each do |f_key|
|
28
|
+
load_table f_key.references_table_name, loaded_tables
|
29
|
+
end
|
30
|
+
ActiveRecord::Base.transaction do
|
31
|
+
puts "Loading #{tbl}..."
|
32
|
+
if ActiveRecord::Base.connection.adapter_name.downcase == 'postgresql'
|
33
|
+
ActiveRecord::Base.connection.execute "ALTER TABLE #{tbl} DISABLE TRIGGER ALL"
|
34
|
+
elsif ActiveRecord::Base.connection.adapter_name.downcase == 'mysql'
|
35
|
+
ActiveRecord::Base.connection.execute "SET FOREIGN_KEY_CHECKS=0"
|
36
|
+
end
|
37
|
+
YAML.load_file("#{tbl}.yml").each do |fixture|
|
38
|
+
klass.new(fixture).save_without_validation!
|
39
|
+
end
|
40
|
+
if ActiveRecord::Base.connection.adapter_name.downcase == "postgresql"
|
41
|
+
ActiveRecord::Base.connection.execute "ALTER TABLE #{tbl} ENABLE TRIGGER ALL"
|
42
|
+
elsif ActiveRecord::Base.connection.adapter_name.downcase == 'mysql'
|
43
|
+
ActiveRecord::Base.connection.execute "SET FOREIGN_KEY_CHECKS=1"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
desc "Dump entire db."
|
49
|
+
task :write => :environment do
|
50
|
+
dir = RAILS_ROOT + "/db/backup"
|
51
|
+
FileUtils.mkdir_p(dir)
|
52
|
+
FileUtils.chdir(dir)
|
53
|
+
|
54
|
+
interesting_tables.each do |tbl|
|
55
|
+
klass = tbl.classify.constantize
|
56
|
+
puts "Writing #{tbl}..."
|
57
|
+
entities = klass.find(:all)
|
58
|
+
if klass.column_names.include? 'type'
|
59
|
+
entities = entities.select {|e| e.type == klass}
|
60
|
+
end
|
61
|
+
File.open("#{tbl}.yml", 'w+') { |f| YAML.dump entities.collect(&:attributes), f }
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
task :read => [:environment, 'db:schema:load'] do
|
66
|
+
dir = RAILS_ROOT + '/db/backup'
|
67
|
+
FileUtils.mkdir_p(dir)
|
68
|
+
FileUtils.chdir(dir)
|
69
|
+
|
70
|
+
loaded_tables = []
|
71
|
+
|
72
|
+
interesting_tables.each do |tbl|
|
73
|
+
load_table(tbl, loaded_tables)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
desc "Set postgresql sequence currval to highest id for each table"
|
78
|
+
task :set_sequences => :environment do
|
79
|
+
if ActiveRecord::Base.connection.adapter_name.downcase == "postgresql"
|
80
|
+
interesting_tables.each do |tbl|
|
81
|
+
if ActiveRecord::Base.connection.columns(tbl).map{|column|column.name}.include?('id')
|
82
|
+
puts "Setting sequence's currval to highest id for #{tbl}"
|
83
|
+
ActiveRecord::Base.connection.execute "select setval('#{tbl}_id_seq', (select max(id) from #{tbl}));"
|
84
|
+
end
|
85
|
+
end
|
86
|
+
else
|
87
|
+
puts "This operation only works for postgresql databases."
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
92
|
+
end
|