Module: Jekyll::GradForms

Defined in:
jekyll/_plugins/grad-forms.rb

Instance Method Summary collapse

Instance Method Details

#grad_form_open(form_key, term_key) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'jekyll/_plugins/grad-forms.rb', line 4

def grad_form_open(form_key,term_key)

     site = @context.registers[:site]
     if (!site.data['services_config'])
        return false
     end


      #    Jekyll.logger.warn "Warning: grad_form_open  services_config: #{ site.data['services_config']}"


     form_config = site.data['services_config'][form_key]
     
     if (form_config == nil)
        return false
     end
     term_parts = term_key.split("_")
     form_term = term_parts[1]
     form_year = term_parts[0]
     
     if (form_key == 'idp')
    # Jekyll.logger.warn "idp form availability #{form_config['availability']}"
     
     end
     
     if ((form_config['form_term'] == form_term && form_config['form_year'] == form_year) || form_config['availability'])
         if (form_config['availability'] || (Date.parse(form_config['open_date']) <= Date.today &&
          Date.parse(form_config['close_date']) >= Date.today)   )
             return true
         end            
     end
     return false
end