Ejemplo n.º 1
0
 def index(self):
     from main import db
     from models import Cards
     from config import COLOURS_FOR_SHARDS
     snippets = Snippets.getSnippetsForPage(request.endpoint)
     posts = BlogData.topPosts(5)
     cards = db.session.query(Cards.colour, db.func.count(Cards.colour)).group_by(Cards.colour).all()
     return render_template('index.html', top_posts=posts, snippets=snippets, cards=cards, card_colours=COLOURS_FOR_SHARDS);
Ejemplo n.º 2
0
    def resourceDraw(self):
        from tools_resourceDraw import ResourceForm, ResourceCalculator
        form = ResourceForm()
        snippets = Snippets.getSnippetsForPage(request.endpoint)

        if request.method == 'POST' and form.validate_on_submit():
            types = []
            for x in range(0,len(form.resource_types)):
                types.append({'name': form.resource_types_names[x].data,
                              'num': form.resource_types[x].data,
                              })
            table = ResourceCalculator.resourceTable(
                                                     form.decksize.data, 
                                                     form.resourcesInDeck.data, 
                                                     form.turns.data, 
                                                     form.turn_one_draw.data, 
                                                     types, 
                                                     form.accumulate.data,
                                                     form.elim_unplayable.data
                                                     )
            return redirect(url_for('ToolsView:resourceLink', string=ResourceCalculator.resourceLinkfromForm(form)))
            
        return render_template('tools/resource_draw.html', snippets=snippets, form = form, table=None);
Ejemplo n.º 3
0
 def __init__(self):
     super(BlogView, self).__init__()
     self.snippets = Snippets.getSnippetsForPage(u'BlogView:index')
Ejemplo n.º 4
0
 def cardJS(self):
     #from tools_cardHoverJS import CardLibrary
     #cl = CardLibrary('http://hexmetrics.ni.tl/static/all_cards.html', rebase_url='http://hextcg.gamepedia.com/', rebase_img_url=url_for('static', filename='img/card-icons'))
     return render_template('tools/card_hover_js.html', snippets=Snippets.getSnippetsForPage(request.endpoint))
Ejemplo n.º 5
0
 def resourceLink(self, string):
     from tools_resourceDraw import ResourceCalculator
     snippets = Snippets.getSnippetsForPage('ToolsView:resourceDraw')
     return ResourceCalculator.urlFromResourceLink(string, snippets)
Ejemplo n.º 6
0
 def index(self):
     snippets = Snippets.getSnippetsForPage(request.endpoint)
     return render_template('tools.html', snippets=snippets);
Ejemplo n.º 7
0
 def pageForSnippetName(self, snippet_name):
     return render_template('basic.html',snippet=Snippets.getSnippetByName(snippet_name));