openproject-meeting 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +15 -0
  2. data/CHANGELOG.md +46 -0
  3. data/README.md +82 -0
  4. data/app/assets/images/meeting/agenda.png +0 -0
  5. data/app/assets/images/meeting/meeting.png +0 -0
  6. data/app/assets/images/meeting/minutes.png +0 -0
  7. data/app/assets/stylesheets/meeting/meeting.css.erb +39 -0
  8. data/app/controllers/meeting_agendas_controller.rb +33 -0
  9. data/app/controllers/meeting_contents_controller.rb +95 -0
  10. data/app/controllers/meeting_minutes_controller.rb +22 -0
  11. data/app/controllers/meetings_controller.rb +150 -0
  12. data/app/helpers/meeting_contents_helper.rb +68 -0
  13. data/app/helpers/meetings_helper.rb +16 -0
  14. data/app/mailers/meeting_mailer.rb +28 -0
  15. data/app/models/meeting.rb +163 -0
  16. data/app/models/meeting_agenda.rb +95 -0
  17. data/app/models/meeting_content.rb +67 -0
  18. data/app/models/meeting_minutes.rb +81 -0
  19. data/app/models/meeting_participant.rb +45 -0
  20. data/app/views/hooks/_activity_index_head.html.erb +13 -0
  21. data/app/views/meeting_contents/_form.html.erb +33 -0
  22. data/app/views/meeting_contents/_show.html.erb +40 -0
  23. data/app/views/meeting_contents/diff.html.erb +33 -0
  24. data/app/views/meeting_contents/history.html.erb +49 -0
  25. data/app/views/meeting_contents/show.html.erb +13 -0
  26. data/app/views/meeting_mailer/content_for_review.html.erb +23 -0
  27. data/app/views/meeting_mailer/content_for_review.text.erb +9 -0
  28. data/app/views/meetings/_form.html.erb +61 -0
  29. data/app/views/meetings/edit.html.erb +17 -0
  30. data/app/views/meetings/index.html.erb +51 -0
  31. data/app/views/meetings/new.html.erb +17 -0
  32. data/app/views/meetings/show.html.erb +48 -0
  33. data/app/views/shared/_meeting_header.html.erb +3 -0
  34. data/config/locales/de.yml +47 -0
  35. data/config/locales/en.yml +47 -0
  36. data/config/routes.rb +53 -0
  37. data/db/migrate/20110106210555_create_meetings.rb +29 -0
  38. data/db/migrate/20110106221214_create_meeting_contents.rb +29 -0
  39. data/db/migrate/20110106221946_create_meeting_content_versions.rb +20 -0
  40. data/db/migrate/20110108230721_create_meeting_participants.rb +30 -0
  41. data/db/migrate/20110224180804_add_lock_to_meeting_content.rb +24 -0
  42. data/db/migrate/20110819162852_create_initial_meeting_journals.rb +49 -0
  43. data/db/migrate/20111605171815_merge_meeting_content_versions_with_journals.rb +65 -0
  44. data/db/migrate/20130731151542_remove_meeting_role_id_from_meeting_participants.rb +20 -0
  45. data/lib/open_project/meeting.rb +16 -0
  46. data/lib/open_project/meeting/engine.rb +101 -0
  47. data/lib/open_project/meeting/hooks.rb +17 -0
  48. data/lib/open_project/meeting/patches/project_patch.rb +24 -0
  49. data/lib/open_project/meeting/version.rb +16 -0
  50. data/lib/openproject-meeting.rb +12 -0
  51. data/spec/controllers/meetings_controller_spec.rb +90 -0
  52. data/spec/factories/meeting_agenda_factory.rb +16 -0
  53. data/spec/factories/meeting_agenda_journal_factory.rb +18 -0
  54. data/spec/factories/meeting_factory.rb +18 -0
  55. data/spec/factories/meeting_minutes_factory.rb +16 -0
  56. data/spec/factories/meeting_minutes_journal_factory.rb +18 -0
  57. data/spec/factories/meeting_participant_factory.rb +17 -0
  58. data/spec/mailers/meeting_mailer_spec.rb +101 -0
  59. data/spec/models/meeting_agenda_journal_spec.rb +21 -0
  60. data/spec/models/meeting_agenda_spec.rb +52 -0
  61. data/spec/models/meeting_minutes_journal_spec.rb +21 -0
  62. data/spec/models/meeting_minutes_spec.rb +44 -0
  63. data/spec/models/meeting_spec.rb +168 -0
  64. data/spec/models/user_deletion_spec.rb +186 -0
  65. data/spec/spec_helper.rb +14 -0
  66. data/spec/support/plugin_spec_helper.rb +47 -0
  67. metadata +158 -0
