def add(self, category_id):
     category = EvalCategory.find_by_id(int(category_id))
     if category.card.is_authorized():
         item_id = EvalItem.create(self.request.get('name'), int(category_id)).id()
         item = EvalItem.find_by_id(item_id)
         template = JinjaEnv.get().get_template('templates/item/edit_row.html')
         self.response.out.write(template.render({'item': item}))
 def edit(self, signature_id):
     sig = Signature.find_by_id(int(signature_id))
     if sig.card.is_authorized():
         sig.name = self.request.get('name')
         sig.save()
         template = JinjaEnv.get().get_template('templates/signature/edit_row.html')
         self.response.out.write(template.render({'signature': sig}))
 def add(self, card_id):
     card = ReportCard.find_by_id(int(card_id))
     if card.is_authorized():
         category_id = EvalCategory.create(self.request.get('name'), int(card_id)).id()
         category = EvalCategory.find_by_id(category_id)
         template = JinjaEnv.get().get_template('templates/category/edit_table.html')
         self.response.out.write(template.render({'category': category}))
 def add(self, card_id):
     card = ReportCard.find_by_id(int(card_id))
     if card.is_authorized():
         signature_id = Signature.create(self.request.get('name'), int(card_id)).id()
         signature = Signature.find_by_id(signature_id)
         template = JinjaEnv.get().get_template('templates/signature/edit_row.html')
         self.response.out.write(template.render({'signature': signature}))
 def edit(self, card_id):
     # TODO: handle this some other way
     AppUser.record_access(users.get_current_user())
     card = ReportCard.find_by_id(int(card_id))
     if card.is_authorized():
         template = JinjaEnv.get().get_template('templates/card/edit_form.html')
         self.response.out.write(template.render({'card': card}))
 def add(self, card_id):
     card = ReportCard.find_by_id(int(card_id))
     if card.is_authorized():
         key_level_id = EvalKeyLevel.create(self.request.get('name'), int(self.request.get('score')), int(card_id)).id()
         key_level = EvalKeyLevel.find_by_id(key_level_id)
         template = JinjaEnv.get().get_template('templates/key_level/edit_row.html')
         self.response.out.write(template.render({'key_level': key_level}))
 def edit(self, text_line_id):
     text_line = TextLine.find_by_id(int(text_line_id))
     if text_line.card.is_authorized():
         text_line.name = self.request.get('name')
         text_line.save()
         template = JinjaEnv.get().get_template('templates/text_line/edit_row.html')
         self.response.out.write(template.render({'text_line': text_line}))
 def add(self, card_id):
     card = ReportCard.find_by_id(int(card_id))
     if card.is_authorized():
         text_line_id = TextLine.create(self.request.get('name'), int(card_id)).id()
         text_line = TextLine.find_by_id(text_line_id)
         template = JinjaEnv.get().get_template('templates/text_line/edit_row.html')
         self.response.out.write(template.render({'text_line': text_line}))
 def edit(self, item_id):
     item = EvalItem.find_by_id(int(item_id))
     card = item.category.card
     if card.is_authorized():            
         item.name = self.request.get('name')
         item.save()
         template = JinjaEnv.get().get_template('templates/item/edit_row.html')
         self.response.out.write(template.render({'item': item}))
 def edit(self, category_id):
     category = EvalCategory.find_by_id(int(category_id))
     card = category.card
     if card.is_authorized():
         category.name = self.request.get('name')
         category.save()
         template = JinjaEnv.get().get_template('templates/category/edit_table.html')
         self.response.out.write(template.render({'category': category}))
Ejemplo n.º 11
0
 def edit(self, key_level_id):
     key_level = EvalKeyLevel.find_by_id(int(key_level_id))
     card = key_level.card
     if card.is_authorized():
         key_level.name = self.request.get('name')
         key_level.score = int(self.request.get('score'))
         key_level.save()
         template = JinjaEnv.get().get_template('templates/key_level/edit_row.html')
         self.response.out.write(template.render({'key_level': key_level}))
