Add a close action to agendas. #2417

pull/6827/head
Felix Schäfer 14 years ago
parent 7ec7a6b8ff
commit 23868446a7
  1. 5
      app/controllers/meeting_agendas_controller.rb
  2. 1
      app/controllers/meetings_controller.rb
  3. 3
      app/models/meeting_agenda.rb
  4. 1
      app/views/meeting_contents/_show.html.erb
  5. 1
      config/locales/de.yml
  6. 1
      config/locales/en.yml
  7. 4
      config/routes.rb
  8. 11
      db/migrate/20110224180804_add_lock_to_meeting_content.rb
  9. 15
      features/meeting_close.feature
  10. 1
      init.rb
  11. 4
      spec/factories/meeting_agenda_factory.rb
  12. 17
      spec/models/meeting_agenda_spec.rb

@ -3,6 +3,11 @@ class MeetingAgendasController < MeetingContentsController
menu_item :meetings
def close
@content.lock!
redirect_to :back
end
private
def find_content

@ -79,6 +79,7 @@ class MeetingsController < ApplicationController
def convert_params
params[:meeting][:start_time] = Date.parse(params[:meeting].delete(:start_date)) + params[:meeting].delete(:"start_time(4i)").to_i.hours + params[:meeting].delete(:"start_time(5i)").to_i.minutes
params[:meeting][:duration] = params[:meeting][:duration].to_hours
# Force defaults on participants
params[:meeting][:participants_attributes].each {|p| p.reverse_merge! :attended => false, :invited => false}
end
end

@ -1,2 +1,5 @@
class MeetingAgenda < MeetingContent
def lock!
update_attribute :locked, true
end
end

@ -2,6 +2,7 @@
<div class="contextual">
<%= link_to l(:button_edit), "#", :class => 'icon icon-edit', :accesskey => accesskey(:edit), :onclick => "Element.show(\"edit-#{content_type}\"); Element.hide(\"#{content_type}-text\"); return false;" if (authorize_for(content_type.pluralize, 'update') && (content.blank? || content.editable?)) %>
<%= link_to_if_authorized(l(:label_history), {:controller => content_type.pluralize, :action => 'history', :meeting_id => @meeting}, :class => 'icon icon-history') unless content.blank? %>
<%= link_to_if_authorized l(:label_close), {:controller => content_type.pluralize, :action => 'close', :meeting_id => @meeting}, :method => :put, :class => 'icon icon-lock' %>
</div>
<h2><%= title %></h2>
<% if authorize_for(content_type.pluralize, 'update') -%>

@ -5,6 +5,7 @@ de:
label_meeting_new: "Neues Meeting"
label_meeting_agenda: "Agenda"
label_meeting_minutes: "Protokoll"
label_close: "Schließen"
field_participants: "Teilnehmer"
field_participants_invited: "Eingeladen"
field_participants_attended: "Anwesend"

@ -5,6 +5,7 @@ en:
label_meeting_new: "New Meeting"
label_meeting_agenda: "Agenda"
label_meeting_minutes: "Minutes"
label_close: "Close"
field_participants: "Participants"
field_participants_invited: "Invitees"
field_participants_attended: "Attendants"

@ -2,8 +2,8 @@
ActionController::Routing::Routes.draw do |map|
map.resources :projects, :only => [] do |project|
project.resources :meetings, :shallow => true do |meeting|
meeting.resource :meeting_agenda, :as => 'agenda', :only => [:update, :show], :collection => {:history => :get, :diff => :get}
meeting.resource :meeting_minutes, :as => 'minutes', :only => [:update, :show], :collection => {:history => :get, :diff => :get}
meeting.resource :agenda, :controller => 'meeting_agendas', :only => [:update, :show], :member => {:history => :get, :diff => :get, :close => :put}
meeting.resource :minutes, :controller => 'meeting_minutes', :only => [:update, :show], :member => {:history => :get, :diff => :get}
end
end
end

@ -0,0 +1,11 @@
class AddLockToMeetingContent < ActiveRecord::Migration
def self.up
add_column :meeting_contents, :locked, :boolean, :default => false
add_column :meeting_content_versions, :locked, :boolean, :default => nil
end
def self.down
remove_column :meeting_contents, :locked
remove_column :meeting_content_versions, :locked
end
end

@ -19,7 +19,7 @@ Feature: Close existing meetings
@javascript
Scenario: Navigate to a meeting page with no permission to close meetings
Given the role "user" may have the following rights:
| view_meetings |
| view_meetings |
When I login as "alice"
And I go to the Meetings page for the project called "dingens"
And I click on "Bobs Meeting"
@ -28,20 +28,23 @@ Feature: Close existing meetings
@javascript
Scenario: Navigate to a meeting page with permission to close meetings
Given the role "user" may have the following rights:
| view_meetings |
| close_meetings |
| view_meetings |
| close_meeting_agendas |
When I login as "alice"
And I go to the Meetings page for the project called "dingens"
And I click on "Bobs Meeting"
Then I should see "Close" within ".meeting_agenda"
@javascript
Scenario: Navigate to a meeting page with permission to close meetings and close the meeting
Scenario: Navigate to a meeting page with permission to close and edit meetings and close the meeting
Given the role "user" may have the following rights:
| view_meetings |
| close_meetings |
| view_meetings |
| create_meeting_agendas |
| close_meeting_agendas |
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 "Close"
Then I should not see "Edit" within ".meeting_agenda"
And I should not see "Close" within ".meeting_agenda"
And I should see "Open" within ".meeting_agenda"

@ -22,6 +22,7 @@ Redmine::Plugin.register :redmine_meeting do
permission :edit_meetings, {:meetings => [:edit, :update]}, :require => :member
permission :delete_meetings, {:meetings => [:destroy]}, :require => :member
permission :view_meetings, {:meetings => [:index, :show], :meeting_agendas => [:history, :show, :diff], :meeting_minutes => [:history, :show, :diff]}
permission :close_meeting_agendas, {:meeting_agendas => [:close]}, :require => :member
permission :create_meeting_agendas, {:meeting_agendas => [:update]}, :require => :member
permission :create_meeting_minutes, {:meeting_minutes => [:update]}, :require => :member
end

@ -0,0 +1,4 @@
Factory.define :meeting_agenda do |a|
# TODO: Wird das gebraucht?
#a.type "MeetingAgenda"
end

@ -0,0 +1,17 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe "MeetingAgenda" do
before(:all) do
#@m = Factory.build :meeting, :title => "dingens"
@a = Factory.build :meeting_agenda, :text => "Some content...\n\nMore content!\n\nExtraordinary content!!"
end
describe "#lock!" do
it "locks the agenda" do
@a.save
@a.lock!
@a.reload
@a.locked.should be_true
end
end
end
Loading…
Cancel
Save