Sha256: 275a6e1c3bed6d2c2cbd9eaf87f815aaa635eed918f6726a4844ac62abf125b4
Contents?: true
Size: 1.76 KB
Versions: 2
Compression:
Stored size: 1.76 KB
Contents
module Dorsale::Flyboy::ApplicationHelper include ::Handles::SortableColumns::InstanceMethods def tasks_for(taskable) @filters = ::Dorsale::Flyboy::SmallData::FilterForTasks.new(cookies) order ||= sortable_column_order do |column, direction| case column when "name", "status" %(LOWER(dorsale_flyboy_tasks.#{column}) #{direction}) when "progress", "term" %(dorsale_flyboy_tasks.#{column} #{direction}) else params["sort"] = "term" "dorsale_flyboy_tasks.term ASC" end end tasks = ::Dorsale::Flyboy::Task.where(taskable: taskable) tasks = @filters.apply(tasks) tasks = tasks.order(order) render "dorsale/flyboy/tasks/tasks_for_taskable", tasks: tasks, taskable: taskable end def show_tasks_summary render "dorsale/flyboy/tasks/summary" end def task_color(task) return "finished" if task.done return "ontime" if task.reminder > Time.zone.now.to_date return "onalert" if task.term < Time.zone.now.to_date return "onwarning" end def folder_color(folder) return "onalert" if ::Dorsale::Flyboy::Task.where(taskable: folder).where('done = ? AND term < ?', false, Time.zone.now.to_date).count > 0 return "onwarning" if ::Dorsale::Flyboy::Task.where(taskable: folder).where('done = ? AND term > ? AND reminder < ?', false, Time.zone.now.to_date, Time.zone.now.to_date).count > 0 return "finished" if folder.closed? return "ontime" end def flyboy_status_for_filters_select { Dorsale::Flyboy::Folder.t("status.all") => "", Dorsale::Flyboy::Folder.t("status.open") => "open", Dorsale::Flyboy::Folder.t("status.closed") => "closed", } end def flyboy_tasks_owners_for_filters_select policy_scope(User) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dorsale-3.3.0 | app/helpers/dorsale/flyboy/application_helper.rb |
dorsale-3.2.0 | app/helpers/dorsale/flyboy/application_helper.rb |