added pagination for meetings

pull/6827/head
Martin Linkhorst 13 years ago
parent 2d106ad3b4
commit 2d8c6980eb
  1. 14
      app/controllers/meetings_controller.rb
  2. 2
      app/models/meeting.rb
  3. 12
      app/views/meetings/index.html.erb

@ -16,7 +16,19 @@ class MeetingsController < ApplicationController
def index
# Wo sollen Meetings ohne Termin hin?
# (gibt's momentan nicht, Zeitpunkt ist ein Pflichtfeld)
@meetings_by_start_year_month_date = @project.meetings.find_time_sorted :all, :include => [{:participants => :user}, :author]
scope = @project.meetings
@count = scope.count
@limit = 10
@meetings_pages = Paginator.new self, @count, @limit, params['page']
@offset = @meetings_pages.current.offset
@meetings_by_start_year_month_date = scope.find_time_sorted(:all,
:include => [{:participants => :user}, :author],
:order => "#{Meeting.table_name}.start_time DESC",
:offset => @offset,
:limit => @limit)
end
def show

@ -37,7 +37,7 @@ class Meeting < ActiveRecord::Base
objs.group_by(&:start_month).each do |month,objs|
by_start_year_month_date[year][month] = ActiveSupport::OrderedHash.new
objs.group_by(&:start_date).each do |date,objs|
by_start_year_month_date[year][month][date] = objs.sort_by {|m| m.start_time}.reverse
by_start_year_month_date[year][month][date] = objs
end
end
end

@ -4,11 +4,11 @@
<p class="nodata"><%= l(:label_no_data) %></p>
<% else -%>
<div class="meetings meetings_by_month_year" id="activity">
<% @meetings_by_start_year_month_date.sort.reverse.each do |year,meetings_by_start_month_date| -%>
<% meetings_by_start_month_date.sort.reverse.each do |month,meetings_by_start_date| -%>
<% @meetings_by_start_year_month_date.each do |year,meetings_by_start_month_date| -%>
<% meetings_by_start_month_date.each do |month,meetings_by_start_date| -%>
<h3 class="month_year"><%= "#{month_name(month)} #{year}" %></h3>
<div class="meetings_by_date">
<% meetings_by_start_date.sort.reverse.each do |date,meetings| -%>
<% meetings_by_start_date.each do |date,meetings| -%>
<h3 class="date"><%= format_activity_day(date) %></h3>
<dl class="meetings">
<% meetings.each do |meeting| -%>
@ -19,8 +19,8 @@
</dt>
<dd class="meeting" id="meeting-<%= meeting.id %>">
<p><strong><%= l(:field_location) %></strong>: <%=h meeting.location %></p>
<p><strong><%= l(:field_participants_invited) %></strong> (<%= meeting.participants.invited.count %>): <%= format_participant_list meeting.participants.invited %></p>
<p><strong><%= l(:field_participants_attended) %></strong> (<%= meeting.participants.attended.count %>): <%= format_participant_list meeting.participants.attended %></p>
<p><strong><%= l(:field_participants_invited) %></strong> (<%= meeting.participants.select(&:invited).count %>): <%= format_participant_list meeting.participants.select(&:invited) %></p>
<p><strong><%= l(:field_participants_attended) %></strong> (<%= meeting.participants.select(&:attended).count %>): <%= format_participant_list meeting.participants.select(&:attended) %></p>
</dd>
<% end -%>
</dl>
@ -31,6 +31,8 @@
</div>
<% end -%>
<p class="pagination"><%= pagination_links_full @meetings_pages %></p>
<% content_for :header_tags do %>
<%= stylesheet_link_tag 'redmine_meeting', :plugin => 'redmine_meeting' %>
<% end %>

Loading…
Cancel
Save