Sha256: e7872fe68b9dad4ed27913456de4256bf3a049d489cfe4a15fa72d47928e8148

Contents?: true

Size: 759 Bytes

Versions: 14

Compression:

Stored size: 759 Bytes

Contents

module CreatedByHelper
  def text_created_by(model, action = "create", mode = "short")
    begin
      if action.include?("update")
        id = model.updated_by
        time = model.updated_at
      else
        id = model.created_by
        time = model.created_at
      end
      user = <%= user.camelize %>.find(id)
      name = user.name
      email = user.email
    rescue
      return ""
    end
    case mode
      when "name"
        name
      when "email"
        email
      when "user"
        mail_to(email, name)
      when "long"
        "#{mail_to(email, name)} (#{l(time)})"
      when "link"
        "#{link_to(name, user)} (#{l(time.to_date)})"
      else          
        "#{mail_to(email, name)} (#{l(time.to_date)})"
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
bootswatch_rails-3.3.7.0 lib/generators/bootswatch_rails/created_by/templates/created_by_helper.rb
bootswatch_rails-3.3.6.2 lib/generators/bootswatch_rails/created_by/templates/created_by_helper.rb
bootswatch_rails-3.3.6.1 lib/generators/bootswatch_rails/created_by/templates/created_by_helper.rb
bootswatch_rails-3.3.5.2 lib/generators/bootswatch_rails/created_by/templates/created_by_helper.rb
bootswatch_rails-3.3.5.1 lib/generators/bootswatch_rails/created_by/templates/created_by_helper.rb
bootswatch_rails-3.3.4.1 lib/generators/bootswatch_rails/created_by/templates/created_by_helper.rb
bootswatch_rails-3.3.2.1 lib/generators/bootswatch_rails/created_by/templates/created_by_helper.rb
bootswatch_rails-3.3.1.2 lib/generators/bootswatch_rails/created_by/templates/created_by_helper.rb
bootswatch_rails-3.3.1.1 lib/generators/bootswatch_rails/created_by/templates/created_by_helper.rb
bootswatch_rails-3.3.1.0 lib/generators/bootswatch_rails/created_by/templates/created_by_helper.rb
bootswatch_rails-3.3.0.11 lib/generators/bootswatch_rails/created_by/templates/created_by_helper.rb
bootswatch_rails-3.3.0.10 lib/generators/bootswatch_rails/created_by/templates/created_by_helper.rb
bootswatch_rails-3.3.0.9 lib/generators/bootswatch_rails/created_by/templates/created_by_helper.rb
bootswatch_rails-3.3.0.8 lib/generators/bootswatch_rails/created_by/templates/created_by_helper.rb