Merge the search_meetings branch. myproject #2331

pull/6827/head
Felix Schäfer 14 years ago
commit 3e936b218e
  1. 14
      app/models/meeting.rb
  2. 4
      app/models/meeting_minutes.rb
  3. 36
      features/meetings_search.feature
  4. 6
      features/step_definitions/meeting_steps.rb
  5. 9
      init.rb

@ -5,10 +5,20 @@ class Meeting < ActiveRecord::Base
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
has_one :agenda, :dependent => :destroy, :class_name => 'MeetingAgenda'
has_one :minutes, :dependent => :destroy, :class_name => 'MeetingMinutes'
has_many :contents, :class_name => 'MeetingContent', :readonly => true
has_many :participants, :dependent => :destroy, :class_name => 'MeetingParticipant'
acts_as_watchable
acts_as_searchable :columns => ["#{table_name}.title", "#{MeetingContent.table_name}.text"],
: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}}
accepts_nested_attributes_for :participants, :reject_if => proc {|attrs| !(attrs['attended'] || attrs['invited'])}
validates_presence_of :title, :start_time, :duration
@ -50,6 +60,10 @@ class Meeting < ActiveRecord::Base
title
end
def text
agenda.text if agenda.present?
end
protected
def after_initialize

@ -15,7 +15,9 @@ class MeetingMinutes < MeetingContent
def after_initialize
# set defaults
self.text ||= meeting.agenda.text if meeting.present? && meeting.agenda.present?
# avoid too deep stacks by not using the association helper methods
ag = MeetingAgenda.find_by_meeting_id(meeting_id)
self.text ||= ag.text if ag.present?
super
end
end

@ -0,0 +1,36 @@
Feature: Search meetings through the global search
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 |
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:30 |
| 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 search page and search for a meeting
When I login as "alice"
And I go to the search page
And I fill in the following:
| search-input | bob |
And I click on "Submit"
Then I should see "Bobs Meeting" within "#search-results .meeting"

@ -10,3 +10,9 @@ Given /^the [Mm]eeting "(.+)" has 1 agenda with:$/ do |meeting,table|
m.agenda ||= Factory.build(:meeting_agenda)
send_table_to_object(m.agenda, table)
end
Given /^the [Mm]eeting "(.+)" has minutes with:$/ do |meeting,table|
m = Meeting.find_by_title(meeting)
m.minutes = Factory.build(:meeting_minutes)
send_table_to_object(m.minutes, table)
end

@ -14,9 +14,9 @@ Redmine::Plugin.register :redmine_meeting do
author_url 'http://finn.de/team'
description 'This plugin adds a meeting module with functionality to plan an agenda and save the minutes of a meeting.'
url 'http://finn.de'
version '1.0.0'
version 'devel'
requires_redmine :version_or_higher => '0.9'
requires_redmine :version_or_higher => '1.0'
project_module :meetings do
permission :create_meetings, {:meetings => [:new, :create]}, :require => :member
@ -29,6 +29,9 @@ Redmine::Plugin.register :redmine_meeting do
permission :create_meeting_minutes, {:meeting_minutes => [:update]}, :require => :member
end
menu :project_menu, :meetings, {:controller => 'meetings', :action => 'index'}, :caption => :project_module_meetings, :param => :project_id, :after => :wiki
Redmine::Search.map do |search|
search.register :meetings
end
menu :project_menu, :meetings, {:controller => 'meetings', :action => 'index'}, :caption => :project_module_meetings, :param => :project_id, :after => :wiki
end

Loading…
Cancel
Save