Example #1
0
 def load_quiz_js(self):
   JQUERY_VERSION = '1.3.2'
   DEFAULT_QUIZ_SUBJECT = "Recovery.Gov"
   try : 
       proficiency_arg = self.request.path.split('/quiz/')[1].replace('%20',' ')
       this_proficiency = Proficiency.get_by_key_name(proficiency_arg)
       assert this_proficiency != None
       self.these_proficiencies = [this_proficiency]
   except: self.these_proficiencies = [Proficiency.get_by_key_name(DEFAULT_QUIZ_SUBJECT)]
   proficiency_names = [str(p.name) for p in self.these_proficiencies] 
   session_token = self.get_session_token()
   
   template_values = {
   'proficiencies': encode(proficiency_names).replace("\n", ""), 
   'user_token': session_token, 
   'css': self.get_widget_css().replace('\n','').replace("'",'"'),
   'widget_html': self.get_widget_html(), 
   'widget_subject': self.these_proficiencies[0].key(),
   'jquery_version' : JQUERY_VERSION,
   'jquery_location': JQUERY_VERSION,
   'auto_start': self.get_auto_start() 
   }
    
   path = widget_path('pqwidget.js')
   from utils.random import minify
   self.response.out.write(  minify(template.render(path, template_values))  )
Example #2
0
File: js.py Project: jamslevy/PQ
 def base_js(self):
     from utils.utils import tpl_path, Debug
     from utils.webapp import template
     if not Debug(): set_expire_header(self)
     template_values = {}
     path = tpl_path('base.js')
     from utils.random import minify 
     self.response.out.write( minify(template.render(path, template_values)) )
Example #3
0
 def browser_error(self):
   DEFAULT_QUIZ_SUBJECT = "Recovery.Gov"
   if not Debug(): self.set_expire_header()
   try : 
       proficiency_arg = self.request.path.split('/quiz/')[1].replace('%20',' ')
       this_proficiency = Proficiency.get_by_key_name(proficiency_arg)
       assert this_proficiency != None
       self.these_proficiencies = [this_proficiency]
   except: self.these_proficiencies = [Proficiency.get_by_key_name(DEFAULT_QUIZ_SUBJECT)]
   proficiency_names = [str(p.name) for p in self.these_proficiencies] 
   session_token = self.get_session_token()
   
   template_values = {
   'quiz_subject': encode(proficiency_names[0]).replace("\n", "")
   }
    
   path = widget_path('error.js')
   from utils.random import minify
   self.response.out.write(  minify(template.render(path, template_values))  )
Example #4
0
File: views.py Project: jamslevy/PQ
def register_js(template_values):
        path = tpl_path(ACCOUNTS_PATH  + 'scripts/register.js')
        from utils.random import minify 
        return minify( template.render(path, template_values) )
Example #5
0
File: views.py Project: jamslevy/PQ
def subjects_js(template_values):
        path = tpl_path(EDITOR_PATH + 'scripts/subjects.js')
        from utils.random import minify 
        return minify( template.render(path, template_values) )
Example #6
0
File: views.py Project: jamslevy/PQ
def homepage_js(template_values):
        path = tpl_path(HOMEPAGE_PATH  + 'scripts/homepage.js')
        from utils.random import minify 
        return minify( template.render(path, template_values) )
Example #7
0
 def base_js(self):
     template_values = {}
     path = tpl_path('base.js')
     from utils.random import minify 
     output = minify(template.render(path, template_values)) 
     return self.create_checksum(output)