Sha256: 79b4919f89c009c4ea951e3f6c66e5285ac856f2946f83850a3e2895c982457d

Contents?: true

Size: 899 Bytes

Versions: 2

Compression:

Stored size: 899 Bytes

Contents

module SessionsHelper
  
  def link_sistema(sistema_id, options = {}, html_options = {})
    sistema = Sistema.find(sistema_id)
    
    url_options = {
      :port       => Rails.env == 'development' ? (sistema.porta.to_i - 1000) : sistema.porta,
      :host       => Rails.env == 'development' ? "#{ENV['COMPUTERNAME']}.#{ENV['USERDNSDOMAIN']}" : sistema.host,
      :controller => sistema.url
    }
    
    options[:class] = "#{options[:class]} icon-sistema icon-#{sistema.image_name.gsub(/\.(png|gif)/, '')}"
    
    link_to sistema.nome.capitalize, "http://#{url_options[:host]}:#{url_options[:port]}#{url_options[:controller]}", options, html_options
  end
  
  def flash_message
    if key = flash.keys.first
      content_tag :div, :id => 'flash', :class => key do
        flash[key] + link_to('Fechar ×', '#', :id => 'close-flash')
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cmpa_auth-1.0.6 app/helpers/sessions_helper.rb
cmpa_auth-1.0.5 app/helpers/sessions_helper.rb