Module: Contour

Defined in:
lib/contour.rb,
lib/contour/fixes.rb,
lib/contour/engine.rb,
lib/contour/version.rb

Defined Under Namespace

Modules: Fixes, VERSION Classes: ConfirmationsController, Engine, InstallGenerator, PasswordsController, RegistrationsController, SamplesController, ScaffoldGenerator, SessionsController, UnlocksController

Constant Summary collapse

@@application_name =
'Application Name'
@@application_name_html =
nil
@@application_version =
nil
@@header_background_image =
'rails.png'
@@header_title_image =
nil
[
  {
    name: 'Login', display: 'not_signed_in', path: 'new_user_session_path', position: 'right', condition: 'true',
    links: [{ name: 'Sign Up', path: 'new_user_registration_path' }]
  },
  {
    name: 'current_user.email', eval: true, display: 'signed_in', position: 'right', condition: 'true',
    links: [{ name: 'Logout', path: 'destroy_user_session_path' }]
  },
  {
    name: 'Home', display: 'always', path: 'root_path', position: 'left', condition: 'true', image: '', image_options: {},
    links: []
  }
]
@@search_bar =
{}
nil
@@body_background_color =
nil
@@body_background_image =
nil
@@month_day =
{}
@@sign_up_fields =
[]
@@spam_fields =
[]

Class Method Summary collapse

Class Method Details

.body_background_color_selectObject



93
94
95
# File 'lib/contour.rb', line 93

def self.body_background_color_select
  retrieve_option(:body_background_color) || mod_year(body_background_color)
end

.body_background_image_selectObject



97
98
99
# File 'lib/contour.rb', line 97

def self.body_background_image_select()
  retrieve_option(:body_background_image) || mod_year(body_background_image)
end


89
90
91
# File 'lib/contour.rb', line 89

def self.link_color_select
  retrieve_option(:link_color) || mod_year(link_color)
end

.mod_year(element) ⇒ Object

Takes a string or array as input and returns element from location (YearDay % ArraySize)



111
112
113
114
# File 'lib/contour.rb', line 111

def self.mod_year(element)
  array = [element].flatten
  array.size > 0 ? array[Date.today.yday % array.size] : nil
end

.retrieve_option(option_name) ⇒ Object



101
102
103
104
105
106
107
108
# File 'lib/contour.rb', line 101

def self.retrieve_option(option_name)
  key = Date.today.month.to_s + "-" + Date.today.day.to_s
  if month_day.kind_of?(Hash) and month_day[key] and not month_day[key][option_name.to_sym].blank?
    month_day[key][option_name.to_sym]
  else
    nil
  end
end

.setup {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (Contour)

    the object that the method was called on



85
86
87
# File 'lib/contour.rb', line 85

def self.setup
  yield self
end