Copy more things when copying a meeting. #3788

pull/6827/head
Felix Schäfer 14 years ago
parent f6224b2712
commit 43a1a5b5de
  1. 7
      app/controllers/meetings_controller.rb
  2. 4
      app/models/meeting.rb
  3. 2
      app/views/meetings/_form.html.erb
  4. 4
      app/views/meetings/index.html.erb
  5. 3
      assets/stylesheets/redmine_meeting.css

@ -28,7 +28,12 @@ class MeetingsController < ApplicationController
end
def new
@meeting.attributes = Meeting.find(params[:copy_from_id]).attributes.reject {|k,v| !%w(duration location title).include? k} if params[:copy_from_id]
if params[:copy_from_id]
copy_from = Meeting.find(params[:copy_from_id])
@meeting.attributes = copy_from.attributes.reject {|k,v| !%w(duration location title).include? k}
@meeting.start_time += (copy_from.start_time.hour - 10).hours
@meeting.participants = copy_from.participants
end
end
def destroy

@ -18,6 +18,10 @@ class Meeting < ActiveRecord::Base
title
end
def participant_user_ids
@participant_user_ids ||= participants.collect(&:user_id)
end
protected
def after_initialize

@ -7,7 +7,7 @@
<p><label for="meeting_duration"><%= l(:field_duration)%></label><%= text_field_tag "meeting[duration]", @meeting.duration, :size => 5 %> <em>(in hours)</em></p>
<p><label><%= l(:field_participants) %></label>
<% @meeting.project.users.sort.each do |user| -%>
<label class="floating"><%= check_box_tag 'meeting_participant_users[]', user.id, ((params[:meeting_participant_users].include?(user.id.to_s) if params[:meeting_participant_users].present?) || @meeting.participants.find_by_user_id(user.id).present?) %> <%=h user %></label>
<label class="floating"><%= check_box_tag 'meeting_participant_users[]', user.id, ((params[:meeting_participant_users].include?(user.id.to_s) if params[:meeting_participant_users].present?) || @meeting.participant_user_ids.include?(user.id)) %> <%=h user %></label>
<% end -%>
</p>
</div>

@ -9,12 +9,14 @@
<% if @meetings.empty? -%>
<p class="nodata"><%= l(:label_no_data) %></p>
<% else -%>
<div class="meetings">
<% @meetings.each do |meeting| -%>
<div class="meeting" id="meeting-#{meeting.id}" >
<div class="meeting" id="meeting-<%= meeting.id %>">
<h3><%= format_time meeting.start_time %>: <%= link_to h(meeting.title), :controller => 'meetings', :action => 'show', :id => meeting %></h3>
<p class="author"><%= authoring meeting.created_at, meeting.author %></p>
<p><strong><%= l(:field_location) %></strong>: <%=h meeting.location %> - <strong><%= l(:field_duration) %></strong>: <%= l_hours(meeting.duration) %></p>
<p><strong><%= l(:field_participants) %></strong> (<%= meeting.participants.count %>): <%= meeting.participants.join(", ") %></p>
</div>
<% end -%>
</div>
<% end -%>

@ -1 +1,2 @@
div.meeting_content { padding-bottom: 2em; }
.meetings div.meeting {padding-bottom: 1em;}
div.meeting_content {padding-bottom: 2em;}
Loading…
Cancel
Save