def home(): pages = current_wiki.index() page = Page.get_highest_page_from_unversioned_file(pages, 'home') # page = current_wiki.get('home') if page: return display(page.url) return render_template('home.html')
def index(): pages = current_wiki.index() user = current_user.get("roles") isAdmin = False if 'admin' in user: isAdmin = True return render_template('index.html', pages=pages, isAdmin = isAdmin)
def delete(url): page = current_wiki.get_or_404(url) all_pages = current_wiki.index() pages = Page.get_versions(page.path, all_pages) for p in pages: current_wiki.delete(p.url) flash('Page "%s" was deleted.' % page.title, 'success') return redirect(url_for('wiki.home'))
def md2pdf_multiple_page(pdf_template, select_template): links = current_wiki.index() if request.method == "POST": data = request.form.getlist('page') pages = [] for url in data: pages.append(current_wiki.get_or_404(url)) html = render_template(pdf_template, pages=pages) return render_pdf(HTML(string=html)) return render_template(select_template, pages=links)
def versions(url): """ @file: routes.py @author: Dustin Gulley @date: 04/08/2018 Returns all page versions of a specified url 'myfile_v1' -> [Page with 'path/to/myfile_v1.txt', Page with 'path/to/myfile_v2.txt'] """ page = current_wiki.get(url) all_pages = current_wiki.index() pages = Page.get_versions(page.path, all_pages) return render_template('versions.html', pages=pages)
def move(url): page = current_wiki.get_or_404(url) form = URLForm(obj=page) if form.validate_on_submit(): newurl = form.url.data current_wiki.move(url, newurl) # Delete non-moved pages all_pages = current_wiki.index() pages = Page.get_versions(page.path, all_pages) for p in pages: current_wiki.delete(p.url) flash('Page "%s" was deleted.' % page.title, 'success') return redirect(url_for('wiki.display', url=newurl)) return render_template('move.html', form=form, page=page)
def stats(): tags = current_wiki.get_tags() stats_dict = {} seq = range(len(tags.keys())) for key in tags.keys(): stats_dict[key] = len(tags[key]) pages = current_wiki.index() counts = [] tags = [] for page in pages: counts += [len(page.tags)] tags += [(len(page.tags.split(',')), page.tags)] return render_template('stats.html', stats_dict=stats_dict, seq=seq, pages=pages, counts=counts, tags=tags)
def edit(url): page = current_wiki.get(url) form = EditorForm(obj=page) if form.validate_on_submit(): if not page: page = current_wiki.get_bare(url) form.populate_obj(page) page.save() new_path = Page.get_highest_version_of_file_path(page.path) pages = current_wiki.index() new_page = None for p in pages: if p.path == new_path: new_page = p if new_page is None: new_page = page flash('"%s" was saved.' % new_page.title, 'success') return redirect(url_for('wiki.display', url=new_page.url)) return render_template('editor.html', form=form, page=page)
def index(): pages = current_wiki.index() return render_template('index.html', pages=pages)
def index(): pages = current_wiki.index() pages = Page.filter_old_versions(pages) return render_template('index.html', pages=pages)
def index(): pages = current_wiki.index() uploads = current_wiki.indexUploads() return render_template('index.html', pages=pages, uploads=uploads)
def md2pdf_full_wiki(pdf_template): pages = current_wiki.index() html = render_template(pdf_template, pages=pages) return render_pdf(HTML(string=html))