Module: Gaku::SharedHelper

Included in:
AdminHelper
Defined in:
app/helpers/gaku/shared_helper.rb

Instance Method Summary collapse

Instance Method Details

#can_edit?Boolean

Returns:

  • (Boolean)


4
5
6
# File 'app/helpers/gaku/shared_helper.rb', line 4

def can_edit?
  %w( edit create update ).include? action_name
end

#disabled?(country_preset) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
24
25
26
27
28
# File 'app/helpers/gaku/shared_helper.rb', line 21

def disabled?(country_preset)
  country = Gaku::Country.find_by(iso: country_preset)
  if country
    country.states_required
  else
    true
  end
end

#gendersObject



8
9
10
# File 'app/helpers/gaku/shared_helper.rb', line 8

def genders
  { t(:'gender.female') => false, t(:'gender.male') => true }
end

#render_flashObject



30
31
32
# File 'app/helpers/gaku/shared_helper.rb', line 30

def render_flash
  escape_javascript(render 'gaku/shared/flash', flash: flash)
end

#state_load(country_preset) ⇒ Object



12
13
14
15
16
17
18
19
# File 'app/helpers/gaku/shared_helper.rb', line 12

def state_load(country_preset)
  country = Gaku::Country.find_by(iso: country_preset)
  if country
    country.states
  else
    Gaku::State.none
  end
end