Module: ThemerHelper

Defined in:
app/helpers/themer_helper.rb

Instance Method Summary collapse

Instance Method Details

#set_themer(theme) ⇒ Object



15
16
17
18
# File 'app/helpers/themer_helper.rb', line 15

def set_themer theme
    cookies[:themer] = theme
    theme
end

#themer(theme = nil) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'app/helpers/themer_helper.rb', line 3

def themer theme = nil
    theme ||= cookies[:themer] || Themer.configuration.default
    if Themer.configuration.auto && theme == 'auto'
        if Time.now < Time.parse(Themer.configuration.day_time) || Time.now > Time.parse(Themer.configuration.night_time)
            theme = Themer.configuration.day
        else
            theme = Themer.configuration.night
        end
    end
    theme
end

#themer_available?(theme) ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
# File 'app/helpers/themer_helper.rb', line 28

def themer_available? theme
    Themer.configuration.themes.include? theme
end

#themer_classObject



20
21
22
23
24
25
26
# File 'app/helpers/themer_helper.rb', line 20

def themer_class
    begin
        "themer--#{current_theme}"
    rescue NoMethodError
        "themer--#{themer}"
    end
end