Meeting journalizing and activity view refinements.

pull/6827/head
Felix Schäfer 14 years ago
parent d9c867cba6
commit cadd307038
  1. 23
      app/models/meeting.rb
  2. 39
      app/models/meeting_content.rb
  3. 2
      app/models/meeting_minutes.rb
  4. 50
      features/meetings_activity.feature
  5. 2
      init.rb

@ -14,14 +14,13 @@ class Meeting < ActiveRecord::Base
:include => [:contents, :project],
:date_column => "#{table_name}.created_at"
acts_as_event :title => Proc.new {|o| "#{l :label_meeting}: #{o.title} (#{format_date o.start_time} #{format_time o.start_time, false}-#{format_time o.end_time, false})"},
:description => :text,
:datetime => :created_at,
:url => Proc.new {|o| {:controller => 'meetings', :action => 'show', :id => o}}
acts_as_journalized :activity_find_options => {:include => [:agenda, :author, :project]},
:event_title => Proc.new {|o| "#{l :label_meeting}: #{o.title} (#{format_date o.start_time} #{format_time o.start_time, false}-#{format_time o.end_time, false})"},
:event_url => Proc.new {|o| {:controller => 'meetings', :action => 'show', :id => o.journaled}}
acts_as_activity_provider :timestamp => "#{table_name}.created_at",
:author_key => :author_id,
:find_options => {:include => [:agenda, :project, :author]}
register_on_journal_formatter(:fraction, 'duration')
register_on_journal_formatter(:datetime, 'start_time')
register_on_journal_formatter(:plaintext, 'location')
accepts_nested_attributes_for :participants, :reject_if => proc {|attrs| !(attrs['attended'] || attrs['invited'])}
@ -91,4 +90,12 @@ class Meeting < ActiveRecord::Base
def add_author_as_watcher
add_watcher(author)
end
end
MeetingJournal.class_eval do
unloadable
def notes
journaled.text
end
end
end

@ -30,6 +30,11 @@ class MeetingContent < ActiveRecord::Base
updated_at
end
# Show the project on activity and search views
def project
meeting.project
end
# Provided for compatibility of the old pre-journalized migration
def self.create_versioned_table
end
@ -43,38 +48,4 @@ class MeetingContent < ActiveRecord::Base
def comment_to_journal_notes
init_journal(author, comment) unless changes.empty?
end
# FIXME: Leftover from pre-journalized meeting contents
#class Version
# unloadable
#
# belongs_to :author, :class_name => '::User', :foreign_key => 'author_id'
# belongs_to :meeting, :class_name => '::Meeting', :foreign_key => 'meeting_id'
#
# acts_as_event :title => Proc.new {|o| "#{l :"label_#{o.versioned_type.underscore}"}: #{o.meeting.title}"},
# :description => :comment,
# :datetime => :updated_at,
# :type => Proc.new {|o| o.versioned_type.underscore.dasherize},
# :url => Proc.new {|o| {:controller => 'meetings', :action => 'show', :id => o.meeting}}
#
# acts_as_activity_provider :type => 'meetings',
# :timestamp => "#{MeetingContent.versioned_table_name}.updated_at",
# :author_key => "#{MeetingContent.versioned_table_name}.author_id",
# :permission => :view_meetings,
# :find_options => {:select => "#{MeetingContent.versioned_table_name}.updated_at, #{MeetingContent.versioned_table_name}.comment, " +
# "#{MeetingContent.versioned_table_name}.#{MeetingContent.version_column}, #{Meeting.table_name}.title, " +
# "#{MeetingContent.versioned_table_name}.author_id, #{MeetingContent.versioned_table_name}.id," +
# "#{MeetingContent.versioned_table_name}.meeting_id, #{Meeting.table_name}.project_id, " +
# "#{MeetingContent.versioned_table_name}.versioned_type",
# :joins => "LEFT JOIN #{Meeting.table_name} ON #{Meeting.table_name}.id = #{MeetingContent.versioned_table_name}.meeting_id " +
# "LEFT JOIN #{Project.table_name} ON #{Project.table_name}.id = #{Meeting.table_name}.project_id"}
#
# def project
# meeting.project
# end
#
# def editable?
# false
# end
#end
end

@ -4,7 +4,7 @@ class MeetingMinutes < MeetingContent
acts_as_journalized :activity_type => 'meetings',
:activity_permission => :view_meetings,
:activity_find_options => {:include => {:meeting => :project}},
:event_title => Proc.new {|o| "#{l :label_meeting_agenda}: #{o.meeting.title}"},
:event_title => Proc.new {|o| "#{l :label_meeting_minutes}: #{o.meeting.title}"},
:event_url => Proc.new {|o| {:controller => 'meetings', :action => 'show', :id => o.meeting}}
def activity_type

@ -0,0 +1,50 @@
Feature: Show meeting activity
Background:
Given there is 1 project with the following:
| identifier | dingens |
| name | dingens |
And the project "dingens" uses the following modules:
| meetings |
And there is 1 user with:
| login | alice |
| language | en |
And there is a role "user"
And the role "user" may have the following rights:
| view_meetings |
| edit_meetings |
And the user "alice" is a "user" in the project "dingens"
And there is 1 user with:
| login | bob |
And there is 1 meeting in project "dingens" created by "bob" with:
| title | Bobs Meeting |
| location | Room 2 |
| duration | 2.5 |
| start_time | 2011-02-10 11:00:00 |
And the meeting "Bobs Meeting" has 1 agenda with:
| locked | true |
| text | foobaz |
And the meeting "Bobs Meeting" has minutes with:
| text | barbaz |
@javascript
Scenario: Navigate to the project's activity page and see the meeting activity
When I login as "alice"
And I go to the activity page for the project called "dingens"
And I click on "Meetings"
Then I should see "Meeting: Bobs Meeting (02/10/2011 11:00 am-01:30 pm)" within ".meeting"
And I should see "Agenda: Bobs Meeting" within ".meeting-agenda"
And I should see "Minutes: Bobs Meeting" within ".meeting-minutes"
@javascript
Scenario: Change a metadata on a meeting and see the activity on the project's activity page
When I login as "alice"
And I go to the meetings page for the project called "dingens"
And I click on "Bobs Meeting"
And I click on "Edit"
And I fill in the following:
| meeting_location | Geheimer Ort! |
And I click on "Save"
And I go to the activity page for the project called "dingens"
And I click on "Meetings"
Then I should see "Meeting: Bobs Meeting (02/10/2011 11:00 am-01:30 pm)" within ".meeting.me"

@ -34,7 +34,7 @@ Redmine::Plugin.register :redmine_meeting do
search.register :meetings
end
activity_provider :meetings, :default => false, :class_name => ['MeetingAgenda', 'MeetingMinutes']
activity_provider :meetings, :default => false, :class_name => ['Meeting', 'MeetingAgenda', 'MeetingMinutes']
menu :project_menu, :meetings, {:controller => 'meetings', :action => 'index'}, :caption => :project_module_meetings, :param => :project_id, :after => :wiki
end

Loading…
Cancel
Save