Sha256: ee96a245769da0fc73999394d25534e0a1b651c5cf7bd0374e8a8c7d8640adaa

Contents?: true

Size: 1.46 KB

Versions: 54

Compression:

Stored size: 1.46 KB

Contents

module Tenon
  class WarningGenerator
    def self.generate
      new.warnings
    end

    def warnings
      warnings = []
      warnings << "Your site needs a title.<br /><br /><a class='btn btn-comp btn-block' href='/tenon/settings'>OK</a>".html_safe if Tenon::MySettings.site_title.blank?
      warnings << "Your site needs an address.<br /><br /><a class='btn btn-comp btn-block' href='/tenon/settings'>OK</a>".html_safe if Tenon::MySettings.site_url.blank?
      warnings << "You haven't entered an email address to receive contact messages.<br /><br /><a class='btn btn-comp btn-block' href='/tenon/settings'>Correct This</a>".html_safe  if Tenon::MySettings.contact_email.blank?
      warnings << "You haven't entered an email address from which to send contact messages and other site notices.<br /><br /><a class='btn btn-comp btn-block' href='/tenon/settings'>Correct This</a>".html_safe  if Tenon::MySettings.from_email.blank?
      warnings << "You haven't entered the Google Analytics code.<br /><br /><a class='btn btn-comp btn-block' href='/tenon/settings'>Correct This</a>".html_safe if Tenon::MySettings.google_analytics.blank?
      warnings << 'You have not included a custom favicon.' unless favicon && favicon.size > 0
      warnings
    end

    private

    def favicon
      return @favicon if @favicon
      begin
        @favicon = File.read(File.join(Rails.root, 'public', 'favicon.ico'))
      rescue Errno::ENOENT
        @favicon = nil
      end
    end
  end
end

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
tenon-1.0.74 lib/tenon/warning_generator.rb
tenon-1.0.73 lib/tenon/warning_generator.rb
tenon-1.0.72 lib/tenon/warning_generator.rb
tenon-1.0.71 lib/tenon/warning_generator.rb
tenon-1.0.70 lib/tenon/warning_generator.rb
tenon-1.0.69 lib/tenon/warning_generator.rb
tenon-1.0.68 lib/tenon/warning_generator.rb
tenon-1.0.67 lib/tenon/warning_generator.rb
tenon-1.0.66 lib/tenon/warning_generator.rb
tenon-1.0.65 lib/tenon/warning_generator.rb
tenon-1.0.64 lib/tenon/warning_generator.rb
tenon-1.0.63 lib/tenon/warning_generator.rb
tenon-1.0.62 lib/tenon/warning_generator.rb
tenon-1.0.61 lib/tenon/warning_generator.rb
tenon-1.0.60 lib/tenon/warning_generator.rb
tenon-1.0.59 lib/tenon/warning_generator.rb
tenon-1.0.57 lib/tenon/warning_generator.rb
tenon-1.0.56 lib/tenon/warning_generator.rb
tenon-1.0.55 lib/tenon/warning_generator.rb
tenon-1.0.54 lib/tenon/warning_generator.rb