Sha256: dc207b24969091e6a365d4485c8cf9d541da87cc803702de1d702c975a00d215

Contents?: true

Size: 1.31 KB

Versions: 19

Compression:

Stored size: 1.31 KB

Contents

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

    def warnings
      warnings = []
      warnings << "Your site needs a title<br /><a href='/tenon/settings'>OK</a><br />".html_safe if Tenon::MySettings.site_title.blank?
      warnings << "Your site needs an address<br /><a href='/tenon/settings'>OK</a><br />".html_safe if Tenon::MySettings.site_url.blank?
      warnings << "You haven't entered an email address to receive contact messages.<br /><a href='/tenon/settings'>Correct This</a><br />".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 /><a href='/tenon/settings'>Correct This</a><br />".html_safe  if Tenon::MySettings.from_email.blank?
      warnings << "You haven't entered the Google Analytics code.<br /><a href='/tenon/settings'>Correct This</a><br />".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

19 entries across 19 versions & 1 rubygems

Version Path
tenon-1.0.18 lib/tenon/warning_generator.rb
tenon-1.0.17 lib/tenon/warning_generator.rb
tenon-1.0.16 lib/tenon/warning_generator.rb
tenon-1.0.15 lib/tenon/warning_generator.rb
tenon-1.0.14 lib/tenon/warning_generator.rb
tenon-1.0.13 lib/tenon/warning_generator.rb
tenon-1.0.12 lib/tenon/warning_generator.rb
tenon-1.0.11 lib/tenon/warning_generator.rb
tenon-1.0.10 lib/tenon/warning_generator.rb
tenon-1.0.9 lib/tenon/warning_generator.rb
tenon-1.0.8 lib/tenon/warning_generator.rb
tenon-1.0.7 lib/tenon/warning_generator.rb
tenon-1.0.6 lib/tenon/warning_generator.rb
tenon-1.0.5 lib/tenon/warning_generator.rb
tenon-1.0.4 lib/tenon/warning_generator.rb
tenon-1.0.3 lib/tenon/warning_generator.rb
tenon-1.0.2 lib/tenon/warning_generator.rb
tenon-1.0.1 lib/tenon/warning_generator.rb
tenon-1.0 lib/tenon/warning_generator.rb