@@ -0,0 +1,3 @@
1
+ <% content_for :header_tags do %>
2
+ <%= stylesheet_link_tag 'meeting/meeting.css' %>
3
+ <% end %>
@@ -0,0 +1,47 @@
1
+ # German strings go here for Rails i18n
2
+ de:
3
+ activerecord:
4
+ attributes:
5
+ meeting:
6
+ duration: "Dauer"
7
+ location: "Ort/Raum"
8
+ participants: "Teilnehmer"
9
+ participants_attended: "Anwesend"
10
+ participants_invited: "Eingeladen"
11
+ start_time: "Anfangszeit"
12
+
13
+ description_attended: "teilgenommen"
14
+ description_invite: "eingeladen"
15
+
16
+ label_meeting: "Besprechung"
17
+ label_meeting_plural: "Besprechungen"
18
+ label_meeting_new: "Neue Besprechung"
19
+ label_meeting_agenda: "Agenda"
20
+ label_meeting_minutes: "Protokoll"
21
+ label_meeting_close: "Schließen"
22
+ label_meeting_open: "Öffnen"
23
+ label_meeting_agenda_close: "Agenda schließen um mit dem Protokoll zu beginnen"
24
+ label_meeting_date_time: "Datum/Uhrzeit"
25
+ label_notify: "Zur Einsicht verschicken"
26
+
27
+ notice_successful_notification: "Benachrichtigung erfolgreich gesendet"
28
+ notice_timezone_missing: Keine Zeitzone eingestellt und daher %{zone} angenommen. Um Ihre Zeitzone einzustellen, clicken Sie bitte hier.
29
+
30
+ permission_create_meetings: "Besprechungen erstellen"
31
+ permission_edit_meetings: "Besprechungen bearbeiten"
32
+ permission_delete_meetings: "Besprechungen löschen"
33
+ permission_view_meetings: "Besprechungen ansehen"
34
+ permission_create_meeting_agendas: "Agenden anlegen/bearbeiten"
35
+ permission_close_meeting_agendas: "Agenden schließen"
36
+ permission_send_meeting_agendas_notification: "Benachrichtigungen für Agenden verschicken"
37
+ permission_create_meeting_minutes: "Protokolle anlegen/bearbeiten"
38
+ permission_send_meeting_minutes_notification: "Benachrichtigungen für Protokolle verschicken"
39
+
40
+ project_module_meetings: "Besprechungen"
41
+
42
+ text_agenda_for_meeting: 'Agenda für die Besprechung "%{meeting}"'
43
+ text_in_hours: "in Stunden"
44
+ text_meeting_agenda_open_are_you_sure: "Nicht-gespeicherte Inhalte des Protokolls werden durch diese Aktion verworfen! Weitermachen?"
45
+ text_minutes_for_meeting: 'Protokoll für die Besprechungen "%{meeting}"'
46
+ text_review_meeting_agenda: "%{author} hat die %{link} zur Einsicht freigegeben:"
47
+ text_review_meeting_minutes: "%{author} hat das %{link} zur Einsicht freigegeben:"
@@ -0,0 +1,47 @@
1
+ # English strings go here for Rails i18n
2
+ en:
3
+ activerecord:
4
+ attributes:
5
+ meeting:
6
+ location: "Location"
7
+ duration: "Duration"
8
+ participants: "Participants"
9
+ participants_attended: "Attendants"
10
+ participants_invited: "Invitees"
11
+ start_time: "Time"
12
+
13
+ description_attended: "attended"
14
+ description_invite: "invited"
15
+
16
+ label_meeting: "Meeting"
17
+ label_meeting_plural: "Meetings"
18
+ label_meeting_new: "New Meeting"
19
+ label_meeting_agenda: "Agenda"
20
+ label_meeting_minutes: "Minutes"
21
+ label_meeting_close: "Close"
22
+ label_meeting_open: "Open"
23
+ label_meeting_agenda_close: "Close the agenda to begin the Minutes"
24
+ label_meeting_date_time: "Date/Time"
25
+ label_notify: "Send for review"
26
+
27
+ notice_timezone_missing: No time zone is set and %{zone} is assumed. To choose your time zone, please click here.
28
+ notice_successful_notification: "Notification sent successfully"
29
+
30
+ permission_create_meetings: "Create meetings"
31
+ permission_edit_meetings: "Edit meetings"
32
+ permission_delete_meetings: "Delete meetings"
33
+ permission_view_meetings: "View meetings"
34
+ permission_create_meeting_agendas: "Manage agendas"
35
+ permission_close_meeting_agendas: "Close agendas"
36
+ permission_send_meeting_agendas_notification: "Send review notification for agendas"
37
+ permission_create_meeting_minutes: "Manage minutes"
38
+ permission_send_meeting_minutes_notification: "Send review notification for minutes"
39
+
40
+ project_module_meetings: "Meetings"
41
+
42
+ text_agenda_for_meeting: 'agenda for the meeting "%{meeting}"'
43
+ text_in_hours: "in hours"
44
+ text_meeting_agenda_open_are_you_sure: "Unsaved content in the minutes will be lost! Continue?"
45
+ text_minutes_for_meeting: 'minutes for the meeting "%{meeting}"'
46
+ text_review_meeting_agenda: "%{author} has put the %{link} up for review:"
47
+ text_review_meeting_minutes: "%{author} has put the %{link} up for review:"
data/config/routes.rb ADDED
@@ -0,0 +1,53 @@
1
+ #-- copyright
2
+ # OpenProject is a project management system.
3
+ #
4
+ # Copyright (C) 2012-2013 the OpenProject Team
5
+ #
6
+ # This program is free software; you can redistribute it and/or
7
+ # modify it under the terms of the GNU General Public License version 3.
8
+ #
9
+ # See doc/COPYRIGHT.rdoc for more details.
10
+ #++
11
+
12
+ OpenProject::Application.routes.draw do
13
+
14
+ scope 'projects/:project_id' do
15
+ resources :meetings, :only => [:new, :create, :index]
16
+ end
17
+
18
+ resources :meetings, :except => [:new, :create, :index] do
19
+
20
+ resource :agenda, :controller => 'meeting_agendas', :only => [:update] do
21
+ member do
22
+ get :history
23
+ get :diff
24
+ put :close
25
+ put :open
26
+ put :notify
27
+ post :preview
28
+ end
29
+
30
+ resources :versions, :only => [:show],
31
+ :controller => 'meeting_agendas'
32
+ end
33
+
34
+ resource :minutes, :controller => 'meeting_minutes', :only => [:update] do
35
+ member do
36
+ get :history
37
+ get :diff
38
+ put :notify
39
+ post :preview
40
+ end
41
+
42
+ resources :versions, :only => [:show],
43
+ :controller => 'meeting_minutes'
44
+ end
45
+
46
+ member do
47
+ get :copy
48
+ match '/:tab' => 'meetings#show', :constraints => { :tab => /(agenda|minutes)/ },
49
+ :via => :get,
50
+ :as => 'tab'
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,29 @@
1
+ #-- copyright
2
+ # OpenProject is a project management system.
3
+ #
4
+ # Copyright (C) 2012-2013 the OpenProject Team
5
+ #
6
+ # This program is free software; you can redistribute it and/or
7
+ # modify it under the terms of the GNU General Public License version 3.
8
+ #
9
+ # See doc/COPYRIGHT.rdoc for more details.
10
+ #++
11
+
12
+ class CreateMeetings < ActiveRecord::Migration
13
+ def self.up
14
+ create_table :meetings do |t|
15
+ t.column :title, :string
16
+ t.column :author_id, :integer
17
+ t.column :project_id, :integer
18
+ t.column :location, :string
19
+ t.column :start_time, :datetime
20
+ t.column :duration, :float
21
+
22
+ t.timestamps
23
+ end
24
+ end
25
+
26
+ def self.down
27
+ drop_table :meetings
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ #-- copyright
2
+ # OpenProject is a project management system.
3
+ #
4
+ # Copyright (C) 2012-2013 the OpenProject Team
5
+ #
6
+ # This program is free software; you can redistribute it and/or
7
+ # modify it under the terms of the GNU General Public License version 3.
8
+ #
9
+ # See doc/COPYRIGHT.rdoc for more details.
10
+ #++
11
+
12
+ class CreateMeetingContents < ActiveRecord::Migration
13
+ def self.up
14
+ create_table :meeting_contents do |t|
15
+ t.column :type, :string
16
+ t.column :meeting_id, :integer
17
+ t.column :author_id, :integer
18
+ t.column :text, :text
19
+ t.column :comment, :string
20
+ t.column :version, :integer
21
+
22
+ t.timestamps
23
+ end
24
+ end
25
+
26
+ def self.down
27
+ drop_table :meeting_contents
28
+ end
29
+ end
@@ -0,0 +1,20 @@
1
+ #-- copyright
2
+ # OpenProject is a project management system.
3
+ #
4
+ # Copyright (C) 2012-2013 the OpenProject Team
5
+ #
6
+ # This program is free software; you can redistribute it and/or
7
+ # modify it under the terms of the GNU General Public License version 3.
8
+ #
9
+ # See doc/COPYRIGHT.rdoc for more details.
10
+ #++
11
+
12
+ class CreateMeetingContentVersions < ActiveRecord::Migration
13
+ def self.up
14
+ MeetingContent.create_versioned_table
15
+ end
16
+
17
+ def self.down
18
+ MeetingContent.drop_versioned_table
19
+ end
20
+ end
@@ -0,0 +1,30 @@
1
+ #-- copyright
2
+ # OpenProject is a project management system.
3
+ #
4
+ # Copyright (C) 2012-2013 the OpenProject Team
5
+ #
6
+ # This program is free software; you can redistribute it and/or
7
+ # modify it under the terms of the GNU General Public License version 3.
8
+ #
9
+ # See doc/COPYRIGHT.rdoc for more details.
10
+ #++
11
+
12
+ class CreateMeetingParticipants < ActiveRecord::Migration
13
+ def self.up
14
+ create_table :meeting_participants do |t|
15
+ t.column :user_id, :integer
16
+ t.column :meeting_id, :integer
17
+ t.column :meeting_role_id, :integer
18
+ t.column :email, :string
19
+ t.column :name, :string
20
+ t.column :invited, :boolean
21
+ t.column :attended, :boolean
22
+
23
+ t.timestamps
24
+ end
25
+ end
26
+
27
+ def self.down
28
+ drop_table :meeting_participants
29
+ end
30
+ end
@@ -0,0 +1,24 @@
1
+ #-- copyright
2
+ # OpenProject is a project management system.
3
+ #
4
+ # Copyright (C) 2012-2013 the OpenProject Team
5
+ #
6
+ # This program is free software; you can redistribute it and/or
7
+ # modify it under the terms of the GNU General Public License version 3.
8
+ #
9
+ # See doc/COPYRIGHT.rdoc for more details.
10
+ #++
11
+
12
+ class AddLockToMeetingContent < ActiveRecord::Migration
13
+ def self.up
14
+ add_column :meeting_contents, :locked, :boolean, :default => false
15
+ # Check for existence of the pre-journalized MeetingContentVersions table
16
+ add_column :meeting_content_versions, :locked, :boolean, :default => nil if table_exists? :meeting_content_versions
17
+ end
18
+
19
+ def self.down
20
+ remove_column :meeting_contents, :locked
21
+ # Check for existence of the pre-journalized MeetingContentVersions table
22
+ remove_column :meeting_content_versions, :locked if table_exists? :meeting_content_versions
23
+ end
24
+ end
@@ -0,0 +1,49 @@
1
+ #-- copyright
2
+ # OpenProject is a project management system.
3
+ #
4
+ # Copyright (C) 2012-2013 the OpenProject Team
5
+ #
6
+ # This program is free software; you can redistribute it and/or
7
+ # modify it under the terms of the GNU General Public License version 3.
8
+ #
9
+ # See doc/COPYRIGHT.rdoc for more details.
10
+ #++
11
+
12
+ class CreateInitialMeetingJournals < ActiveRecord::Migration
13
+ def self.up
14
+
15
+ [Meeting].each do |p|
16
+ say_with_time("Building initial journals for #{p.class_name}") do
17
+
18
+ # avoid touching the journaled object on journal creation
19
+ p.journal_class.class_exec {
20
+ def touch_journaled_after_creation
21
+ end
22
+ }
23
+
24
+ activity_type = p.activity_provider_options.keys.first
25
+
26
+ # Create initial journals
27
+ p.find(:all).each do |o|
28
+ # Using rescue and save! here because either the Journal or the
29
+ # touched record could fail. This will catch either error and continue
30
+ begin
31
+ new_journal = o.recreate_initial_journal!
32
+ rescue ActiveRecord::RecordInvalid => ex
33
+ if new_journal.errors.count == 1 && new_journal.errors.first[0] == "version"
34
+ # Skip, only error was from creating the initial journal for a record that already had one.
35
+ else
36
+ puts "ERROR: errors creating the initial journal for #{o.class.to_s}##{o.id.to_s}:"
37
+ puts " #{ex.message}"
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+
45
+ def self.down
46
+ # no-op
47
+ # (well, in theory we should delete the MeetingJournals…)
48
+ end
49
+ end
@@ -0,0 +1,65 @@
1
+ #-- copyright
2
+ # OpenProject is a project management system.
3
+ #
4
+ # Copyright (C) 2012-2013 the OpenProject Team
5
+ #
6
+ # This program is free software; you can redistribute it and/or
7
+ # modify it under the terms of the GNU General Public License version 3.
8
+ #
9
+ # See doc/COPYRIGHT.rdoc for more details.
10
+ #++
11
+
12
+ class MergeMeetingContentVersionsWithJournals < ActiveRecord::Migration
13
+ def self.up
14
+ # The table doesn't exist on fresh installations
15
+ if table_exists? :meeting_content_versions
16
+ # This is provided here for migrating up after the MeetingContent::Version class has been removed
17
+ unless MeetingContent.const_defined?("Version")
18
+ MeetingContent.const_set("Version", Class.new(ActiveRecord::Base))
19
+ end
20
+
21
+ # load some classes
22
+ MeetingAgenda
23
+ MeetingMinutes
24
+
25
+ # avoid touching WikiContent on journal creation
26
+ MeetingAgendaJournal.class_exec {
27
+ def touch_journaled_after_creation
28
+ end
29
+ }
30
+ MeetingMinutesJournal.class_exec {
31
+ def touch_journaled_after_creation
32
+ end
33
+ }
34
+
35
+ cache = Hash.new{|h,k| h[k] = Hash.new{|h,k| h[k] = Hash.new{|h,k| h[k] = {}}}}
36
+
37
+ MeetingContent::Version.find_by_sql('SELECT * FROM meeting_content_versions ORDER BY version ASC').each do |mcv|
38
+ options = {:journaled_id => mcv.meeting_content_id, :created_at => mcv.created_at,
39
+ :user_id => mcv.author_id, :notes => mcv.comment, :activity_type => 'meetings',
40
+ :version => mcv.version}
41
+ ft = [cache[mcv.meeting_content_id][mcv.versioned_type][mcv.version-1][:locked], mcv.locked]
42
+ options[:changes] = {'locked' => ft} unless mcv.version == 1 || ft.first == ft.last
43
+ journal = case mcv.versioned_type
44
+ when 'MeetingAgenda'
45
+ MeetingAgendaJournal.create! options
46
+ when 'MeetingMinutes'
47
+ MeetingMinutesJournal.create! options
48
+ end
49
+ journal.text = mcv.text unless mcv.text == cache[mcv.meeting_content_id][mcv.versioned_type][mcv.version-1][:text]
50
+ cache[mcv.meeting_content_id][mcv.versioned_type][mcv.version] = {:text => mcv.text, :locked => mcv.locked}
51
+ end
52
+
53
+ drop_table :meeting_content_versions
54
+ end
55
+
56
+ change_table :meeting_contents do |t|
57
+ t.rename :version, :lock_version
58
+ t.remove :comment
59
+ end
60
+ end
61
+
62
+ def self.down
63
+ raise ActiveRecord::IrreversibleMigration, "Can't revert to pre-journalized versioning model"
64
+ end
65
+ end
@@ -0,0 +1,20 @@
1
+ #-- copyright
2
+ # OpenProject is a project management system.
3
+ #
4
+ # Copyright (C) 2012-2013 the OpenProject Team
5
+ #
6
+ # This program is free software; you can redistribute it and/or
7
+ # modify it under the terms of the GNU General Public License version 3.
8
+ #
9
+ # See doc/COPYRIGHT.rdoc for more details.
10
+ #++
11
+
12
+ class RemoveMeetingRoleIdFromMeetingParticipants < ActiveRecord::Migration
13
+ def up
14
+ remove_column :meeting_participants, :meeting_role_id
15
+ end
16
+
17
+ def down
18
+ add_column :meeting_participants, :meeting_role_id, :integer
19
+ end
20
+ end
@@ -0,0 +1,16 @@
1
+ #-- copyright
2
+ # OpenProject is a project management system.
3
+ #
4
+ # Copyright (C) 2012-2013 the OpenProject Team
5
+ #
6
+ # This program is free software; you can redistribute it and/or
7
+ # modify it under the terms of the GNU General Public License version 3.
8
+ #
9
+ # See doc/COPYRIGHT.rdoc for more details.
10
+ #++
11
+
12
+ module OpenProject
13
+ module Meeting
14
+ require "open_project/meeting/engine"
15
+ end
16
+ end