Sha256: 330113efe73db3ac5e2227329d0b0980f7dae99fd145eeeb375236fb97398e8a

Contents?: true

Size: 1.09 KB

Versions: 16

Compression:

Stored size: 1.09 KB

Contents

module Sunrise
  module DashboardHelper

    # For generating time tags calculated using jquery.timeago
    def timeago_tag(time, options = {})
      options[:class] ||= "timeago"
      content_tag(:abbr, time.to_s, options.merge(:title => time.getutc.iso8601)) if time
    end

    def activity_icon_tag(key, options = {})
      icon = key.split('.').last
      image = image_path("sunrise/icons/#{icon}.svg")

      options = {
        :class => "mega-icon",
        :style => "background-image: url(#{image});"
      }.merge(options)

      content_tag(:div, nil, options)
    end

    # Check if object still exists in the database and display a link to it,
    # otherwise display a proper message about it.
    # This is used in activities that can refer to
    # objects which no longer exist, like removed posts.
    def link_to_trackable(object, object_type)
      model_name = object_type.downcase

      if object
        link_to(model_name, edit_path(:model_name => model_name.pluralize, :id => object.id))
      else
        "a #{model_name} which does not exist anymore"
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
sunrise-cms-1.0.0.rc2 app/helpers/sunrise/dashboard_helper.rb
sunrise-cms-1.0.0.rc1 app/helpers/sunrise/dashboard_helper.rb
sunrise-cms-0.7.0.rc2 app/helpers/sunrise/dashboard_helper.rb
sunrise-cms-0.7.0.rc1 app/helpers/sunrise/dashboard_helper.rb
sunrise-cms-0.6.11 app/helpers/sunrise/dashboard_helper.rb
sunrise-cms-0.6.10 app/helpers/sunrise/dashboard_helper.rb
sunrise-cms-0.6.9 app/helpers/sunrise/dashboard_helper.rb
sunrise-cms-0.6.8 app/helpers/sunrise/dashboard_helper.rb
sunrise-cms-0.6.7 app/helpers/sunrise/dashboard_helper.rb
sunrise-cms-0.6.6 app/helpers/sunrise/dashboard_helper.rb
sunrise-cms-0.6.5 app/helpers/sunrise/dashboard_helper.rb
sunrise-cms-0.6.4 app/helpers/sunrise/dashboard_helper.rb
sunrise-cms-0.6.3 app/helpers/sunrise/dashboard_helper.rb
sunrise-cms-0.6.2 app/helpers/sunrise/dashboard_helper.rb
sunrise-cms-0.6.1 app/helpers/sunrise/dashboard_helper.rb
sunrise-cms-0.6.0 app/helpers/sunrise/dashboard_helper.rb