Ejemplo n.º 12
0
 def delete_form(self, key_level_id):
     key_level = EvalKeyLevel.find_by_id(int(key_level_id))
     card = key_level.card
     if card.is_authorized():
         template = JinjaEnv.get().get_template('templates/key_level/delete_form.html')
         self.response.out.write(template.render({'key_level_id': key_level_id, 'key_level': key_level}))
 def preview(self, card_id):
     card = ReportCard.find_by_id(int(card_id))
     if card.is_authorized():
         template = JinjaEnv.get().get_template('templates/card/preview.html')
         self.response.out.write(template.render({'card': ReportCard.find_by_id(int(card_id))}))
 def preview(self, eval_id):
     eval = Evaluation.find_by_id(int(eval_id))
     if eval.card.is_authorized():
         template = JinjaEnv.get().get_template('templates/eval/preview.html')
         self.response.out.write(template.render({'eval': eval, 'data': eval.all_data()}))
 def add_owner_form(self, card_id):
     current_user = AppUser.for_user(users.get_current_user())
     if current_user.is_admin:
         template = JinjaEnv.get().get_template('templates/card/owner_add_form.html')
         self.response.out.write(template.render({'card': ReportCard.find_by_id(int(card_id)), 'users': AppUser.list()}))
 def delete_form(self, category_id):
     category = EvalCategory.find_by_id(int(category_id))
     card = category.card
     if card.is_authorized():
         template = JinjaEnv.get().get_template('templates/category/delete_form.html')
         self.response.out.write(template.render({'category_id': category_id, 'category': category}))
 def delete_form(self, signature_id):
     sig = Signature.find_by_id(int(signature_id))
     if sig.card.is_authorized():
         template = JinjaEnv.get().get_template('templates/signature/delete_form.html')
         self.response.out.write(template.render({'signature_id': signature_id, 'signature': sig}))
 def delete_form(self, text_line_id):
     text_line = TextLine.find_by_id(int(text_line_id))
     if text_line.card.is_authorized():
         template = JinjaEnv.get().get_template('templates/text_line/delete_form.html')
         self.response.out.write(template.render({'text_line_id': text_line_id, 'text_line': text_line}))
 def delete_form(self, item_id):
     item = EvalItem.find_by_id(int(item_id))
     card = item.category.card
     if card.is_authorized():            
         template = JinjaEnv.get().get_template('templates/item/delete_form.html')
         self.response.out.write(template.render({'item_id': item_id, 'item': item}))
Ejemplo n.º 20
0
import os
import webapp2

from handlers.card_handler import CardHandler
from handlers.category_handler import CategoryHandler
from handlers.eval_handler import EvalHandler
from handlers.item_handler import ItemHandler
from handlers.key_handler import KeyHandler
from handlers.text_line_handler import TextLineHandler
from handlers.signature_handler import SignatureHandler
from utils.jinja_env import JinjaEnv
from utils.auth import Auth

jinja_environment = jinja2.Environment(loader=jinja2.FileSystemLoader(os.path.dirname(__file__)))
jinja_environment.globals.update({'uri_for': webapp2.uri_for, 'logout_url': Auth.logout_url})
JinjaEnv.set(jinja_environment)

app = webapp2.WSGIApplication([
    webapp2.Route(r'/card/list', handler=CardHandler, handler_method='list', name='card-list'),
    webapp2.Route(r'/card/add_form', handler=CardHandler, handler_method='add_form', name='card-add-form'),
    webapp2.Route(r'/card/<card_id:\d+>/add_owner', handler=CardHandler, handler_method='add_owner', name='card-add-owner'),
    webapp2.Route(r'/card/<card_id:\d+>/add_owner_form', handler=CardHandler, handler_method='add_owner_form', name='card-add-owner-form'),
    webapp2.Route(r'/card/add', handler=CardHandler, handler_method='add', name='card-add'),
    webapp2.Route(r'/card/<card_id:\d+>/edit', handler=CardHandler, handler_method='edit', name='card-edit'),
    webapp2.Route(r'/card/<card_id:\d+>/preview', handler=CardHandler, handler_method='preview', name='card-preview'),
    webapp2.Route(r'/card/<card_id:\d+>/text_line/add_form', handler=TextLineHandler, handler_method='add_form'),
    webapp2.Route(r'/card/<card_id:\d+>/text_line/add', handler=TextLineHandler, handler_method='add'),
    webapp2.Route(r'/card/<card_id:\d+>/signature/add_form', handler=SignatureHandler, handler_method='add_form'),
    webapp2.Route(r'/card/<card_id:\d+>/signature/add', handler=SignatureHandler, handler_method='add'),
    webapp2.Route(r'/card/<card_id:\d+>/category/add_form', handler=CategoryHandler, handler_method='add_form'),
    webapp2.Route(r'/card/<card_id:\d+>/key_level/add', handler=KeyHandler, handler_method='add'),
 def list(self, card_id):
     # TODO: handle this some other way
     AppUser.record_access(users.get_current_user())
     current_user = AppUser.for_user(users.get_current_user())
     template = JinjaEnv.get().get_template('templates/eval/list.html')
     self.response.out.write(template.render({'card': ReportCard.find_by_id(int(card_id)), 'current_user': current_user}))
 def add_form(self, card_id):
     card = ReportCard.find_by_id(int(card_id))
     if card.is_authorized():
         template = JinjaEnv.get().get_template('templates/category/add_form.html')
         self.response.out.write(template.render({'card_id': card_id}))
 def add_form(self):
     template = JinjaEnv.get().get_template('templates/card/add_form.html')
     self.response.out.write(template.render({}))