Sha256: f3cc87c26737f35c7f2fa3531e4d421fabdccd09de9bec8fa18716724d0a605b

Contents?: true

Size: 745 Bytes

Versions: 4

Compression:

Stored size: 745 Bytes

Contents

module Deployinator::Views
  class RunLogs < Layout

    self.template_file = "#{File.dirname(__FILE__)}/../templates/run_logs.mustache"

    PER_PAGE = 30

    # Internal: determines what the next page number is.
    #
    # Returns the next page number
    def next_page
      page = get_page
      num_run_logs = get_run_logs.count
      return (page+1)*PER_PAGE < num_run_logs ? page + 1 : false
    end


    # Internal: fetches the run_log files to be displayed in a list view
    #
    # Returns an array of hashes with name, time keys
    def files
      page = get_page
      offset = PER_PAGE * page
      get_run_logs(:limit => PER_PAGE, :offset => offset)
    end

    def get_page
      @params['page'].to_i || 0
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
etsy-deployinator-1.1.1 lib/deployinator/views/run_logs.rb
etsy-deployinator-1.1.0 lib/deployinator/views/run_logs.rb
etsy-deployinator-1.0.2 lib/deployinator/views/run_logs.rb
etsy-deployinator-1.0.1 lib/deployinator/views/run_logs.rb