comparison app/controllers/activities_controller.rb @ 1009:066b55d7c053 browsing

Add busy institutions list
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Mon, 12 Nov 2012 13:34:32 +0000
parents 0c939c159af4
children e3f78fa30a36
comparison
equal deleted inserted replaced
1008:8196ed891e54 1009:066b55d7c053
38 @activity.scope_select {|t| !params["show_#{t}"].nil?} 38 @activity.scope_select {|t| !params["show_#{t}"].nil?}
39 @activity.scope = (@author.nil? ? :default : :all) if @activity.scope.empty? 39 @activity.scope = (@author.nil? ? :default : :all) if @activity.scope.empty?
40 40
41 events = @activity.events(@date_from, @date_to) 41 events = @activity.events(@date_from, @date_to)
42 42
43 if events.empty? || stale?(:etag => [@activity.scope, @date_to, @date_from, @with_subprojects, @author, events.first, User.current, current_language]) 43 @institution_name = params[:institution]
44 if !@institution_name.blank?
45 events = events.select do |e|
46 e.respond_to?(:event_author) and e.event_author and
47 e.event_author.ssamr_user_detail.institution_name == @institution_name
48 end
49 if events.empty?
50 # We don't want to dump into the output any arbitrary string
51 # from the URL that has no matching events
52 @institution_name = ""
53 end
54 end
55
56 if events.empty? || stale?(:etag => [@activity.scope, @date_to, @date_from, @with_subprojects, @author, @institution_name, events.first, User.current, current_language])
44 respond_to do |format| 57 respond_to do |format|
45 format.html { 58 format.html {
46 @events_by_day = events.group_by(&:event_date) 59 @events_by_day = events.group_by(&:event_date)
47 render :layout => false if request.xhr? 60 render :layout => false if request.xhr?
48 } 61 }