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.1.58 app/helpers/myreplicator/application_helper.rb
myreplicator-1.1.57 app/helpers/myreplicator/application_helper.rb
myreplicator-1.1.56 app/helpers/myreplicator/application_helper.rb
myreplicator-1.1.55 app/helpers/myreplicator/application_helper.rb
myreplicator-1.1.54 app/helpers/myreplicator/application_helper.rb
myreplicator-1.1.53 app/helpers/myreplicator/application_helper.rb
myreplicator-1.1.52 app/helpers/myreplicator/application_helper.rb
myreplicator-1.1.51 app/helpers/myreplicator/application_helper.rb
myreplicator-1.1.50 app/helpers/myreplicator/application_helper.rb
myreplicator-1.1.49 app/helpers/myreplicator/application_helper.rb
myreplicator-1.1.48 app/helpers/myreplicator/application_helper.rb
myreplicator-1.1.47 app/helpers/myreplicator/application_helper.rb
myreplicator-1.1.46 app/helpers/myreplicator/application_helper.rb
myreplicator-1.1.45 app/helpers/myreplicator/application_helper.rb
myreplicator-1.1.44 app/helpers/myreplicator/application_helper.rb
myreplicator-1.1.43 app/helpers/myreplicator/application_helper.rb
myreplicator-1.1.42 app/helpers/myreplicator/application_helper.rb
myreplicator-1.1.41 app/helpers/myreplicator/application_helper.rb
myreplicator-1.1.40 app/helpers/myreplicator/application_helper.rb
myreplicator-1.1.39 app/helpers/myreplicator/application_helper.rb