Sha256: d0ee1512b81d4a595cb3b62a037836b989149a6a158513b4b16f5b89a66b8f25

Contents?: true

Size: 746 Bytes

Versions: 4

Compression:

Stored size: 746 Bytes

Contents

module Ominous
  module WarningsHelper
    def classes_for(closer)
      classes = ['closer']
      classes << visibility(closer.start_hidden?)
      classes.join(' ')
    end
    
    def visibility(truth)
      truth ? 'start_hidden' : 'start_visible'
    end
    
    def closer_link_to(warning, closer)
      text = t("ominous.warning.#{warning.name}.#{closer.name}.link") 
      link_class = closer.closure_method
      url = closer_url(warning, closer)
      link_to(text, url, :method => :put, :class => link_class)
    end
    
    def closer_url(warning, closer)
      if closer.closure_method == 'close_and_dismiss_warning'
        ominous.dismiss_warning_path(warning)
      else
        return closer.url
      end
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ominous-0.0.4 app/helpers/ominous/warnings_helper.rb
ominous-0.0.3 app/helpers/ominous/warnings_helper.rb
ominous-0.0.2 app/helpers/ominous/warnings_helper.rb
ominous-0.0.1 app/helpers/ominous/warnings_helper.rb