def get(self):
     template_vals = dict()
     template_vals['name_of_user'] = users.get_current_user().nickname()
     template_vals['notebooks'] = self.get_notebooks(users.get_current_user().user_id())
     user = User.get_user(users.get_current_user().user_id())
     template_vals['lectures'] = user.lecture_ids
     template_vals['tutorial'] = user.tutorial
     render(self, template_vals, 'dashboard.html')
 def get(self):
     google_user = users.get_current_user()
     if google_user:
         google_id = google_user.user_id()
         user = User.get_user(google_id=google_id)
         if user:
             self.redirect('/dashboard')
     render(self, {'logged_off': 'true'}, 'index.html')
 def dispatch(self):
     google_user = users.get_current_user()
     if google_user:
         google_id = google_user.user_id()
         user = User.get_user(google_id=google_id)
         if user:
             super(AuthHandler, self).dispatch()
         else:
             render(self, {}, 'index.html')
     else:
         self.redirect('/dashboard')
 def get(self, document_id):
     template_vals = {}
     bunnies_result = Bunny.query(Bunny.document_id == str(document_id)).order(Bunny.timestamp).iter()
     bunnies = []
     for bunny in bunnies_result:
         bunnies.append(bunny)
     template_vals['bunnies'] = bunnies
     template_vals['doc_id'] = document_id
     doc = Document.get_by_id(int(document_id))
     template_vals['doc_name'] = doc.title
     template_vals['lecture_id'] = doc.lecture_id
     render(self, template_vals, 'workspace.html')
 def get(self, notebook_id):
     template_vals = {'name_of_user': users.get_current_user().nickname()}
     notebook = Notebook.get_by_id(int(notebook_id))
     #   Get all documents for notebook
     titles = list()
     docs = list()
     for doc in notebook.document_ids:
         docs.append(int(doc))
         titles.append(Document.get_by_id(int(doc)).title)
     template_vals['titles'] = titles
     template_vals['nb_id'] = int(notebook_id)
     template_vals['doc_ids'] = docs
     render(self, template_vals, 'notebook-documents.html')
 def get(self):
     template_vals = {}
     google_user = users.get_current_user()
     user = User.get_by_id(google_user.user_id())
     if not user:
         new_user = User(id=google_user.user_id(), name=google_user.nickname(), email=google_user.email(),
                         notebook_ids=[])
         new_user.put()
         template_vals = {'name_of_user': google_user.nickname()}
         template_vals['message'] = 'Welcome to Notorious! We have finished setting up your account.'
     else:
         self.redirect('/dashboard')
     render(self, template_vals, 'dashboard.html')