Sha256: 638fb104e36a2666d311d3f5bac78261f6ee4f1558d863c454c69ad6f7a5243e

Contents?: true

Size: 851 Bytes

Versions: 67

Compression:

Stored size: 851 Bytes

Contents

module Myreplicator
  module ApplicationHelper

    def sortable(column, title = nil)
      title ||= column.titleize
      css_class = column == sort_column ? "current #{sort_direction}" : nil
      direction = column == sort_column && sort_direction == "asc" ? "desc" : "asc"
      link_to content_tag(:span, title), {:sort => column, :direction => direction}, {:class => css_class}
    end

    def chronos(secs)
      [[60, :seconds], [60, :minutes], [24, :hours], [1000, :days]].map{ |count, name|
        if secs > 0
          secs, n = secs.divmod(count)
          "#{n.to_i} #{name}"
        end
      }.compact.reverse.join(', ')
    end

    def err_count
      total = Log.where(:state => 'error').count
      return total
    end


    def run_count
      total = Log.where(:state => 'running').count
      return total
    end

  end
end

Version data entries

67 entries across 67 versions & 1 rubygems

Version Path
myreplicator-1.0.3 app/helpers/myreplicator/application_helper.rb
myreplicator-1.0.2 app/helpers/myreplicator/application_helper.rb
myreplicator-1.0.1 app/helpers/myreplicator/application_helper.rb
myreplicator-1.0.0 app/helpers/myreplicator/application_helper.rb
myreplicator-0.1.1 app/helpers/myreplicator/application_helper.rb
myreplicator-0.1.0 app/helpers/myreplicator/application_helper.rb
myreplicator-0.0.17 app/helpers/myreplicator/application_helper.rb