Sha256: 6e92c4184dc0b48cc0ab04a017732f3fbb5ac3e12785f91a373bef61e1a5dce0
Contents?: true
Size: 1.37 KB
Versions: 1
Compression:
Stored size: 1.37 KB
Contents
require 'action_view/helpers/url_helper' class Sidebar include ActionView::Helpers::UrlHelper include ActionView::Helpers::TagHelper include ERB::Util def initialize(controller) @controller = controller end def blocks(period) @period = period # TODO (uwe): This does not scale! #periods = Period.find(:all).select {|period| period.active_or_future?(true) && period.party.includes?(user)} periods = Period.find_active_or_future(true) blocks = periods.sort_by {|p| p.required_speed}.reverse.map do |period| content = @controller.render_to_string :partial => '/periods/sidebar_block', :locals => {:period => period} { :id => period.id, :title => "#{period.party.name}##{period.position} (#{'%0.1f' % period.required_speed})", :options => {:controller => 'periods', :action => :show, :id => period}, :content => content } end started_tasks = Task.find_started if not started_tasks.empty? links = started_tasks.map do |task| "<li><a href=\"#{url_for :controller => 'tasks', :action => :list_started, :id => task.id}\">#{task.description}</a></li>" end blocks.unshift({ :title => @controller.l(:started_tasks), :options => {:controller => 'tasks', :action => :list_started}, :content => "<ul>#{links}" }) end blocks end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
backlog-0.36.2 | app/models/sidebar.rb |