Sha256: ec606e3697502e70e9969d0b070026f5fa5fe59301f215889e8fa6095a885ccd

Contents?: true

Size: 889 Bytes

Versions: 4

Compression:

Stored size: 889 Bytes

Contents

class Admin::LaborsController 

  alias edit_without_slimtimer edit
  
  def edit_with_slimtimer
    self.active_scaffold_config.configure do |config|
      config.columns << :slimtimer_task
      config.columns[:slimtimer_task].label = 'SLIM<em>TIMER</em> Task'
      
      # This looks real iffy, but seems to be the best way of doing this... even if its super ugly
      config.update.columns.each do |uc| 
        if uc.label == 'Activity'
          uc.add :slimtimer_task
          uc.move_column_under :slimtimer_task, :occurred_on
        end
      end
    end
    
    # Here we'll fetch a default client if we can ascertain one:
    begin
      @record.activity.client_id = @record.slimtimer_time_entry.slimtimer_task.default_client_id if @record.activity.client_id.nil?
    rescue
      
    end
    
    edit_without_slimtimer
  end
  
  alias edit edit_with_slimtimer
    
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
brisk-bills-0.8.2 app/controllers/admin/labors_controller/slimtimer.rb
brisk-bills-0.8.1 app/controllers/admin/labors_controller/slimtimer.rb
brisk-bills-0.7.0 app/controllers/admin/labors_controller/slimtimer.rb
brisk-bills-0.6.0 app/controllers/admin/labors_controller/slimtimer.rb