예제 #1
0
    def index():
        report_path = path.join(client_path, 'compiled')

        # read out and sort all compiled reports (ignore the README)
        files = [
            f for f in listdir(report_path)
            if path.isfile(path.join(report_path, f)) and f != "README.md"
        ]
        files.sort()

        file_links = [
            LinkBuilder(text=f.replace('.html', ''), url='/report?name=' + f)
            for f in files
        ]
        file_list = ListBuilder(list_items=file_links,
                                list_header='Your Reports')

        buttons = [
            ButtonBuilder(text='New ' + b + ' Report',
                          button_id=b,
                          attrs={"data-type": b}) for b in valid_report_types
        ]
        button_list = ListBuilder(list_items=buttons,
                                  list_header=' Generate Reports')

        template = HTMLUtil.get_template('index.html')\
            .replace('$$__REPORTS__$$', file_list.compile())\
            .replace('$$__GEN_REPORTS__$$', button_list.compile())

        return template
 def get_stock_search():
     return HTMLUtil.get_template('stock-search.html')