from flask import render_template, Blueprint, request
from backstage.config import BHOUSE_SERVER

editor_app = Blueprint('editor', __name__)


@editor_app.route('/backstage/editor')
def editor():
    type = ""
    url = request.args.get('url', type=str)
    if "collection" in url: # 作品集
        type = "collection"
        return render_template('editorcollection.html', title='Type Editor', url=url, type=type, bhouse_server=BHOUSE_SERVER)
    elif "blog" in url: # 設計專欄
        type = "blog"
        return render_template('editorblog.html', title='Type Editor', url=url, type=type, bhouse_server=BHOUSE_SERVER)
    return render_template('editor.html', title='Type Editor', url=url, type=type, bhouse_server=BHOUSE_SERVER)
